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[]bbprotected Bufferbufferprotected intbufferSizeprotected longclientOffsetprotected booleaneofIndicatorprotected longfileSizeprotected SftpClient.CloseableHandlehandleprotected org.slf4j.Loggerlogprotected Deque<SftpAckData>pendingReadsprotected longrequestOffset
-
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 voidclose()protected voidfillData()AbstractSftpClientgetClient()StringgetPath()The remotely accessed file pathprotected booleanhasNoData()booleanisEof()Check if the stream is at EOFbooleanisOpen()protected voidpollBuffer(SftpAckData ack)intread()intread(byte[] b, int off, int len)protected voidsendRequests()longskip(long n)StringtoString()longtransferTo(long max, WritableByteChannel out)longtransferTo(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:
getClientin 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:
trueif all the data has been consumer
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
transferTo
public long transferTo(long max, WritableByteChannel out) throws IOException- Throws:
IOException
-
transferTo
public long transferTo(OutputStream out) throws IOException
- Overrides:
transferToin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-