Class FileHandle
- java.lang.Object
-
- org.apache.sshd.server.subsystem.sftp.Handle
-
- org.apache.sshd.server.subsystem.sftp.FileHandle
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,AttributeRepository
,AttributeStore
public class FileHandle extends Handle
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>
-
-
Field Summary
Fields Modifier and Type Field Description private int
access
private java.util.Collection<java.nio.file.attribute.FileAttribute<?>>
fileAttributes
private java.nio.channels.SeekableByteChannel
fileChannel
private java.util.List<java.nio.channels.FileLock>
locks
private java.util.Set<java.nio.file.StandardOpenOption>
openOptions
-
Constructor Summary
Constructors Constructor Description FileHandle(SftpSubsystem subsystem, java.nio.file.Path file, java.lang.String handle, int flags, int access, java.util.Map<java.lang.String,java.lang.Object> attrs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(byte[] data)
void
append(byte[] data, int doff, int length)
void
close()
int
getAccessMask()
java.util.Collection<java.nio.file.attribute.FileAttribute<?>>
getFileAttributes()
java.nio.channels.SeekableByteChannel
getFileChannel()
java.util.Set<java.nio.file.StandardOpenOption>
getOpenOptions()
static java.util.Set<java.nio.file.StandardOpenOption>
getOpenOptions(int flags, int access)
boolean
isOpenAppend()
void
lock(long offset, long length, int mask)
int
read(byte[] data, int doff, int length, long offset)
int
read(byte[] data, long offset)
static java.nio.file.attribute.FileAttribute<?>
toFileAttribute(java.lang.String key, java.lang.Object val)
static java.util.Collection<java.nio.file.attribute.FileAttribute<?>>
toFileAttributes(java.util.Map<java.lang.String,?> attrs)
void
unlock(long offset, long length)
void
write(byte[] data, int doff, int length, long offset)
void
write(byte[] data, long offset)
-
Methods inherited from class org.apache.sshd.server.subsystem.sftp.Handle
attributeKeys, clearAttributes, computeAttributeIfAbsent, getAttribute, getAttributesCount, getFile, getFileHandle, getSubsystem, isOpen, removeAttribute, setAttribute, signalHandleOpen, signalHandleOpening, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
resolveAttribute
-
-
-
-
Field Detail
-
access
private final int access
-
fileChannel
private final java.nio.channels.SeekableByteChannel fileChannel
-
locks
private final java.util.List<java.nio.channels.FileLock> locks
-
openOptions
private final java.util.Set<java.nio.file.StandardOpenOption> openOptions
-
fileAttributes
private final java.util.Collection<java.nio.file.attribute.FileAttribute<?>> fileAttributes
-
-
Constructor Detail
-
FileHandle
public FileHandle(SftpSubsystem subsystem, java.nio.file.Path file, java.lang.String handle, int flags, int access, java.util.Map<java.lang.String,java.lang.Object> attrs) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getOpenOptions
public final java.util.Set<java.nio.file.StandardOpenOption> getOpenOptions()
-
getFileAttributes
public final java.util.Collection<java.nio.file.attribute.FileAttribute<?>> getFileAttributes()
-
getFileChannel
public java.nio.channels.SeekableByteChannel getFileChannel()
-
getAccessMask
public int getAccessMask()
-
isOpenAppend
public boolean isOpenAppend()
-
read
public int read(byte[] data, long offset) throws java.io.IOException
- Throws:
java.io.IOException
-
read
public int read(byte[] data, int doff, int length, long offset) throws java.io.IOException
- Throws:
java.io.IOException
-
append
public void append(byte[] data) throws java.io.IOException
- Throws:
java.io.IOException
-
append
public void append(byte[] data, int doff, int length) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public void write(byte[] data, long offset) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public void write(byte[] data, int doff, int length, long offset) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
-
lock
public void lock(long offset, long length, int mask) throws java.io.IOException
- Throws:
java.io.IOException
-
unlock
public void unlock(long offset, long length) throws java.io.IOException
- Throws:
java.io.IOException
-
toFileAttributes
public static java.util.Collection<java.nio.file.attribute.FileAttribute<?>> toFileAttributes(java.util.Map<java.lang.String,?> attrs)
-
toFileAttribute
public static java.nio.file.attribute.FileAttribute<?> toFileAttribute(java.lang.String key, java.lang.Object val)
-
getOpenOptions
public static java.util.Set<java.nio.file.StandardOpenOption> getOpenOptions(int flags, int access)
-
-