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:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
public class SftpInputStreamAsync extends InputStreamWithChannel
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
bb
protected Buffer
buffer
protected int
bufferSize
private AbstractSftpClient
clientInstance
protected long
clientOffset
protected boolean
eofIndicator
protected long
fileSize
protected SftpClient.CloseableHandle
handle
protected org.slf4j.Logger
log
private java.lang.String
path
protected java.util.Deque<SftpAckData>
pendingReads
protected long
requestOffset
-
Constructor Summary
Constructors Constructor Description SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, long clientOffset, long fileSize, java.lang.String path, SftpClient.CloseableHandle handle)
SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, java.lang.String path, java.util.Collection<SftpClient.OpenMode> mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
fillData()
AbstractSftpClient
getClient()
The client instancejava.lang.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)
java.lang.String
toString()
long
transferTo(long max, java.nio.channels.WritableByteChannel out)
long
transferTo(java.io.OutputStream out)
-
-
-
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 java.util.Deque<SftpAckData> pendingReads
-
eofIndicator
protected boolean eofIndicator
-
clientInstance
private final AbstractSftpClient clientInstance
-
path
private final java.lang.String path
-
-
Constructor Detail
-
SftpInputStreamAsync
public SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, java.lang.String path, java.util.Collection<SftpClient.OpenMode> mode) throws java.io.IOException
- Throws:
java.io.IOException
-
SftpInputStreamAsync
public SftpInputStreamAsync(AbstractSftpClient client, int bufferSize, long clientOffset, long fileSize, java.lang.String path, SftpClient.CloseableHandle handle)
-
-
Method Detail
-
getClient
public final AbstractSftpClient getClient()
The client instance- Returns:
SftpClient
instance used to access the remote file
-
getPath
public final java.lang.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
-
isOpen
public boolean isOpen()
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
transferTo
public long transferTo(long max, java.nio.channels.WritableByteChannel out) throws java.io.IOException
- Throws:
java.io.IOException
-
transferTo
public long transferTo(java.io.OutputStream out) throws java.io.IOException
- Overrides:
transferTo
in classjava.io.InputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
hasNoData
protected boolean hasNoData()
-
sendRequests
protected void sendRequests() throws java.io.IOException
- Throws:
java.io.IOException
-
fillData
protected void fillData() throws java.io.IOException
- Throws:
java.io.IOException
-
pollBuffer
protected void pollBuffer(SftpAckData ack) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.nio.channels.Channel
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-