|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.dyuproject.protostuff.WriteSession
public class WriteSession
Designed to be subclassed by implementations of Output for easier serialization
code for streaming or full buffering.
This is used when objects need to be serialzied/written into a LinkedBuffer.
| Field Summary | |
|---|---|
LinkedBuffer |
head
The main/root/head buffer of this write session. |
int |
nextBufferSize
The next buffer size used when growing the buffer. |
java.io.OutputStream |
out
The sink of this buffer. |
WriteSink |
sink
The sink of this write session. |
protected int |
size
The actual number of bytes written to the buffer. |
protected LinkedBuffer |
tail
The last buffer of this write session (This points to head if growing not needed). |
| Constructor Summary | |
|---|---|
WriteSession(LinkedBuffer head)
|
|
WriteSession(LinkedBuffer head,
int nextBufferSize)
|
|
WriteSession(LinkedBuffer head,
java.io.OutputStream out)
|
|
| Method Summary | |
|---|---|
WriteSession |
clear()
The buffer will be cleared (tail will point to the head) and the size will be reset to zero. |
int |
getSize()
Returns the amount of bytes written in this session. |
byte[] |
toByteArray()
Returns a single byte array containg all the contents written to the buffer(s). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final LinkedBuffer head
protected LinkedBuffer tail
protected int size
public final int nextBufferSize
public final java.io.OutputStream out
public final WriteSink sink
| Constructor Detail |
|---|
public WriteSession(LinkedBuffer head)
public WriteSession(LinkedBuffer head,
int nextBufferSize)
public WriteSession(LinkedBuffer head,
java.io.OutputStream out)
| Method Detail |
|---|
public WriteSession clear()
public final int getSize()
public final byte[] toByteArray()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||