public class SftpInputStreamAsync extends org.apache.sshd.common.util.io.input.InputStreamWithChannel implements SftpClientHolder
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
bb |
protected org.apache.sshd.common.util.buffer.Buffer |
buffer |
protected boolean |
bufferAdjusted |
protected int |
bufferSize |
protected long |
clientOffset |
protected boolean |
eofIndicator |
protected long |
fileSize |
protected SftpClient.CloseableHandle |
handle |
protected org.slf4j.Logger |
log |
protected int |
maxReceived |
protected Deque<SftpAckData> |
pendingReads |
protected long |
requestOffset |
protected long |
shortReads |
| Constructor and 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) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
adjustBufferIfNeeded(int currentBufferSize,
long nOfShortReads,
int maxBufferReceived,
long gap)
Dynamically adjust the SFTP buffer size, if it is too large.
|
void |
close() |
protected boolean |
fillData() |
AbstractSftpClient |
getClient() |
String |
getPath()
The remotely accessed file path
|
protected boolean |
hasNoData() |
boolean |
isEof()
Check if the stream is at EOF
|
boolean |
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 len,
WritableByteChannel out) |
long |
transferTo(OutputStream out) |
available, mark, markSupported, read, resetprotected final org.slf4j.Logger log
protected final byte[] bb
protected final long fileSize
protected org.apache.sshd.common.util.buffer.Buffer buffer
protected SftpClient.CloseableHandle handle
protected long requestOffset
protected long clientOffset
protected final Deque<SftpAckData> pendingReads
protected boolean eofIndicator
protected int bufferSize
protected int maxReceived
protected long shortReads
protected boolean bufferAdjusted
public SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, String path, Collection<SftpClient.OpenMode> mode) throws IOException
IOExceptionpublic SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, long clientOffset, long fileSize, String path, SftpClient.CloseableHandle handle)
public final AbstractSftpClient getClient()
getClient in interface SftpClientHolderpublic final String getPath()
public boolean isEof()
true if all the data has been consumerpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic long transferTo(long len,
WritableByteChannel out)
throws IOException
IOExceptionpublic long transferTo(OutputStream out) throws IOException
IOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionprotected boolean hasNoData()
protected void sendRequests()
throws IOException
IOExceptionprotected boolean fillData()
throws IOException
IOExceptionprotected int adjustBufferIfNeeded(int currentBufferSize,
long nOfShortReads,
int maxBufferReceived,
long gap)
currentBufferSize - the current SFTP buffer sizenOfShortReads - the number of short reads so farmaxBufferReceived - the maximum number of bytes the server returned in any previous read requestgap - the size of the gap just filledprotected void pollBuffer(SftpAckData ack) throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class InputStreamIOExceptionCopyright © 2018–2024 The Apache Software Foundation. All rights reserved.