Package org.apache.sshd.sftp.client.impl
Class SftpInputStreamAsync
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.sshd.common.util.io.InputStreamWithChannel
-
- org.apache.sshd.sftp.client.impl.SftpInputStreamAsync
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,SftpClientHolder
public class SftpInputStreamAsync extends InputStreamWithChannel implements SftpClientHolder
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
bb
protected Buffer
buffer
protected int
bufferSize
protected long
clientOffset
protected boolean
eofIndicator
protected long
fileSize
protected SftpClient.CloseableHandle
handle
protected org.slf4j.Logger
log
protected Deque<SftpAckData>
pendingReads
protected long
requestOffset
-
Constructor Summary
Constructors Constructor Description SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, long clientOffset, long fileSize, String path, SftpClient.CloseableHandle handle)
SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, String path, Collection<SftpClient.OpenMode> mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
fillData()
AbstractSftpClient
getClient()
String
getPath()
The remotely accessed file pathprotected boolean
hasNoData()
boolean
isEof()
Check if the stream is at EOFboolean
isOpen()
protected void
pollBuffer(SftpAckData ack)
int
read()
int
read(byte[] b, int off, int len)
protected void
sendRequests()
long
skip(long n)
String
toString()
long
transferTo(long max, WritableByteChannel out)
long
transferTo(OutputStream out)
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset
-
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
bb
protected final byte[] bb
-
bufferSize
protected final int bufferSize
-
fileSize
protected final long fileSize
-
buffer
protected Buffer buffer
-
handle
protected SftpClient.CloseableHandle handle
-
requestOffset
protected long requestOffset
-
clientOffset
protected long clientOffset
-
pendingReads
protected final Deque<SftpAckData> pendingReads
-
eofIndicator
protected boolean eofIndicator
-
-
Constructor Detail
-
SftpInputStreamAsync
public SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, String path, Collection<SftpClient.OpenMode> mode) throws IOException
- Throws:
IOException
-
SftpInputStreamAsync
public SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, long clientOffset, long fileSize, String path, SftpClient.CloseableHandle handle)
-
-
Method Detail
-
getClient
public final AbstractSftpClient getClient()
- Specified by:
getClient
in interfaceSftpClientHolder
-
getPath
public final String getPath()
The remotely accessed file path- Returns:
- Remote file path
-
isEof
public boolean isEof()
Check if the stream is at EOF- Returns:
true
if all the data has been consumer
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
transferTo
public long transferTo(long max, WritableByteChannel out) throws IOException
- Throws:
IOException
-
transferTo
public long transferTo(OutputStream out) throws IOException
- Overrides:
transferTo
in classInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
hasNoData
protected boolean hasNoData()
-
sendRequests
protected void sendRequests() throws IOException
- Throws:
IOException
-
fillData
protected void fillData() throws IOException
- Throws:
IOException
-
pollBuffer
protected void pollBuffer(SftpAckData ack) throws IOException
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
-