public class FSTObjectOutput extends Object implements ObjectOutput
| Modifier and Type | Field and Description |
|---|---|
protected FSTEncoder |
codec |
protected FSTConfiguration |
conf |
protected int |
curDepth |
protected FSTObjectRegistry |
objects |
protected int |
writeExternalWriteAhead |
| 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 |
|---|---|
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. empty impl, you need to subclass to make use of this hook
|
protected void |
objectWillBeWritten(Object obj,
int streamPosition)
hook for debugging profiling. empty impl, you need to subclass to make use of this hook
|
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.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected void |
writeArray(FSTClazzInfo.FSTFieldInfo referencee,
Object array) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeClassTag(Class aClass) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeObject(Object obj) |
void |
writeObject(Object obj,
Class... possibles) |
protected void |
writeObjectCompatible(FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite,
FSTClazzInfo serializationInfo) |
protected boolean |
writeObjectHeader(FSTClazzInfo clsInfo,
FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite) |
void |
writeObjectInternal(Object obj,
Class... possibles) |
protected void |
writeObjectWithContext(FSTClazzInfo.FSTFieldInfo referencee,
Object toWrite) |
void |
writeShort(int v) |
void |
writeStringUTF(String str) |
void |
writeUTF(String s) |
protected FSTEncoder codec
protected FSTConfiguration conf
protected FSTObjectRegistry objects
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 ObjectOutputIOException - if an I/O error occurs.FilterOutputStream.out,
OutputStream.flush()public void close()
throws IOException
close in interface ObjectOutputclose in interface AutoCloseableIOExceptionpublic 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 write(int b)
throws IOException
write in interface DataOutputwrite in interface ObjectOutputIOExceptionpublic void write(byte[] b)
throws IOException
write in interface DataOutputwrite in interface ObjectOutputIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputwrite in interface ObjectOutputIOExceptionpublic void writeBoolean(boolean v)
throws IOException
writeBoolean in interface DataOutputIOExceptionpublic void writeByte(int v)
throws IOException
writeByte in interface DataOutputIOExceptionpublic void writeShort(int v)
throws IOException
writeShort in interface DataOutputIOExceptionpublic void writeChar(int v)
throws IOException
writeChar in interface DataOutputIOExceptionpublic void writeInt(int v)
throws IOException
writeInt in interface DataOutputIOExceptionpublic void writeLong(long v)
throws IOException
writeLong in interface DataOutputIOExceptionpublic void writeFloat(float v)
throws IOException
writeFloat in interface DataOutputIOExceptionpublic void writeDouble(double v)
throws IOException
writeDouble in interface DataOutputIOExceptionpublic void writeBytes(String s) throws IOException
writeBytes in interface DataOutputIOExceptionpublic void writeChars(String s) throws IOException
writeChars in interface DataOutputIOExceptionpublic void writeUTF(String s) throws IOException
writeUTF in interface DataOutputIOExceptionpublic 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 boolean writeObjectHeader(FSTClazzInfo clsInfo, FSTClazzInfo.FSTFieldInfo referencee, Object toWrite) throws IOException
clsInfo - referencee - toWrite - IOExceptionprotected void writeArray(FSTClazzInfo.FSTFieldInfo referencee, Object array) throws IOException
IOExceptionpublic void writeStringUTF(String str) 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()
public void writeClassTag(Class aClass)
Copyright © 2014. All rights reserved.