Package org.apache.sshd.sftp.server
Class FileHandle
- java.lang.Object
-
- org.apache.sshd.sftp.server.Handle
-
- org.apache.sshd.sftp.server.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 intaccessprivate java.util.Collection<java.nio.file.attribute.FileAttribute<?>>fileAttributesprivate java.nio.channels.SeekableByteChannelfileChannelprivate java.util.List<java.nio.channels.FileLock>locksprivate 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 voidappend(byte[] data)voidappend(byte[] data, int doff, int length)voidclose()intgetAccessMask()java.util.Collection<java.nio.file.attribute.FileAttribute<?>>getFileAttributes()java.nio.channels.SeekableByteChannelgetFileChannel()java.util.Set<java.nio.file.StandardOpenOption>getOpenOptions()static java.util.Set<java.nio.file.StandardOpenOption>getOpenOptions(int flags, int access)booleanisOpenAppend()voidlock(long offset, long length, int mask)intread(byte[] data, int doff, int length, long offset)intread(byte[] data, int doff, int length, long offset, java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> eof)intread(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)voidunlock(long offset, long length)voidwrite(byte[] data, int doff, int length, long offset)voidwrite(byte[] data, long offset)-
Methods inherited from class org.apache.sshd.sftp.server.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
-
read
public int read(byte[] data, int doff, int length, long offset, java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> eof) 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)
-
-