Package com.caucho.hessian.io
Class AbstractHessianOutput
java.lang.Object
com.caucho.hessian.io.AbstractHessianOutput
- Direct Known Subclasses:
AbstractBurlapOutput,Hessian2Output,HessianOutput
Abstract output stream for Hessian requests.
OutputStream os = ...; // from http connection
AbstractOutput out = new HessianSerializerOutput(os);
String value;
out.startCall("hello"); // start hello call
out.writeString("arg1"); // write a string argument
out.completeCall(); // complete the call
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanAdds an object to the reference list.voidWrites a complete method call.voidclose()abstract voidCompletes the method call:voidprotected final SerializerFactoryGets the serializer factory.voidflush()abstract intGets the serializer factory.voidinit(OutputStream os) Initialize the output with a new underlying stream.booleanRemoves a reference.abstract booleanreplaceRef(Object oldRef, Object newRef) Replaces a reference from one object to another.voidResets the references for streaming.voidsetSerializerFactory(SerializerFactory factory) Sets the serializer factory.booleansetUnshared(boolean isUnshared) abstract voidStarts the method call:abstract voidStarts the method call:voidabstract voidwriteBoolean(boolean value) Writes a boolean value to the stream.abstract voidwriteByteBufferEnd(byte[] buffer, int offset, int length) Writes the last chunk of a byte buffer to the stream.abstract voidwriteByteBufferPart(byte[] buffer, int offset, int length) Writes a byte buffer to the stream.abstract voidWrites a byte buffer to the stream.abstract voidwriteBytes(byte[] buffer) Writes a byte array to the stream.abstract voidwriteBytes(byte[] buffer, int offset, int length) Writes a byte array to the stream.voidWrites a full output stream.voidwriteClassFieldLength(int len) Writes the end of the class.abstract voidwriteDouble(double value) Writes a double value to the stream.voidwriteFault(String code, String message, Object detail) voidwriteHeader(String name) Deprecated.abstract voidwriteInt(int value) Writes an integer value to the stream.abstract booleanwriteListBegin(int length, String type) Writes the list header to the stream.abstract voidWrites the tail of the list to the stream.abstract voidwriteLong(long value) Writes a long value to the stream.abstract voidwriteMapBegin(String type) Writes the map header to the stream.abstract voidWrites the tail of the map to the stream.abstract voidwriteMethod(String method) Writes the method tag.abstract voidWrites a null value to the stream.abstract voidwriteObject(Object object) Writes a generic object to the output stream.intwriteObjectBegin(String type) Writes the object header to the stream (for Hessian 2.0), or a Map for Hessian 1.0.voidWrites the tail of the object to the stream.protected abstract voidwriteRef(int value) Writes a reference.voidwriteReply(Object o) abstract voidwriteString(char[] buffer, int offset, int length) Writes a string value to the stream using UTF-8 encoding.abstract voidwriteString(String value) Writes a string value to the stream using UTF-8 encoding.abstract voidwriteUTCDate(long time) Writes a date to the stream.
-
Field Details
-
_serializerFactory
-
-
Constructor Details
-
AbstractHessianOutput
public AbstractHessianOutput()
-
-
Method Details
-
setSerializerFactory
Sets the serializer factory. -
getSerializerFactory
Gets the serializer factory. -
findSerializerFactory
Gets the serializer factory. -
init
Initialize the output with a new underlying stream. -
call
Writes a complete method call.- Throws:
IOException
-
startCall
Starts the method call:C
- Parameters:
method- the method name to call.- Throws:
IOException
-
startCall
Starts the method call:C string int
- Parameters:
method- the method name to call.- Throws:
IOException
-
writeHeader
Deprecated.For Hessian 2.0, use the Header envelope instead- Throws:
IOException
-
writeMethod
Writes the method tag.string
- Parameters:
method- the method name to call.- Throws:
IOException
-
completeCall
Completes the method call:- Throws:
IOException
-
writeBoolean
Writes a boolean value to the stream. The boolean will be written with the following syntax:T F
- Parameters:
value- the boolean value to write.- Throws:
IOException
-
writeInt
Writes an integer value to the stream. The integer will be written with the following syntax:I b32 b24 b16 b8
- Parameters:
value- the integer value to write.- Throws:
IOException
-
writeLong
Writes a long value to the stream. The long will be written with the following syntax:L b64 b56 b48 b40 b32 b24 b16 b8
- Parameters:
value- the long value to write.- Throws:
IOException
-
writeDouble
Writes a double value to the stream. The double will be written with the following syntax:D b64 b56 b48 b40 b32 b24 b16 b8
- Parameters:
value- the double value to write.- Throws:
IOException
-
writeUTCDate
Writes a date to the stream.T b64 b56 b48 b40 b32 b24 b16 b8
- Parameters:
time- the date in milliseconds from the epoch in UTC- Throws:
IOException
-
writeNull
Writes a null value to the stream. The null will be written with the following syntaxN
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeString
Writes a string value to the stream using UTF-8 encoding. The string will be written with the following syntax:If the value is null, it will be written asS b16 b8 string-value
N
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeString
Writes a string value to the stream using UTF-8 encoding. The string will be written with the following syntax:If the value is null, it will be written asS b16 b8 string-value
N
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeBytes
Writes a byte array to the stream. The array will be written with the following syntax:If the value is null, it will be written asB b16 b18 bytes
N
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeBytes
Writes a byte array to the stream. The array will be written with the following syntax:If the value is null, it will be written asB b16 b18 bytes
N
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeByteBufferStart
Writes a byte buffer to the stream.- Throws:
IOException
-
writeByteBufferPart
Writes a byte buffer to the stream.b b16 b18 bytes
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeByteBufferEnd
Writes the last chunk of a byte buffer to the stream.b b16 b18 bytes
- Parameters:
value- the string value to write.- Throws:
IOException
-
writeByteStream
Writes a full output stream.- Throws:
IOException
-
writeRef
Writes a reference.Q int
- Parameters:
value- the integer value to write.- Throws:
IOException
-
removeRef
Removes a reference.- Throws:
IOException
-
replaceRef
Replaces a reference from one object to another.- Throws:
IOException
-
addRef
Adds an object to the reference list. If the object already exists, writes the reference, otherwise, the caller is responsible for the serialization.R b32 b24 b16 b8
- Parameters:
object- the object to add as a reference.- Returns:
- true if the object has already been written.
- Throws:
IOException
-
getRef
- Parameters:
obj-- Returns:
-
resetReferences
public void resetReferences()Resets the references for streaming. -
writeObject
Writes a generic object to the output stream.- Throws:
IOException
-
writeListBegin
Writes the list header to the stream. List writers will callwriteListBeginfollowed by the list contents and then callwriteListEnd.V x13 java.util.ArrayList # type x93 # length=3 x91 # 1 x92 # 2 x93 # 3 </list>
- Throws:
IOException
-
writeListEnd
Writes the tail of the list to the stream.- Throws:
IOException
-
writeMapBegin
Writes the map header to the stream. Map writers will callwriteMapBeginfollowed by the map contents and then callwriteMapEnd.M type (
)* Z - Throws:
IOException
-
writeMapEnd
Writes the tail of the map to the stream.- Throws:
IOException
-
writeObjectBegin
Writes the object header to the stream (for Hessian 2.0), or a Map for Hessian 1.0. Object writers will callwriteObjectBeginfollowed by the map contents and then callwriteObjectEnd.C type int
* C int * - Returns:
- true if the object has already been defined.
- Throws:
IOException
-
writeClassFieldLength
Writes the end of the class.- Throws:
IOException
-
writeObjectEnd
Writes the tail of the object to the stream.- Throws:
IOException
-
writeReply
- Throws:
IOException
-
startReply
- Throws:
IOException
-
completeReply
- Throws:
IOException
-
writeFault
- Throws:
IOException
-
flush
- Throws:
IOException
-
close
- Throws:
IOException
-