|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
net.jxta.impl.util.pipe.reliable.ReliableOutputStream
public class ReliableOutputStream
Accepts data and packages it into messages for sending to the remote. The messages are kept in a retry queue until the remote peer acknowledges receipt of the message.
Field Summary | |
---|---|
protected List<net.jxta.impl.util.pipe.reliable.ReliableOutputStream.RetrQElt> |
retrQ
The collection of messages available for re-transmission. |
Constructor Summary | |
---|---|
ReliableOutputStream(Outgoing outgoing)
Constructor for the ReliableOutputStream object |
|
ReliableOutputStream(Outgoing outgoing,
FlowControl fc)
Constructor for the ReliableOutputStream object |
Method Summary | |
---|---|
void |
ackReceived(int seqnum,
int[] sackList)
Process an ACK Message. |
void |
close()
|
void |
flush()
|
long |
getLingerDelay()
|
int |
getMaxAck()
Gets the maxAck attribute of the ReliableOutputStream object |
int |
getSeqNumber()
Gets the seqNumber attribute of the ReliableOutputStream object |
void |
hardClose()
We have received a close request from the remote peer. |
boolean |
isClosed()
Returns the state of the stream |
boolean |
isQueueEmpty()
Gets the queueEmpty attribute of the ReliableOutputStream object. |
protected boolean |
isQueueFull()
Gets the queueFull attribute of the ReliableOutputStream object |
void |
recv(Message msg)
process an incoming message |
int |
send(Message msg)
Serialize a JXTA message as a reliable message. |
void |
setLingerDelay(long linger)
|
int |
setSendBufferSize()
Return the size of the buffers we are using for accumulating writes. |
void |
setSendBufferSize(int size)
Set the size of the buffers we will use for accumulating writes. |
boolean |
waitQueueEmpty(long timeout)
Waits for the retransmit queue to become empty. |
void |
waitQueueEvent(long timeout)
wait for activity on the retry queue |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.io.OutputStream |
---|
write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final List<net.jxta.impl.util.pipe.reliable.ReliableOutputStream.RetrQElt> retrQ
Constructor Detail |
---|
public ReliableOutputStream(Outgoing outgoing)
outgoing
- the outgoing objectpublic ReliableOutputStream(Outgoing outgoing, FlowControl fc)
outgoing
- the outgoing objectfc
- flow-controlMethod Detail |
---|
public void close() throws IOException
close
in interface Closeable
close
in class OutputStream
IOException
public long getLingerDelay()
public void setLingerDelay(long linger)
public int setSendBufferSize()
public void setSendBufferSize(int size) throws IOException
size
- The desired size of write buffers.
IOException
- if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.public void hardClose()
public boolean isClosed()
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public int send(Message msg) throws IOException
msg
- message to send
IOException
- if an I/O error occurspublic int getMaxAck()
public int getSeqNumber()
protected boolean isQueueFull()
public boolean isQueueEmpty()
true
if the queue is empty otherwise false
.public boolean waitQueueEmpty(long timeout) throws InterruptedException
timeout
- The relative time in milliseconds to wait for the queue to
become empty.
true
if the queue is empty otherwise false
.
InterruptedException
- if interruptedpublic void waitQueueEvent(long timeout) throws InterruptedException
timeout
- timeout in millis
InterruptedException
- when interruptedpublic void recv(Message msg)
recv
in interface Incoming
msg
- message to processpublic void ackReceived(int seqnum, int[] sackList)
seqnum
- message sequence numbersackList
- array of message sequence numbers
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |