- All Implemented Interfaces:
DataOutput,ObjectOutput,AutoCloseable
FastExternalizable, Externalizable, and Serializable objects.
When multiple objects are being written, this avoids the repetitive writing of classnames and serialVersionUIDs.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidunwrap()Unwraps the object output.static FastObjectOutputwrap(ObjectOutput out) Gets the wrapper for the providedObjectOutput, creating if needed.voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) voidwriteBoolean(boolean v) voidwriteByte(int v) voidwriteBytes(String s) voidwriteChar(int v) voidwriteChars(String s) voidwriteDouble(double v) protected voidWrites aFastExternalizableobject to the provided stream, supportingnullvalues.voidwriteFastUTF(String value) Writes aStringto the output, not writing any duplicates.voidwriteFloat(float v) voidwriteInt(int v) voidwriteLong(long v) voidwriteObject(Object obj) Writes the provided object in the most efficient manner possible, with no object graph tracking (if possible).voidwriteShort(int v) void
-
Method Details
-
wrap
Gets the wrapper for the providedObjectOutput, creating if needed. To avoid memory leaks, it must also beunwrappedin a finally block.TODO: Can
FastObjectOutputitself implementAutoCloseableforunwrap()? Maybe this means it no longer implementsObjectOutputdirectly?- Throws:
IOException
-
unwrap
Unwraps the object output.- Throws:
IllegalStateException- if not wrapped
-
writeObject
Writes the provided object in the most efficient manner possible, with no object graph tracking (if possible). This allows individual objects to switch betweenFastExternalizableand standard serialization without calling code needing to know the difference.If the object is
null, writes a single byte ofNULL.If the object is
FastExternalizable, callswriteFastObject(com.aoapps.lang.io.FastExternalizable).Otherwise, writes
STANDARDand then uses standard Java serialization.- Specified by:
writeObjectin interfaceObjectOutput- Throws:
IOException- See Also:
-
writeFastObject
Writes aFastExternalizableobject to the provided stream, supportingnullvalues.- Throws:
IOException- See Also:
-
writeFastUTF
Writes aStringto the output, not writing any duplicates. Supportsnull.TODO: Any benefit to string prefix compression, like in CompressedDataOutput?
- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
flush
- Specified by:
flushin interfaceObjectOutput- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceObjectOutput- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
