org.neo.swarm.util.io
Class PacketInputStream
java.lang.Object
java.io.InputStream
org.neo.swarm.util.io.PacketInputStream
- public class PacketInputStream
- extends java.io.InputStream
Unwraps the contents of a socketchannel using a bytebuffer presents a streaming API.
network packet (chunked).
Note: Alternative implementations of the these streams could be written to handle
different wire protocols such as SOAP or HTTP.
- Author:
- navery
|
Field Summary |
static byte[] |
END_DATA
This is the package footer, 7 bytes |
static byte[] |
START_DATA
This is a package header, 7 bytes |
|
Constructor Summary |
PacketInputStream(ByteBufferInputStream parent)
START_DATA - 7 bytes
SIZE - 4 bytes - size of the data package
DATA - should be as many bytes as the prev SIZE
END_DATA - 7 bytes |
|
Method Summary |
int |
available()
Uses the parent state to determine the correct operation
to calldown onto, once completely read then the available
bytes are returned. |
void |
close()
|
int |
read()
|
int |
read(byte[] userData)
|
| Methods inherited from class java.io.InputStream |
mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
START_DATA
public static final byte[] START_DATA
- This is a package header, 7 bytes
END_DATA
public static final byte[] END_DATA
- This is the package footer, 7 bytes
PacketInputStream
public PacketInputStream(ByteBufferInputStream parent)
- START_DATA - 7 bytes
SIZE - 4 bytes - size of the data package
DATA - should be as many bytes as the prev SIZE
END_DATA - 7 bytes
read
public int read()
throws java.io.IOException
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Uses the parent state to determine the correct operation
to calldown onto, once completely read then the available
bytes are returned.
- Throws:
java.io.IOException
read
public int read(byte[] userData)
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2001-2004 SWARM-ONE -First Generation (S)calable(W)ide(AR)ea(M)esh. All Rights Reserved.