public class FSTObjectOutput extends DataOutputStream implements ObjectOutput
| Modifier and Type | Field and Description |
|---|---|
protected FSTOutputStream |
buffout |
FSTClazzNameRegistry |
clnames |
protected FSTConfiguration |
conf |
protected int |
curDepth |
protected FSTObjectRegistry |
objects |
protected int |
writeExternalWriteAhead |
writtenout| Constructor and Description |
|---|
FSTObjectOutput()
serialize without an underlying stream, the resulting byte array of writing to
this FSTObjectOutput can be accessed using getBuffer(), the size using getWritten().
|
FSTObjectOutput(FSTConfiguration conf)
serialize without an underlying stream, the resulting byte array of writing to
this FSTObjectOutput can be accessed using getBuffer(), the size using getWritten().
|
FSTObjectOutput(OutputStream out)
Creates a new FSTObjectOutput stream to write data to the specified
underlying output stream.
|
FSTObjectOutput(OutputStream out,
FSTConfiguration conf)
Creates a new FSTObjectOutput stream to write data to the specified
underlying output stream.
|
| Modifier and Type | Method and Description |
|---|---|
static Class[] |
addToPredictionArray(Class[] possibleClasses,
Class aClass) |
void |
close() |
void |
defaultWriteObject(Object toWrite,
FSTClazzInfo serializationInfo) |
void |
ensureFree(int bytes) |
void |
flush()
Flushes this data output stream.
|
byte[] |
getBuffer() |
FSTClazzInfoRegistry |
getClassInfoRegistry() |
FSTConfiguration |
getConf() |
byte[] |
getCopyOfWrittenBuffer() |
protected FSTClazzInfo |
getFstClazzInfo(FSTClazzInfo.FSTFieldInfo referencee,
Class clazz)
if class is same as last referenced, returned cached clzinfo, else do a lookup
|
FSTObjectRegistry |
getObjectMap() |
ObjectOutputStream |
getObjectOutputStream(Class cl,
FSTClazzInfo clinfo,
FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite) |
int |
getWriteExternalWriteAhead()
since the stock writeXX methods on InputStream are final, i can't ensure sufficient bufferSize on the output buffer
before calling writeExternal.
|
int |
getWritten() |
protected void |
objectHasBeenWritten(Object obj,
int oldStreamPosition,
int streamPosition)
hook for debugging profiling.
|
protected void |
objectWillBeWritten(Object obj,
int streamPosition)
hook for debugging profiling.
|
void |
resetForReUse()
reset keeping the last used byte[] buffer
|
void |
resetForReUse(byte[] out) |
void |
resetForReUse(OutputStream out)
if out == null => automatically create/reuse a bytebuffer
|
void |
setWriteExternalWriteAhead(int writeExternalWriteAhead)
since the stock writeXX methods on InputStream are final, i can't ensure sufficient bufferSize on the output buffer
before calling writeExternal.
|
protected void |
writeArray(FSTClazzInfo.FSTFieldInfo referencee,
Object array) |
void |
writeCChar(char c) |
void |
writeCCharArr(char[] arr) |
void |
writeCDouble(double value) |
void |
writeCFloat(float value)
Writes a 4 byte float.
|
void |
writeCInt(int anInt) |
void |
writeCIntArr(int[] v) |
void |
writeClass(Class cl) |
void |
writeClass(FSTClazzInfo clInf) |
void |
writeClass(Object toWrite) |
void |
writeCLong(long anInt) |
void |
writeCShort(short c) |
void |
writeFBooleanArr(boolean[] array) |
void |
writeFByte(int v) |
void |
writeFByteArr(byte[] array) |
void |
writeFByteArr(byte[] array,
int start,
int length)
does not write length, just plain bytes
|
void |
writeFChar(int v) |
void |
writeFDouble(double value) |
void |
writeFDoubleArr(double[] array) |
void |
writeFFloat(float value)
Writes a 4 byte float.
|
void |
writeFFloatArr(float[] array) |
void |
writeFInt(int v) |
void |
writeFIntArr(int[] v) |
void |
writeFIntThin(int[] v) |
void |
writeFLong(long v) |
void |
writeFLongArr(long[] array) |
void |
writeFShort(int v) |
void |
writeFShortArr(short[] array) |
void |
writeIntArrCompressed(int[] v) |
void |
writeObject(Object obj) |
void |
writeObject(Object obj,
Class... possibles) |
protected void |
writeObjectCompatible(FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite,
FSTClazzInfo serializationInfo) |
protected void |
writeObjectHeader(FSTClazzInfo clsInfo,
FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite) |
void |
writeObjectInternal(Object obj,
Class... possibles) |
protected void |
writeObjectWithContext(FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite) |
int |
writeStringCompressed(String str) |
void |
writeStringUTF(String str) |
size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFwriteclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrite, write, writewriteBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFpublic FSTClazzNameRegistry clnames
protected FSTConfiguration conf
protected FSTObjectRegistry objects
protected FSTOutputStream buffout
protected int curDepth
protected int writeExternalWriteAhead
public FSTObjectOutput(OutputStream out)
public FSTObjectOutput(OutputStream out, FSTConfiguration conf)
written is
set to zero.
Don't create a FSTConfiguration with each stream, just create one global static configuration and reuse it.
FSTConfiguration is threadsafe.out - the underlying output stream, to be saved for later
use.public FSTObjectOutput(FSTConfiguration conf)
conf - IOExceptionpublic FSTObjectOutput()
IOExceptionpublic void flush()
throws IOException
flush method of DataOutputStream
calls the flush method of its underlying output stream.flush in interface Flushableflush in interface ObjectOutputflush in class DataOutputStreamIOException - if an I/O error occurs.FilterOutputStream.out,
OutputStream.flush()public void close()
throws IOException
close in interface Closeableclose in interface ObjectOutputclose in interface AutoCloseableclose in class FilterOutputStreamIOExceptionpublic int getWriteExternalWriteAhead()
public void setWriteExternalWriteAhead(int writeExternalWriteAhead)
writeExternalWriteAhead - public void ensureFree(int bytes)
throws IOException
IOExceptionpublic void writeObject(Object obj) throws IOException
writeObject in interface ObjectOutputIOExceptionpublic void writeObject(Object obj, Class... possibles) throws IOException
IOExceptionpublic void writeObjectInternal(Object obj, Class... possibles) throws IOException
IOExceptionprotected void objectWillBeWritten(Object obj, int streamPosition)
obj - streamPosition - protected void objectHasBeenWritten(Object obj, int oldStreamPosition, int streamPosition)
obj - oldStreamPosition - streamPosition - protected void writeObjectWithContext(FSTClazzInfo.FSTFieldInfo referencee, Object toWrite) throws IOException
IOExceptionprotected FSTClazzInfo getFstClazzInfo(FSTClazzInfo.FSTFieldInfo referencee, Class clazz)
public void defaultWriteObject(Object toWrite, FSTClazzInfo serializationInfo) throws IOException
IOExceptionprotected void writeObjectCompatible(FSTClazzInfo.FSTFieldInfo referencee, Object toWrite, FSTClazzInfo serializationInfo) throws IOException
IOExceptionprotected void writeObjectHeader(FSTClazzInfo clsInfo, FSTClazzInfo.FSTFieldInfo referencee, Object toWrite) throws IOException
IOExceptionprotected void writeArray(FSTClazzInfo.FSTFieldInfo referencee, Object array) throws IOException
IOExceptionpublic void writeFBooleanArr(boolean[] array)
throws IOException
IOExceptionpublic void writeFLongArr(long[] array)
throws IOException
IOExceptionpublic void writeFFloatArr(float[] array)
throws IOException
IOExceptionpublic void writeFDoubleArr(double[] array)
throws IOException
IOExceptionpublic void writeFShortArr(short[] array)
throws IOException
IOExceptionpublic void writeCCharArr(char[] arr)
throws IOException
IOExceptionpublic void writeFByteArr(byte[] array)
throws IOException
IOExceptionpublic void writeFByteArr(byte[] array,
int start,
int length)
throws IOException
array - length - IOExceptionpublic int writeStringCompressed(String str) throws IOException
IOExceptionpublic void writeStringUTF(String str) throws IOException
IOExceptionpublic final void writeClass(Class cl) throws IOException
IOExceptionpublic final void writeClass(FSTClazzInfo clInf) throws IOException
IOExceptionpublic final void writeClass(Object toWrite) throws IOException
IOExceptionpublic static Class[] addToPredictionArray(Class[] possibleClasses, Class aClass)
public void writeCShort(short c)
throws IOException
IOExceptionpublic void writeCChar(char c)
throws IOException
IOExceptionpublic void writeFChar(int v)
throws IOException
IOExceptionpublic void writeFShort(int v)
throws IOException
IOExceptionpublic final void writeFByte(int v)
throws IOException
IOExceptionpublic void writeFInt(int v)
throws IOException
IOExceptionpublic void writeFLong(long v)
throws IOException
IOExceptionpublic void writeFIntThin(int[] v)
throws IOException
IOExceptionpublic void writeIntArrCompressed(int[] v)
throws IOException
IOExceptionpublic void writeFIntArr(int[] v)
throws IOException
IOExceptionpublic void writeCIntArr(int[] v)
throws IOException
IOExceptionpublic void writeCInt(int anInt)
throws IOException
IOExceptionpublic void writeCFloat(float value)
throws IOException
IOExceptionpublic void writeFFloat(float value)
throws IOException
IOExceptionpublic void writeCDouble(double value)
throws IOException
IOExceptionpublic void writeFDouble(double value)
throws IOException
IOExceptionpublic void writeCLong(long anInt)
throws IOException
IOExceptionpublic void resetForReUse(OutputStream out)
out - public void resetForReUse()
public void resetForReUse(byte[] out)
public FSTClazzInfoRegistry getClassInfoRegistry()
public ObjectOutputStream getObjectOutputStream(Class cl, FSTClazzInfo clinfo, FSTClazzInfo.FSTFieldInfo referencee, Object toWrite) throws IOException
cl - - class or superclass of currently serialized obj, write declared fields of this class onlyclinfo - referencee - toWrite - IOExceptionpublic FSTObjectRegistry getObjectMap()
public byte[] getBuffer()
public byte[] getCopyOfWrittenBuffer()
public FSTConfiguration getConf()
public int getWritten()
Copyright © 2014. All rights reserved.