public class NativeSshFile extends Object implements SshFile
SshFile.Attribute, SshFile.Permission| Modifier and Type | Field and Description |
|---|---|
protected File |
file |
protected String |
fileName |
protected static org.slf4j.Logger |
LOG |
protected NativeFileSystemView |
nativeFileSystemView |
protected String |
userName |
| Modifier | Constructor and Description |
|---|---|
protected |
NativeSshFile(NativeFileSystemView nativeFileSystemView,
String fileName,
File file,
String userName)
Constructor, internal do not use directly.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
create()
Create a new file
|
InputStream |
createInputStream(long offset)
Create input stream for reading.
|
OutputStream |
createOutputStream(long offset)
Create output stream for writing.
|
void |
createSymbolicLink(SshFile destination) |
boolean |
delete()
Delete file.
|
boolean |
doesExist()
Does this file exists?
|
boolean |
equals(Object obj) |
String |
getAbsolutePath()
Get full name.
|
Object |
getAttribute(SshFile.Attribute attribute,
boolean followLinks) |
Map<SshFile.Attribute,Object> |
getAttributes(boolean followLinks) |
long |
getLastModified()
Get last modified time.
|
String |
getName()
Get short name.
|
File |
getNativeFile() |
String |
getOwner()
Get owner name
|
SshFile |
getParentFile()
Get the immediate parent.
|
File |
getPhysicalFile()
Returns the according physical file.
|
static String |
getPhysicalName(String rootDir,
String currDir,
String fileName,
boolean caseInsensitive)
Get the physical canonical file name.
|
long |
getSize()
Get file size.
|
void |
handleClose()
Handle post-handle-close functionality.
|
protected void |
handleUnsupportedAttributes(Collection<SshFile.Attribute> attributes) |
boolean |
isDirectory()
Is it a directory?
|
boolean |
isExecutable()
Check file exec permission.
|
boolean |
isFile()
Is it a file?
|
boolean |
isReadable()
Check read permission.
|
boolean |
isRemovable()
Has delete permission.
|
boolean |
isWritable()
Check file write permission.
|
List<SshFile> |
listSshFiles()
List files.
|
boolean |
mkdir()
Create directory.
|
boolean |
move(SshFile dest)
Move file object.
|
static String |
normalizeSeparateChar(String pathName)
Normalize separate character.
|
String |
readSymbolicLink() |
void |
setAttribute(SshFile.Attribute attribute,
Object value) |
void |
setAttributes(Map<SshFile.Attribute,Object> attributes) |
boolean |
setLastModified(long time)
Set the last modified time stamp of a file
|
String |
toString() |
void |
truncate()
Truncate file to length 0.
|
protected static final org.slf4j.Logger LOG
protected String fileName
protected File file
protected String userName
protected final NativeFileSystemView nativeFileSystemView
protected NativeSshFile(NativeFileSystemView nativeFileSystemView, String fileName, File file, String userName)
nativeFileSystemView - public File getNativeFile()
public String getAbsolutePath()
getAbsolutePath in interface SshFilepublic String getName()
public String getOwner()
public boolean isDirectory()
isDirectory in interface SshFileSshFile is a directorypublic boolean isFile()
public boolean doesExist()
public long getSize()
public long getLastModified()
getLastModified in interface SshFileSshFilepublic boolean setLastModified(long time)
setLastModified in interface SshFiletime - The last modified time, in milliseconds since the epoch. See File.setLastModified(long).public boolean isReadable()
isReadable in interface SshFileSshFile is readable by the userpublic boolean isWritable()
isWritable in interface SshFileSshFile is writable by the userpublic boolean isExecutable()
isExecutable in interface SshFileSshFile is executable by the userpublic boolean isRemovable()
isRemovable in interface SshFileSshFile is removable by the userpublic SshFile getParentFile()
SshFilegetParentFile in interface SshFilepublic boolean delete()
public boolean create()
throws IOException
create in interface SshFileIOException - if something wrong happenpublic void truncate()
throws IOException
truncate in interface SshFileIOException - if something wrong happenpublic boolean move(SshFile dest)
public boolean mkdir()
public List<SshFile> listSshFiles()
listSshFiles in interface SshFileList of SshFilespublic OutputStream createOutputStream(long offset) throws IOException
createOutputStream in interface SshFileoffset - The number of bytes at where to start writing.
If the file is not random accessible,
any offset other than zero will throw an exception.OutputStream used to write to the SshFileIOExceptionpublic InputStream createInputStream(long offset) throws IOException
createInputStream in interface SshFileoffset - The number of bytes of where to start reading.
If the file is not random accessible,
any offset other than zero will throw an exception.InputStream used to read the SshFileIOExceptionpublic void handleClose()
SshFilehandleClose in interface SshFilepublic static final String normalizeSeparateChar(String pathName)
public static final String getPhysicalName(String rootDir, String currDir, String fileName, boolean caseInsensitive)
rootDir - The root directory.currDir - The current directory. It will always be with respect to the
root directory.fileName - The input file name.public File getPhysicalFile()
public Map<SshFile.Attribute,Object> getAttributes(boolean followLinks) throws IOException
getAttributes in interface SshFileIOExceptionpublic void setAttributes(Map<SshFile.Attribute,Object> attributes) throws IOException
setAttributes in interface SshFileIOExceptionprotected void handleUnsupportedAttributes(Collection<SshFile.Attribute> attributes)
public Object getAttribute(SshFile.Attribute attribute, boolean followLinks) throws IOException
getAttribute in interface SshFileIOExceptionpublic void setAttribute(SshFile.Attribute attribute, Object value) throws IOException
setAttribute in interface SshFileIOExceptionpublic String readSymbolicLink() throws IOException
readSymbolicLink in interface SshFileIOExceptionpublic void createSymbolicLink(SshFile destination) throws IOException
createSymbolicLink in interface SshFileIOExceptionCopyright © 2008–2014 The Apache Software Foundation. All rights reserved.