public class WriteSession
extends java.lang.Object
Output for easier serialization
code for streaming or full buffering.
This is used when objects need to be serialzied/written into a LinkedBuffer.| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
WriteSession(LinkedBuffer head) |
WriteSession(LinkedBuffer head,
int nextBufferSize) |
WriteSession(LinkedBuffer head,
java.io.OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
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).
|
public final LinkedBuffer head
protected LinkedBuffer tail
protected int size
public final int nextBufferSize
public final java.io.OutputStream out
public final WriteSink sink
public WriteSession(LinkedBuffer head)
public WriteSession(LinkedBuffer head, int nextBufferSize)
public WriteSession(LinkedBuffer head, java.io.OutputStream out)
public WriteSession clear()
public final int getSize()
public final byte[] toByteArray()
Copyright © 2009-2016. All Rights Reserved.