path.java
来自「RESIN 3.2 最新源码」· Java 代码 · 共 1,564 行 · 第 1/3 页
JAVA
1,564 行
/** * Returns any signing certificates, e.g. for jar signing. */ public Certificate []getCertificates() { return null; } /** * Tests if the file exists. */ public boolean exists() { return false; } /** * Returns the mime-type of the file. * <p>Mime-type ignorant filesystems return 'application/octet-stream' */ public String getContentType() { return "application/octet-stream"; } /** * Tests if the path refers to a directory. */ public boolean isDirectory() { return false; } /** * Tests if the path refers to a file. */ public boolean isFile() { return false; } /** * Tests if the path refers to a symbolic link. */ public boolean isLink() { return false; } /** * Tests if the path refers to a socket. */ public boolean isSocket() { return false; } /** * Tests if the path refers to a FIFO. */ public boolean isFIFO() { return false; } /** * Tests if the path refers to a block device. */ public boolean isBlockDevice() { return false; } /** * Tests if the path refers to a block device. */ public boolean isCharacterDevice() { return false; } /** * Tests if the path is marked as executable */ public boolean isExecutable() { return false; } /** * Change the executable status of the of the oath. * * @throws UnsupportedOperationException */ public boolean setExecutable(boolean isExecutable) { return false; } /** * Tests if the path refers to a symbolic link. */ public boolean isSymbolicLink() { return false; } /** * Tests if the path refers to a hard link. */ public boolean isHardLink() { return false; } /** * Tests if the path refers to an object. */ public boolean isObject() { return false; } /** * Returns the length of the file in bytes. * @return 0 for non-files */ public long getLength() { return 0; } /** * Returns the last modified time of the file. According to the jdk, * this may not correspond to the system time. * @return 0 for non-files. */ public long getLastModified() { return 0; } public void setLastModified(long time) { } /** * Returns the last access time of the file. * * @return 0 for non-files. */ public long getLastAccessTime() { return getLastModified(); } /** * Returns the create time of the file. * * @return 0 for non-files. */ public long getCreateTime() { return getLastModified(); } /** * Tests if the file can be read. */ public boolean canRead() { return false; } /** * Tests if the file can be written. */ public boolean canWrite() { return false; } // // POSIX stat() related calls // /** * Returns equivalent of struct stat.st_dev if appropriate. */ public long getDevice() { return 0; } /** * Returns equivalent of struct stat.st_ino if appropriate. */ public long getInode() { return 0; } /** * Returns equivalent of struct stat.st_mode if appropriate. */ public int getMode() { return 0; } /** * Returns equivalent of struct stat.st_nlink if appropriate. */ public int getNumberOfLinks() { return 0; } /** * Returns equivalent of struct stat.st_uid if appropriate. */ public int getUser() { return 0; } /** * Returns equivalent of struct stat.st_gid if appropriate. */ public int getGroup() { return 0; } /** * Returns equivalent of struct stat.st_rdev if appropriate. */ public long getDeviceId() { return 0; } /** * Returns equivalent of struct stat.st_blksize if appropriate. */ public long getBlockSize() { return 0; } /** * Returns equivalent of struct stat.st_blocks if appropriate. */ public long getBlockCount() { return 0; } /** * Returns equivalent of struct stat.st_ctime if appropriate. */ public long getLastStatusChangeTime() { return 0; } /** * Tests if the file can be read. */ public boolean canExecute() { return canRead(); } /** * Changes the group */ public boolean changeGroup(int gid) throws IOException { return false; } /** * Changes the group */ public boolean changeGroup(String groupName) throws IOException { return false; } /** * Changes the permissions * * @return true if successful */ public boolean chmod(int value) { return false; } public int getOwner() { return getUser(); } /** * Changes the owner * * @return true if successful */ public boolean changeOwner(int uid) throws IOException { return false; } /** * Changes the owner * * @return true if successful */ public boolean changeOwner(String ownerName) throws IOException { return false; } public long getDiskSpaceFree() { return 0; } public long getDiskSpaceTotal() { return 0; } /** * @return The contents of this directory or null if the path does not * refer to a directory. */ public String []list() throws IOException { return new String[0]; } /** * Returns a jdk1.2 Iterator for the contents of this directory. */ public Iterator<String> iterator() throws IOException { String list[] = list(); // Avoids NPE when subclasses override list() and // possibly return null, e.g. JarPath. if (list == null) list = new String[0]; return new ArrayIterator(list); } /** * Creates the directory named by this path. * @return true if successful. */ public boolean mkdir() throws IOException { return false; } /** * Creates the directory named by this path and any parent directories. * @return true if successful. */ public boolean mkdirs() throws IOException { return false; } /** * Removes the file or directory named by this path. * * @return true if successful */ public boolean remove() throws IOException { return false; } /** * Removes the all files and directories below this path. * * @return true if successful. */ public boolean removeAll() throws IOException { if (isDirectory()) { String []list = list(); for (int i = 0; i < list.length; i++) { Path subpath = lookup(list[i]); subpath.removeAll(); } } return remove(); } /** * Sets the length of the file to zero. * * @return true if successful */ public boolean truncate() throws IOException { return truncate(0); } /** * Sets the length of the file. * * @return true if successful */ public boolean truncate(long length) throws IOException { if (length == 0) { if (exists()) { StreamImpl stream = openWriteImpl(); stream.close(); return true; } else return false; } else throw new UnsupportedOperationException(getClass().getName() + ": truncate"); } /** * Renames the file or directory to the name given by the path. * @return true if successful */ public boolean renameTo(Path path) throws IOException { return false; } /** * Renames the file or directory to the name given by the path. * @return true if successful */ public final boolean renameTo(String path) throws IOException { return renameTo(lookup(path)); } /** * Creates a restricted root, like the Unix chroot call. * Restricted roots cannot access schemes, so file:/etc/passwd cannot * be used. * * <p>createRoot is useful for restricting JavaScript scripts without * resorting to the dreadfully slow security manager. */ public Path createRoot() { return createRoot(SchemeMap.getNullSchemeMap()); } public Path createRoot(SchemeMap schemeMap) { throw new UnsupportedOperationException("createRoot"); } /** * Binds the context to the current path. Later lookups will return * the new context instead of the current path. Essentially, this is a * software symbolic link. */ public void bind(Path context) { throw new UnsupportedOperationException("bind"); } /** * unbinds a link. */ public void unbind() { throw new UnsupportedOperationException("unbind"); } /** * Gets the object at the path. Normal filesystems will generally * typically return null. * * <p>A bean filesystem or a mime-type aware filesystem could deserialize * the contents of the file. */ public Object getValue() throws Exception { throw new UnsupportedOperationException("getValue"); } /** * Sets the object at the path. * * <p>Normal filesystems will generally do nothing. However, a bean * filesystem or a mime-type aware filesystem could serialize the object * and store it. */ public void setValue(Object obj) throws Exception { throw new UnsupportedOperationException("setValue"); } /**
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?