SftpFileObjectWithWindowsSupport( AbstractFileName name, SftpFileSystemWindows fileSystem ) throws FileSystemException { super( name, fileSystem ); this.path = name.getPath(); }
/** * Returns the base name of the file. * * @return The base name of the file. */ @Override public String getBaseName() { if (baseName == null) { final int idx = getPath().lastIndexOf(SEPARATOR_CHAR); if (idx == -1) { baseName = getPath(); } else { baseName = getPath().substring(idx + 1); } } return baseName; }
/** * Returns the depth of this file name, within its file system. * * @return The depth of the file name. */ @Override public int getDepth() { final int len = getPath().length(); if (len == 0 || len == 1 && getPath().charAt(0) == SEPARATOR_CHAR) { return 0; } int depth = 1; for (int pos = 0; pos > -1 && pos < len; depth++) { pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1); } return depth; }
private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); }
private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); }
private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); }
private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); }
/** * Creates a file object. */ @Override protected FileObject createFile(final AbstractFileName name) throws FileSystemException { final String path = name.getPath().substring(1); if (path.length() == 0) { return new RARFileObject(name, this.archive, null, this); } else if (this.files.containsKey(name.getPath())) { return new RARFileObject(name, this.archive, this.files.get(name.getPath()), this); } return null; }
/** * Returns the decoded path. * * @return The decoded path String. * @throws FileSystemException If an error occurs. */ @Override public String getPathDecoded() throws FileSystemException { if (decodedAbsPath == null) { decodedAbsPath = UriParser.decode(getPath()); } return decodedAbsPath; }
/** * Returns the decoded path. * * @return The decoded path String. * @throws FileSystemException If an error occurs. */ @Override public String getPathDecoded() throws FileSystemException { if (decodedAbsPath == null) { decodedAbsPath = UriParser.decode(getPath()); } return decodedAbsPath; }
/** * Returns the decoded path. * @return The decoded path String. * @throws FileSystemException If an error occurs. */ @Override public String getPathDecoded() throws FileSystemException { if (decodedAbsPath == null) { decodedAbsPath = UriParser.decode(getPath()); } return decodedAbsPath; }
/** * Returns the decoded path. * * @return The decoded path String. * @throws FileSystemException If an error occurs. */ @Override public String getPathDecoded() throws FileSystemException { if (decodedAbsPath == null) { decodedAbsPath = UriParser.decode(getPath()); } return decodedAbsPath; }
/** * Determines if another file name is an ancestor of this file name. * * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override public boolean isAncestor(final FileName ancestor) { if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); }
/** * Determines if another file name is an ancestor of this file name. * * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override public boolean isAncestor(final FileName ancestor) { if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); }
/** * Determines if another file name is a descendent of this file name. * * @param descendent The FileName to check. * @param scope The NameScope. * @return true if the FileName is a descendent, false otherwise. */ @Override public boolean isDescendent(final FileName descendent, final NameScope scope) { if (!descendent.getRootURI().equals(getRootURI())) { return false; } return checkName(getPath(), descendent.getPath(), scope); }
/** * Determines if another file name is an ancestor of this file name. * * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override public boolean isAncestor(final FileName ancestor) { if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); }
/** * Determines if another file name is an ancestor of this file name. * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override public boolean isAncestor(final FileName ancestor) { if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); }
/** * Determines if another file name is a descendent of this file name. * * @param descendent The FileName to check. * @param scope The NameScope. * @return true if the FileName is a descendent, false otherwise. */ @Override public boolean isDescendent(final FileName descendent, final NameScope scope) { if (!descendent.getRootURI().equals(getRootURI())) { return false; } return checkName(getPath(), descendent.getPath(), scope); }
/** * Determines if another file name is a descendent of this file name. * * @param descendent The FileName to check. * @param scope The NameScope. * @return true if the FileName is a descendent, false otherwise. */ @Override public boolean isDescendent(final FileName descendent, final NameScope scope) { if (!descendent.getRootURI().equals(getRootURI())) { return false; } return checkName(getPath(), descendent.getPath(), scope); }
/** * Determines if another file name is a descendent of this file name. * @param descendent The FileName to check. * @param scope The NameScope. * @return true if the FileName is a descendent, false otherwise. */ @Override public boolean isDescendent(final FileName descendent, final NameScope scope) { if (!descendent.getRootURI().equals(getRootURI())) { return false; } return checkName(getPath(), descendent.getPath(), scope); }