|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
net.sf.freecol.common.networking.ReceivingThread.FreeColNetworkInputStream
class ReceivingThread.FreeColNetworkInputStream
Input stream for buffering the data from the network.
This is just a buffered input stream that signals end-of-stream when a
given token END_OF_STREAM is encountered. In order to continue
receiving data, the method enable() has to be called. Calls to
close() has no effect, the underlying input stream has to
be closed directly.
| Field Summary | |
|---|---|
private int |
bEnd
|
private int |
bStart
|
private byte[] |
buffer
|
private static int |
BUFFER_SIZE
|
private boolean |
empty
|
private static char |
END_OF_STREAM
|
private java.io.InputStream |
in
|
private boolean |
wait
|
| Constructor Summary | |
|---|---|
ReceivingThread.FreeColNetworkInputStream(java.io.InputStream in)
Creates a new FreeColNetworkInputStream. |
|
| Method Summary | |
|---|---|
(package private) void |
enable()
Prepares the input stream for a new message. |
private boolean |
fill()
Fills the buffer with data. |
int |
read()
Reads a single byte. |
int |
read(byte[] b,
int off,
int len)
Reads from the buffer and returns the data. |
| Methods inherited from class java.io.InputStream |
|---|
available, close, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int BUFFER_SIZE
private static final char END_OF_STREAM
private final java.io.InputStream in
private byte[] buffer
private int bStart
private int bEnd
private boolean empty
private boolean wait
| Constructor Detail |
|---|
ReceivingThread.FreeColNetworkInputStream(java.io.InputStream in)
FreeColNetworkInputStream.
in - The input stream in which this object should get the data
from.| Method Detail |
|---|
private boolean fill()
throws java.io.IOException
java.io.IOException - if thrown by the underlying stream.void enable()
read return the data
instead of -1.
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionread(byte[], int, int)
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamb - The place where the data will be put.off - The offset to use when writing the data to b.len - Number of bytes to read.
-1 if the
message has ended, that is; if the token
END_OF_STREAM is encountered.
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||