Class SftpRemotePathChannel
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- java.nio.channels.FileChannel
-
- org.apache.sshd.client.subsystem.sftp.SftpRemotePathChannel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,GatheringByteChannel
,InterruptibleChannel
,ReadableByteChannel
,ScatteringByteChannel
,SeekableByteChannel
,WritableByteChannel
- Direct Known Subclasses:
SftpFileSystemChannel
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 static String
COPY_BUFSIZE_PROP
static int
DEFAULT_TRANSFER_BUFFER_SIZE
static Set<SftpClient.OpenMode>
READ_MODES
static 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 long
doRead(List<ByteBuffer> buffers, long position)
protected long
doWrite(List<ByteBuffer> buffers, long position)
void
force(boolean metaData)
String
getRemotePath()
protected void
implCloseChannel()
FileLock
lock(long position, long size, boolean shared)
MappedByteBuffer
map(FileChannel.MapMode mode, long position, long size)
long
position()
FileChannel
position(long newPosition)
int
read(ByteBuffer dst)
long
read(ByteBuffer[] dsts, int offset, int length)
int
read(ByteBuffer dst, long position)
long
size()
String
toString()
long
transferFrom(ReadableByteChannel src, long position, long count)
long
transferTo(long position, long count, WritableByteChannel target)
FileChannel
truncate(long size)
FileLock
tryLock(long position, long size, boolean shared)
int
write(ByteBuffer src)
long
write(ByteBuffer[] srcs, int offset, int length)
int
write(ByteBuffer src, long position)
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Field Detail
-
COPY_BUFSIZE_PROP
public static final String COPY_BUFSIZE_PROP
- See Also:
- Constant Field Values
-
DEFAULT_TRANSFER_BUFFER_SIZE
public static final int DEFAULT_TRANSFER_BUFFER_SIZE
- See Also:
- Constant Field Values
-
READ_MODES
public static final Set<SftpClient.OpenMode> READ_MODES
-
WRITE_MODES
public static final Set<SftpClient.OpenMode> WRITE_MODES
-
-
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:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Specified by:
read
in classFileChannel
- Throws:
IOException
-
read
public int read(ByteBuffer dst, long position) throws IOException
- Specified by:
read
in classFileChannel
- Throws:
IOException
-
read
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
- Specified by:
read
in interfaceScatteringByteChannel
- Specified by:
read
in classFileChannel
- Throws:
IOException
-
doRead
protected long doRead(List<ByteBuffer> buffers, long position) throws IOException
- Throws:
IOException
-
write
public int write(ByteBuffer src) throws IOException
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Specified by:
write
in classFileChannel
- Throws:
IOException
-
write
public int write(ByteBuffer src, long position) throws IOException
- Specified by:
write
in classFileChannel
- Throws:
IOException
-
write
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
- Specified by:
write
in interfaceGatheringByteChannel
- Specified by:
write
in classFileChannel
- Throws:
IOException
-
doWrite
protected long doWrite(List<ByteBuffer> buffers, long position) throws IOException
- Throws:
IOException
-
position
public long position() throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Specified by:
position
in classFileChannel
- Throws:
IOException
-
position
public FileChannel position(long newPosition) throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Specified by:
position
in classFileChannel
- Throws:
IOException
-
size
public long size() throws IOException
- Specified by:
size
in interfaceSeekableByteChannel
- Specified by:
size
in classFileChannel
- Throws:
IOException
-
truncate
public FileChannel truncate(long size) throws IOException
- Specified by:
truncate
in interfaceSeekableByteChannel
- Specified by:
truncate
in classFileChannel
- Throws:
IOException
-
force
public void force(boolean metaData) throws IOException
- Specified by:
force
in classFileChannel
- Throws:
IOException
-
transferTo
public long transferTo(long position, long count, WritableByteChannel target) throws IOException
- Specified by:
transferTo
in classFileChannel
- Throws:
IOException
-
transferFrom
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException
- Specified by:
transferFrom
in classFileChannel
- Throws:
IOException
-
map
public MappedByteBuffer map(FileChannel.MapMode mode, long position, long size) throws IOException
- Specified by:
map
in classFileChannel
- Throws:
IOException
-
lock
public FileLock lock(long position, long size, boolean shared) throws IOException
- Specified by:
lock
in classFileChannel
- Throws:
IOException
-
tryLock
public FileLock tryLock(long position, long size, boolean shared) throws IOException
- Specified by:
tryLock
in classFileChannel
- Throws:
IOException
-
implCloseChannel
protected void implCloseChannel() throws IOException
- Specified by:
implCloseChannel
in classAbstractInterruptibleChannel
- Throws:
IOException
-
-