class MessageOutputStream extends OutputStream
MessageOutputStream -> ConnectionDataReceiver -> Connection -> PacketQueue -> I2PSession
| Modifier and Type | Class and Description |
|---|---|
static interface |
MessageOutputStream.DataReceiver
Define a component to receive data flushed from this stream
|
static interface |
MessageOutputStream.WriteStatus
Define a way to detect the status of a write
|
| Constructor and Description |
|---|
MessageOutputStream(I2PAppContext ctx,
SimpleTimer2 timer,
MessageOutputStream.DataReceiver receiver,
int bufSize) |
MessageOutputStream(I2PAppContext ctx,
SimpleTimer2 timer,
MessageOutputStream.DataReceiver receiver,
int bufSize,
int passiveFlushDelay) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This does a flush, and BLOCKS until
the CLOSE packet is acked.
|
void |
closeInternal()
nonblocking close -
Only for use inside package
|
(package private) void |
destroy() |
void |
flush()
Flush the data already queued up, blocking only if the outbound
window is full.
|
(package private) void |
flushAvailable(MessageOutputStream.DataReceiver target)
called whenever the engine wants to push more data to the
peer
|
(package private) void |
flushAvailable(MessageOutputStream.DataReceiver target,
boolean blocking) |
boolean |
getClosed() |
int |
getWriteTimeout() |
void |
setBufferSize(int size)
Caller should enforce a sane minimum.
|
void |
setWriteTimeout(int ms) |
(package private) void |
streamErrorOccurred(IOException ioe) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public MessageOutputStream(I2PAppContext ctx, SimpleTimer2 timer, MessageOutputStream.DataReceiver receiver, int bufSize)
public MessageOutputStream(I2PAppContext ctx, SimpleTimer2 timer, MessageOutputStream.DataReceiver receiver, int bufSize, int passiveFlushDelay)
public void setWriteTimeout(int ms)
public int getWriteTimeout()
public void setBufferSize(int size)
size - must be greater than 0, and smaller than or equal to bufSize in constructorpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOException - if the write failspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void closeInternal()
public boolean getClosed()
void streamErrorOccurred(IOException ioe)
void flushAvailable(MessageOutputStream.DataReceiver target) throws IOException
IOExceptionvoid flushAvailable(MessageOutputStream.DataReceiver target, boolean blocking) throws IOException
IOExceptionvoid destroy()