Package org.apache.sshd.sftp.client.impl
Class SftpRemotePathChannel
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- java.nio.channels.FileChannel
-
- org.apache.sshd.sftp.client.impl.SftpRemotePathChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,GatheringByteChannel,InterruptibleChannel,ReadableByteChannel,ScatteringByteChannel,SeekableByteChannel,WritableByteChannel
public class SftpRemotePathChannel extends FileChannel
- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.nio.channels.FileChannel
FileChannel.MapMode
-
-
Field Summary
Fields Modifier and Type Field Description protected AtomicReference<Thread>blockingThreadHolderprotected booleancloseOnExitprotected SftpClient.CloseableHandlehandleprotected Objectlockprotected org.slf4j.Loggerlogprotected Collection<SftpClient.OpenMode>modesprotected AtomicLongposTrackerstatic Set<SftpClient.OpenMode>READ_MODESprotected SftpClientsftpstatic Set<SftpClient.OpenMode>WRITE_MODES
-
Constructor Summary
Constructors Constructor Description SftpRemotePathChannel(String path, SftpClient sftp, boolean closeOnExit, Collection<SftpClient.OpenMode> modes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbeginBlocking(Object actionHint)protected longdoRead(Collection<? extends ByteBuffer> buffers, long position)protected longdoWrite(Collection<? extends ByteBuffer> buffers, long position)protected voidendBlocking(Object actionHint, boolean completed)voidforce(boolean metaData)StringgetRemotePath()protected voidimplCloseChannel()FileLocklock(long position, long size, boolean shared)MappedByteBuffermap(FileChannel.MapMode mode, long position, long size)longposition()FileChannelposition(long newPosition)intread(ByteBuffer dst)longread(ByteBuffer[] dsts, int offset, int length)intread(ByteBuffer dst, long position)longsize()StringtoString()longtransferFrom(ReadableByteChannel src, long position, long count)longtransferTo(long position, long count, WritableByteChannel target)FileChanneltruncate(long size)FileLocktryLock(long position, long size, boolean shared)intwrite(ByteBuffer src)longwrite(ByteBuffer[] srcs, int offset, int length)intwrite(ByteBuffer src, long position)-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Field Detail
-
READ_MODES
public static final Set<SftpClient.OpenMode> READ_MODES
-
WRITE_MODES
public static final Set<SftpClient.OpenMode> WRITE_MODES
-
log
protected final org.slf4j.Logger log
-
modes
protected final Collection<SftpClient.OpenMode> modes
-
closeOnExit
protected final boolean closeOnExit
-
sftp
protected final SftpClient sftp
-
handle
protected final SftpClient.CloseableHandle handle
-
lock
protected final Object lock
-
posTracker
protected final AtomicLong posTracker
-
blockingThreadHolder
protected final AtomicReference<Thread> blockingThreadHolder
-
-
Constructor Detail
-
SftpRemotePathChannel
public SftpRemotePathChannel(String path, SftpClient sftp, boolean closeOnExit, Collection<SftpClient.OpenMode> modes) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getRemotePath
public String getRemotePath()
-
read
public int read(ByteBuffer dst) throws IOException
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin interfaceSeekableByteChannel- Specified by:
readin classFileChannel- Throws:
IOException
-
read
public int read(ByteBuffer dst, long position) throws IOException
- Specified by:
readin classFileChannel- Throws:
IOException
-
read
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
- Specified by:
readin interfaceScatteringByteChannel- Specified by:
readin classFileChannel- Throws:
IOException
-
doRead
protected long doRead(Collection<? extends ByteBuffer> buffers, long position) throws IOException
- Throws:
IOException
-
write
public int write(ByteBuffer src) throws IOException
- Specified by:
writein interfaceSeekableByteChannel- Specified by:
writein interfaceWritableByteChannel- Specified by:
writein classFileChannel- Throws:
IOException
-
write
public int write(ByteBuffer src, long position) throws IOException
- Specified by:
writein classFileChannel- Throws:
IOException
-
write
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
- Specified by:
writein interfaceGatheringByteChannel- Specified by:
writein classFileChannel- Throws:
IOException
-
doWrite
protected long doWrite(Collection<? extends ByteBuffer> buffers, long position) throws IOException
- Throws:
IOException
-
position
public long position() throws IOException- Specified by:
positionin interfaceSeekableByteChannel- Specified by:
positionin classFileChannel- Throws:
IOException
-
position
public FileChannel position(long newPosition) throws IOException
- Specified by:
positionin interfaceSeekableByteChannel- Specified by:
positionin classFileChannel- Throws:
IOException
-
size
public long size() throws IOException- Specified by:
sizein interfaceSeekableByteChannel- Specified by:
sizein classFileChannel- Throws:
IOException
-
truncate
public FileChannel truncate(long size) throws IOException
- Specified by:
truncatein interfaceSeekableByteChannel- Specified by:
truncatein classFileChannel- Throws:
IOException
-
force
public void force(boolean metaData) throws IOException- Specified by:
forcein classFileChannel- Throws:
IOException
-
transferTo
public long transferTo(long position, long count, WritableByteChannel target) throws IOException- Specified by:
transferToin classFileChannel- Throws:
IOException
-
transferFrom
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException
- Specified by:
transferFromin classFileChannel- Throws:
IOException
-
map
public MappedByteBuffer map(FileChannel.MapMode mode, long position, long size) throws IOException
- Specified by:
mapin classFileChannel- Throws:
IOException
-
lock
public FileLock lock(long position, long size, boolean shared) throws IOException
- Specified by:
lockin classFileChannel- Throws:
IOException
-
tryLock
public FileLock tryLock(long position, long size, boolean shared) throws IOException
- Specified by:
tryLockin classFileChannel- Throws:
IOException
-
implCloseChannel
protected void implCloseChannel() throws IOException- Specified by:
implCloseChannelin classAbstractInterruptibleChannel- Throws:
IOException
-
beginBlocking
protected void beginBlocking(Object actionHint)
-
endBlocking
protected void endBlocking(Object actionHint, boolean completed) throws AsynchronousCloseException
- Throws:
AsynchronousCloseException
-
-