public class NativeSshFile extends java.lang.Object implements SshFile
SshFile.Attribute, SshFile.Permission| Modifier and Type | Field and Description |
|---|---|
protected java.io.File |
file |
protected java.lang.String |
fileName |
protected static org.slf4j.Logger |
LOG |
protected NativeFileSystemView |
nativeFileSystemView |
protected java.lang.String |
userName |
| Modifier | Constructor and Description |
|---|---|
protected |
NativeSshFile(NativeFileSystemView nativeFileSystemView,
java.lang.String fileName,
java.io.File file,
java.lang.String userName)
Constructor, internal do not use directly.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
create()
Create a new file
|
java.io.InputStream |
createInputStream(long offset)
Create input stream for reading.
|
java.io.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(java.lang.Object obj) |
java.lang.String |
getAbsolutePath()
Get full name.
|
java.lang.Object |
getAttribute(SshFile.Attribute attribute,
boolean followLinks) |
java.util.Map<SshFile.Attribute,java.lang.Object> |
getAttributes(boolean followLinks) |
long |
getLastModified()
Get last modified time.
|
java.lang.String |
getName()
Get short name.
|
java.io.File |
getNativeFile() |
java.lang.String |
getOwner()
Get owner name
|
SshFile |
getParentFile()
Get the immediate parent.
|
java.io.File |
getPhysicalFile()
Returns the according physical file.
|
static java.lang.String |
getPhysicalName(java.lang.String rootDir,
java.lang.String currDir,
java.lang.String fileName,
boolean caseInsensitive)
Get the physical canonical file name.
|
long |
getSize()
Get file size.
|
void |
handleClose()
Handle post-handle-close functionality.
|
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.
|
java.util.List<SshFile> |
listSshFiles()
List files.
|
boolean |
mkdir()
Create directory.
|
boolean |
move(SshFile dest)
Move file object.
|
static java.lang.String |
normalizeSeparateChar(java.lang.String pathName)
Normalize separate character.
|
java.lang.String |
readSymbolicLink() |
void |
setAttribute(SshFile.Attribute attribute,
java.lang.Object value) |
void |
setAttributes(java.util.Map<SshFile.Attribute,java.lang.Object> attributes) |
boolean |
setLastModified(long time)
Set the last modified time stamp of a file
|
java.lang.String |
toString() |
void |
truncate()
Truncate file to length 0.
|
protected static final org.slf4j.Logger LOG
protected java.lang.String fileName
protected java.io.File file
protected java.lang.String userName
protected final NativeFileSystemView nativeFileSystemView
protected NativeSshFile(NativeFileSystemView nativeFileSystemView, java.lang.String fileName, java.io.File file, java.lang.String userName)
nativeFileSystemView - public java.io.File getNativeFile()
public java.lang.String getAbsolutePath()
getAbsolutePath in interface SshFilepublic java.lang.String getName()
public java.lang.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 java.io.IOException
public void truncate()
throws java.io.IOException
public boolean move(SshFile dest)
public boolean mkdir()
public java.util.List<SshFile> listSshFiles()
listSshFiles in interface SshFileList of SshFilespublic java.io.OutputStream createOutputStream(long offset)
throws java.io.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 SshFilejava.io.IOExceptionpublic java.io.InputStream createInputStream(long offset)
throws java.io.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 SshFilejava.io.IOExceptionpublic void handleClose()
SshFilehandleClose in interface SshFilepublic static final java.lang.String normalizeSeparateChar(java.lang.String pathName)
public static final java.lang.String getPhysicalName(java.lang.String rootDir,
java.lang.String currDir,
java.lang.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 boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.io.File getPhysicalFile()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Map<SshFile.Attribute,java.lang.Object> getAttributes(boolean followLinks) throws java.io.IOException
getAttributes in interface SshFilejava.io.IOExceptionpublic void setAttributes(java.util.Map<SshFile.Attribute,java.lang.Object> attributes) throws java.io.IOException
setAttributes in interface SshFilejava.io.IOExceptionpublic java.lang.Object getAttribute(SshFile.Attribute attribute, boolean followLinks) throws java.io.IOException
getAttribute in interface SshFilejava.io.IOExceptionpublic void setAttribute(SshFile.Attribute attribute, java.lang.Object value) throws java.io.IOException
setAttribute in interface SshFilejava.io.IOExceptionpublic java.lang.String readSymbolicLink()
throws java.io.IOException
readSymbolicLink in interface SshFilejava.io.IOExceptionpublic void createSymbolicLink(SshFile destination) throws java.io.IOException
createSymbolicLink in interface SshFilejava.io.IOExceptionCopyright © 2008-2014 The Apache Software Foundation. All Rights Reserved.