Package net.schmizz.sshj.sftp
Class RemoteFile.ReadAheadRemoteFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- net.schmizz.sshj.sftp.RemoteFile.ReadAheadRemoteFileInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Enclosing class:
- RemoteFile
public class RemoteFile.ReadAheadRemoteFileInputStream extends java.io.InputStream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
RemoteFile.ReadAheadRemoteFileInputStream.UnconfirmedRead
-
Field Summary
Fields Modifier and Type Field Description private byte[]
b
private long
currentOffset
private boolean
eof
private int
maxReadLength
private int
maxUnconfirmedReads
private java.io.ByteArrayInputStream
pending
private long
readAheadLimit
private java.util.Deque<RemoteFile.ReadAheadRemoteFileInputStream.UnconfirmedRead>
unconfirmedReads
-
Constructor Summary
Constructors Constructor Description ReadAheadRemoteFileInputStream(int maxUnconfirmedReads)
ReadAheadRemoteFileInputStream(int maxUnconfirmedReads, long fileOffset)
ReadAheadRemoteFileInputStream(int maxUnconfirmedReads, long fileOffset, long readAheadLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
int
read()
int
read(byte[] into, int off, int len)
private boolean
retrieveUnconfirmedRead(boolean blocking)
-
-
-
Field Detail
-
b
private final byte[] b
-
maxUnconfirmedReads
private final int maxUnconfirmedReads
-
readAheadLimit
private final long readAheadLimit
-
unconfirmedReads
private final java.util.Deque<RemoteFile.ReadAheadRemoteFileInputStream.UnconfirmedRead> unconfirmedReads
-
currentOffset
private long currentOffset
-
maxReadLength
private int maxReadLength
-
eof
private boolean eof
-
pending
private java.io.ByteArrayInputStream pending
-
-
Constructor Detail
-
ReadAheadRemoteFileInputStream
public ReadAheadRemoteFileInputStream(int maxUnconfirmedReads)
-
ReadAheadRemoteFileInputStream
public ReadAheadRemoteFileInputStream(int maxUnconfirmedReads, long fileOffset)
- Parameters:
maxUnconfirmedReads
- Maximum number of unconfirmed requests to sendfileOffset
- Initial offset in file to read from
-
ReadAheadRemoteFileInputStream
public ReadAheadRemoteFileInputStream(int maxUnconfirmedReads, long fileOffset, long readAheadLimit)
- Parameters:
maxUnconfirmedReads
- Maximum number of unconfirmed requests to sendfileOffset
- Initial offset in file to read fromreadAheadLimit
- Read ahead is disabled after this limit has been reached
-
-
Method Detail
-
retrieveUnconfirmedRead
private boolean retrieveUnconfirmedRead(boolean blocking) throws java.io.IOException
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] into, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-