public class EncodingContext extends AbstractEncodingContext
| Modifier and Type | Field and Description |
|---|---|
protected int |
bitfieldpos
The current bitfield position in the buffer
|
protected byte |
bitpos
The current bit position within the bitfield
|
protected GrowableByteBuffer |
buffer
The binary output
|
protected java.util.Map<java.lang.Class<?>,java.lang.Integer> |
classidcache
Cache for class IDs.
|
protected java.util.Map<java.lang.Class<?>,java.lang.String> |
classnamecache
Cache for class names.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
classnamepool
The class name pool.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
pkgpool
The package fragment pool.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
stringpool
The string pool.
|
classloader, ignorewriteclass, nonanonclasscache, preprocessors, rootobject, usercontext, writtenbytes| Constructor and Description |
|---|
EncodingContext(java.lang.Object rootobject,
java.lang.Object usercontext,
java.util.List<ITraverseProcessor> preprocessors,
java.lang.ClassLoader classloader)
Creates an encoding context.
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
getByteBuffer(int length)
Reserves a byte buffer on the stream.
|
byte[] |
getBytes()
Returns the encoded bytes.
|
void |
write(byte[] b)
Writes a byte array, appending it to the buffer.
|
void |
writeBoolean(boolean bool)
Writes a boolean value.
|
void |
writeByte(byte b)
Writes a byte.
|
void |
writeClass(java.lang.Class<?> clazz)
Writes a class to the context.
|
int |
writeClassname(java.lang.String name)
Writes the name of a class.
|
void |
writeSignedVarInt(long value)
Writes a signed variable integer to the encoding context.
|
void |
writeString(java.lang.String string)
Writes a string to the context.
|
void |
writeVarInt(long value)
Writes a variable integer to the encoding context.
|
getClassLoader, getNonInnerClassCache, getPreprocessors, getRootObject, getUserContext, getWrittenBytes, isIgnoreNextClassWrite, setIgnoreNextClassWriteprotected java.util.Map<java.lang.Class<?>,java.lang.String> classnamecache
protected GrowableByteBuffer buffer
protected java.util.Map<java.lang.String,java.lang.Integer> stringpool
protected java.util.Map<java.lang.Class<?>,java.lang.Integer> classidcache
protected java.util.Map<java.lang.String,java.lang.Integer> classnamepool
protected java.util.Map<java.lang.String,java.lang.Integer> pkgpool
protected byte bitpos
protected int bitfieldpos
public EncodingContext(java.lang.Object rootobject,
java.lang.Object usercontext,
java.util.List<ITraverseProcessor> preprocessors,
java.lang.ClassLoader classloader)
usercontext - A user context.preprocessors - The preprocessors.classloader - The classloader.public byte[] getBytes()
public void writeByte(byte b)
b - The byte.public void write(byte[] b)
b - The byte array.public java.nio.ByteBuffer getByteBuffer(int length)
public void writeBoolean(boolean bool)
IEncodingContextbool - public void writeClass(java.lang.Class<?> clazz)
IEncodingContextclazz - public int writeClassname(java.lang.String name)
IEncodingContextname - The name of the class.public void writeString(java.lang.String string)
IEncodingContextstring - public void writeVarInt(long value)
IEncodingContextvalue - public void writeSignedVarInt(long value)
IEncodingContextvalue -