class MessageInputStream
extends java.io.InputStream
I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream
This buffers unlimited data via messageReceived() - limiting / blocking is done in ConnectionPacketHandler.receivePacket().
| コンストラクタ | 説明 |
|---|---|
MessageInputStream(I2PAppContext ctx,
int maxMessageSize,
int maxWindowSize,
int maxBufferSize) |
| 修飾子とタイプ | メソッド | 説明 |
|---|---|---|
int |
available() |
|
boolean |
canAccept(long messageId,
int payloadSize) |
Determine if this packet will fit in our buffering limits.
|
void |
close() |
|
void |
closeReceived() |
There is no more data coming from the I2P side.
|
long |
getHighestBlockId() |
|
long |
getHighestReadyBlockId() |
What is the highest block ID we've completely received through?
|
long[] |
getNacks() |
Retrieve the message IDs that are holes in our sequence - ones
past the highest ready ID and below the highest received message
ID.
|
int |
getReadTimeout() |
how long a read() call should block (if less than 0, block indefinitely,
but if it is 0, do not block at all)
|
int |
getTotalReadySize() |
Same as available() but doesn't throw IOE
|
boolean |
isLocallyClosed() |
|
boolean |
messageReceived(long messageId,
ByteArray payload) |
A new message has arrived - toss it on the appropriate queue (moving
previously pending messages to the ready queue if it fills the gap, etc).
|
void |
notifyActivity() |
|
int |
read() |
On a read timeout, this returns -1
(doesn't throw SocketTimeoutException like Socket)
(doesn't throw InterruptedIOException like our javadocs say)
|
int |
read(byte[] target) |
On a read timeout, this returns 0
(doesn't throw SocketTimeoutException like Socket)
(doesn't throw InterruptedIOException like our javadocs say)
|
int |
read(byte[] target,
int offset,
int length) |
On a read timeout, this returns 0
(doesn't throw SocketTimeoutException like Socket)
(doesn't throw InterruptedIOException like our javadocs say)
|
void |
setReadTimeout(int timeout) |
how long a read() call should block (if less than 0, block indefinitely,
but if it is 0, do not block at all)
|
(package private) void |
streamErrorOccurred(java.io.IOException ioe) |
Stream b0rked, die with the given error
|
void |
updateAcks(PacketLocal packet) |
Adds the ack-through and nack fields to a packet we are building for transmission
|
public MessageInputStream(I2PAppContext ctx, int maxMessageSize, int maxWindowSize, int maxBufferSize)
public long getHighestReadyBlockId()
public long getHighestBlockId()
public boolean isLocallyClosed()
public boolean canAccept(long messageId,
int payloadSize)
public long[] getNacks()
public void updateAcks(PacketLocal packet)
public int getReadTimeout()
public void setReadTimeout(int timeout)
timeout - how long read calls should block, 0 for nonblocking, negative to indefinitely blockpublic void closeReceived()
public void notifyActivity()
public boolean messageReceived(long messageId,
ByteArray payload)
messageId - ID of the messagepayload - message payload, may be null or have null or zero-length datapublic int read()
throws java.io.IOException
read クラス内 java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] target)
throws java.io.IOException
read クラス内 java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] target,
int offset,
int length)
throws java.io.IOException
read クラス内 java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available クラス内 java.io.InputStreamjava.io.IOExceptionpublic int getTotalReadySize()
public void close()
close クラス内 java.io.InputStreamvoid streamErrorOccurred(java.io.IOException ioe)