Top Fields Constructors Methods
org.apache.sshd.sftp.server

public Class FileHandle

extends Handle
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.FileLock, .NonReadableChannelException, .NonWritableChannelException, .SeekableByteChannel, java.nio.file.Path, .StandardOpenOption, java.nio.file.attribute.FileAttribute, java.util.ArrayList, .Collection, .Collections, .EnumSet, .Iterator, .LinkedList, .List, .Map, .Set, java.util.concurrent.atomic.AtomicReference, org.apache.sshd.common.util.GenericUtils, .MapEntryUtils, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.sftp.common.SftpConstants, .SftpException

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private final int
private final Collection<FileAttribute<?>>
private final SeekableByteChannel
private final List<FileLock>
private final Set<StandardOpenOption>

Constructor Summary

AccessConstructor and Description
public
FileHandle(SftpSubsystem subsystem, Path file, String handle, int flags, int access, Map<String, Object> attrs)

Method Summary

Modifier and TypeMethod and Description
public void
append(byte[] data)

public void
append(byte[] data, int doff, int length)

private boolean
private boolean
public void
public int
public final Collection<FileAttribute<?>>
public SeekableByteChannel
public final Set<StandardOpenOption>
public static Set<StandardOpenOption>
getOpenOptions(int flags, int access)

public boolean
public void
lock(long offset, long length, int mask)

public int
read(byte[] data, long offset)

public int
read(byte[] data, int doff, int length, long offset)

public int
read(byte[] data, int doff, int length, long offset, AtomicReference<Boolean> eof)

public static FileAttribute<?>
public static Collection<FileAttribute<?>>
public void
unlock(long offset, long length)

public void
write(byte[] data, long offset)

public void
write(byte[] data, int doff, int length, long offset)

Inherited from org.apache.sshd.sftp.server.Handle:
attributeKeysclearAttributescomputeAttributeIfAbsentgetAttributegetAttributesCountgetFilegetFileHandlegetSubsystemisOpenremoveAttributesafesetAttributesignalHandleOpensignalHandleOpeningtoString

Field Detail

accessback to summary
private final int access
fileAttributesback to summary
private final Collection<FileAttribute<?>> fileAttributes
fileChannelback to summary
private final SeekableByteChannel fileChannel
locksback to summary
private final List<FileLock> locks
openOptionsback to summary
private final Set<StandardOpenOption> openOptions

Constructor Detail

FileHandleback to summary
public FileHandle(SftpSubsystem subsystem, Path file, String handle, int flags, int access, Map<String, Object> attrs) throws IOException

Method Detail

appendback to summary
public void append(byte[] data) throws IOException
appendback to summary
public void append(byte[] data, int doff, int length) throws IOException
canReadback to summary
private boolean canRead()
canWriteback to summary
private boolean canWrite()
closeback to summary
public void close() throws IOException

Overrides org.apache.sshd.sftp.server.Handle.close.

Implements java.nio.channels.Channel.close.

Doc from java.nio.channels.Channel.close.

Closes this channel.

After a channel is closed, any further attempt to invoke I/O operations upon it will cause a ClosedChannelException to be thrown.

If this channel is already closed then invoking this method has no effect.

This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
getAccessMaskback to summary
public int getAccessMask()
getFileAttributesback to summary
public final Collection<FileAttribute<?>> getFileAttributes()
getFileChannelback to summary
public SeekableByteChannel getFileChannel()
getOpenOptionsback to summary
public final Set<StandardOpenOption> getOpenOptions()
getOpenOptionsback to summary
public static Set<StandardOpenOption> getOpenOptions(int flags, int access)
isOpenAppendback to summary
public boolean isOpenAppend()
lockback to summary
public void lock(long offset, long length, int mask) throws IOException
readback to summary
public int read(byte[] data, long offset) throws IOException
readback to summary
public int read(byte[] data, int doff, int length, long offset) throws IOException
readback to summary
public int read(byte[] data, int doff, int length, long offset, AtomicReference<Boolean> eof) throws IOException
Annotations
@SuppressWarnings:resource
toFileAttributeback to summary
public static FileAttribute<?> toFileAttribute(String key, Object val)
toFileAttributesback to summary
public static Collection<FileAttribute<?>> toFileAttributes(Map<String, ?> attrs)
unlockback to summary
public void unlock(long offset, long length) throws IOException
writeback to summary
public void write(byte[] data, long offset) throws IOException
writeback to summary
public void write(byte[] data, int doff, int length, long offset) throws IOException