类 AbstractHessianOutput
- java.lang.Object
-
- com.alibaba.com.caucho.hessian.io.AbstractHessianOutput
-
- 直接已知子类:
Hessian2Output,HessianOutput
public abstract class AbstractHessianOutput extends Object
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
-
-
构造器概要
构造器 构造器 说明 AbstractHessianOutput()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 已过时的方法 修饰符和类型 方法 说明 abstract booleanaddRef(Object object)Adds an object to the reference list.voidcall(String method, Object[] args)Writes a complete method call.voidclose()abstract voidcompleteCall()Completes the method call:voidcompleteReply()SerializerFactoryfindSerializerFactory()Gets the serializer factory.voidflush()SerializerFactorygetSerializerFactory()Gets the serializer factory.voidinit(OutputStream os)Initialize the output with a new underlying stream.abstract booleanremoveRef(Object obj)Removes a reference.abstract booleanreplaceRef(Object oldRef, Object newRef)Replaces a reference from one object to another.voidresetReferences()Resets the references for streaming.voidsetSerializerFactory(SerializerFactory factory)Sets the serializer factory.abstract voidstartCall()Starts the method call:abstract voidstartCall(String method, int length)Starts the method call:voidstartReply()abstract 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 voidwriteByteBufferStart()Writes 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.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)已过时。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 voidwriteListEnd()Writes 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 voidwriteMapEnd()Writes the tail of the map to the stream.abstract voidwriteMethod(String method)Writes the method tag.abstract voidwriteNull()Writes 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.voidwriteObjectEnd()Writes the tail of the object to the stream.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.
-
-
-
方法详细资料
-
getSerializerFactory
public SerializerFactory getSerializerFactory()
Gets the serializer factory.
-
setSerializerFactory
public void setSerializerFactory(SerializerFactory factory)
Sets the serializer factory.
-
findSerializerFactory
public final SerializerFactory findSerializerFactory()
Gets the serializer factory.
-
init
public void init(OutputStream os)
Initialize the output with a new underlying stream.
-
call
public void call(String method, Object[] args) throws IOException
Writes a complete method call.- 抛出:
IOException
-
startCall
public abstract void startCall() throws IOExceptionStarts the method call:C
- 参数:
method- the method name to call.- 抛出:
IOException
-
startCall
public abstract void startCall(String method, int length) throws IOException
Starts the method call:C string int
- 参数:
method- the method name to call.- 抛出:
IOException
-
writeHeader
public void writeHeader(String name) throws IOException
已过时。For Hessian 2.0, use the Header envelope instead- 抛出:
IOException
-
writeMethod
public abstract void writeMethod(String method) throws IOException
Writes the method tag.string
- 参数:
method- the method name to call.- 抛出:
IOException
-
completeCall
public abstract void completeCall() throws IOExceptionCompletes the method call:- 抛出:
IOException
-
writeBoolean
public abstract void writeBoolean(boolean value) throws IOExceptionWrites a boolean value to the stream. The boolean will be written with the following syntax:T F
- 参数:
value- the boolean value to write.- 抛出:
IOException
-
writeInt
public abstract void writeInt(int value) throws IOExceptionWrites an integer value to the stream. The integer will be written with the following syntax:I b32 b24 b16 b8
- 参数:
value- the integer value to write.- 抛出:
IOException
-
writeLong
public abstract void writeLong(long value) throws IOExceptionWrites a long value to the stream. The long will be written with the following syntax:L b64 b56 b48 b40 b32 b24 b16 b8
- 参数:
value- the long value to write.- 抛出:
IOException
-
writeDouble
public abstract void writeDouble(double value) throws IOExceptionWrites a double value to the stream. The double will be written with the following syntax:D b64 b56 b48 b40 b32 b24 b16 b8
- 参数:
value- the double value to write.- 抛出:
IOException
-
writeUTCDate
public abstract void writeUTCDate(long time) throws IOExceptionWrites a date to the stream.T b64 b56 b48 b40 b32 b24 b16 b8
- 参数:
time- the date in milliseconds from the epoch in UTC- 抛出:
IOException
-
writeNull
public abstract void writeNull() throws IOExceptionWrites a null value to the stream. The null will be written with the following syntaxN
- 参数:
value- the string value to write.- 抛出:
IOException
-
writeString
public abstract void writeString(String value) throws IOException
Writes a string value to the stream using UTF-8 encoding. The string will be written with the following syntax:S b16 b8 string-value
If the value is null, it will be written as
N
- 参数:
value- the string value to write.- 抛出:
IOException
-
writeString
public abstract void writeString(char[] buffer, int offset, int length) throws IOExceptionWrites a string value to the stream using UTF-8 encoding. The string will be written with the following syntax:S b16 b8 string-value
If the value is null, it will be written as
N
- 参数:
value- the string value to write.- 抛出:
IOException
-
writeBytes
public abstract void writeBytes(byte[] buffer) throws IOExceptionWrites a byte array to the stream. The array will be written with the following syntax:B b16 b18 bytes
If the value is null, it will be written as
N
- 参数:
value- the string value to write.- 抛出:
IOException
-
writeBytes
public abstract void writeBytes(byte[] buffer, int offset, int length) throws IOExceptionWrites a byte array to the stream. The array will be written with the following syntax:B b16 b18 bytes
If the value is null, it will be written as
N
- 参数:
value- the string value to write.- 抛出:
IOException
-
writeByteBufferStart
public abstract void writeByteBufferStart() throws IOExceptionWrites a byte buffer to the stream.- 抛出:
IOException
-
writeByteBufferPart
public abstract void writeByteBufferPart(byte[] buffer, int offset, int length) throws IOExceptionWrites a byte buffer to the stream.b b16 b18 bytes
- 参数:
value- the string value to write.- 抛出:
IOException
-
writeByteBufferEnd
public abstract void writeByteBufferEnd(byte[] buffer, int offset, int length) throws IOExceptionWrites the last chunk of a byte buffer to the stream.b b16 b18 bytes
- 参数:
value- the string value to write.- 抛出:
IOException
-
removeRef
public abstract boolean removeRef(Object obj) throws IOException
Removes a reference.- 抛出:
IOException
-
replaceRef
public abstract boolean replaceRef(Object oldRef, Object newRef) throws IOException
Replaces a reference from one object to another.- 抛出:
IOException
-
addRef
public abstract boolean addRef(Object object) throws IOException
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
- 参数:
object- the object to add as a reference.- 返回:
- true if the object has already been written.
- 抛出:
IOException
-
resetReferences
public void resetReferences()
Resets the references for streaming.
-
writeObject
public abstract void writeObject(Object object) throws IOException
Writes a generic object to the output stream.- 抛出:
IOException
-
writeListBegin
public abstract boolean writeListBegin(int length, String type) throws IOExceptionWrites 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>
- 抛出:
IOException
-
writeListEnd
public abstract void writeListEnd() throws IOExceptionWrites the tail of the list to the stream.- 抛出:
IOException
-
writeMapBegin
public abstract void writeMapBegin(String type) throws IOException
Writes the map header to the stream. Map writers will callwriteMapBeginfollowed by the map contents and then callwriteMapEnd.M type (
)* Z - 抛出:
IOException
-
writeMapEnd
public abstract void writeMapEnd() throws IOExceptionWrites the tail of the map to the stream.- 抛出:
IOException
-
writeObjectBegin
public int writeObjectBegin(String type) throws IOException
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 * - 返回:
- true if the object has already been defined.
- 抛出:
IOException
-
writeClassFieldLength
public void writeClassFieldLength(int len) throws IOExceptionWrites the end of the class.- 抛出:
IOException
-
writeObjectEnd
public void writeObjectEnd() throws IOExceptionWrites the tail of the object to the stream.- 抛出:
IOException
-
writeReply
public void writeReply(Object o) throws IOException
- 抛出:
IOException
-
startReply
public void startReply() throws IOException- 抛出:
IOException
-
completeReply
public void completeReply() throws IOException- 抛出:
IOException
-
writeFault
public void writeFault(String code, String message, Object detail) throws IOException
- 抛出:
IOException
-
flush
public void flush() throws IOException- 抛出:
IOException
-
close
public void close() throws IOException- 抛出:
IOException
-
-