类 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 boolean
addRef(Object object)
Adds an object to the reference list.void
call(String method, Object[] args)
Writes a complete method call.void
close()
abstract void
completeCall()
Completes the method call:void
completeReply()
SerializerFactory
findSerializerFactory()
Gets the serializer factory.void
flush()
SerializerFactory
getSerializerFactory()
Gets the serializer factory.void
init(OutputStream os)
Initialize the output with a new underlying stream.abstract boolean
removeRef(Object obj)
Removes a reference.abstract boolean
replaceRef(Object oldRef, Object newRef)
Replaces a reference from one object to another.void
resetReferences()
Resets the references for streaming.void
setSerializerFactory(SerializerFactory factory)
Sets the serializer factory.abstract void
startCall()
Starts the method call:abstract void
startCall(String method, int length)
Starts the method call:void
startReply()
abstract void
writeBoolean(boolean value)
Writes a boolean value to the stream.abstract void
writeByteBufferEnd(byte[] buffer, int offset, int length)
Writes the last chunk of a byte buffer to the stream.abstract void
writeByteBufferPart(byte[] buffer, int offset, int length)
Writes a byte buffer to the stream.abstract void
writeByteBufferStart()
Writes a byte buffer to the stream.abstract void
writeBytes(byte[] buffer)
Writes a byte array to the stream.abstract void
writeBytes(byte[] buffer, int offset, int length)
Writes a byte array to the stream.void
writeClassFieldLength(int len)
Writes the end of the class.abstract void
writeDouble(double value)
Writes a double value to the stream.void
writeFault(String code, String message, Object detail)
void
writeHeader(String name)
已过时。abstract void
writeInt(int value)
Writes an integer value to the stream.abstract boolean
writeListBegin(int length, String type)
Writes the list header to the stream.abstract void
writeListEnd()
Writes the tail of the list to the stream.abstract void
writeLong(long value)
Writes a long value to the stream.abstract void
writeMapBegin(String type)
Writes the map header to the stream.abstract void
writeMapEnd()
Writes the tail of the map to the stream.abstract void
writeMethod(String method)
Writes the method tag.abstract void
writeNull()
Writes a null value to the stream.abstract void
writeObject(Object object)
Writes a generic object to the output stream.int
writeObjectBegin(String type)
Writes the object header to the stream (for Hessian 2.0), or a Map for Hessian 1.0.void
writeObjectEnd()
Writes the tail of the object to the stream.void
writeReply(Object o)
abstract void
writeString(char[] buffer, int offset, int length)
Writes a string value to the stream using UTF-8 encoding.abstract void
writeString(String value)
Writes a string value to the stream using UTF-8 encoding.abstract void
writeUTCDate(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 IOException
Starts 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 IOException
Completes the method call:- 抛出:
IOException
-
writeBoolean
public abstract void writeBoolean(boolean value) throws IOException
Writes 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 IOException
Writes 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 IOException
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
- 参数:
value
- the long value to write.- 抛出:
IOException
-
writeDouble
public abstract void writeDouble(double value) throws IOException
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
- 参数:
value
- the double value to write.- 抛出:
IOException
-
writeUTCDate
public abstract void writeUTCDate(long time) throws IOException
Writes 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 IOException
Writes 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 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
-
writeBytes
public abstract void writeBytes(byte[] buffer) throws IOException
Writes 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 IOException
Writes 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 IOException
Writes a byte buffer to the stream.- 抛出:
IOException
-
writeByteBufferPart
public abstract void writeByteBufferPart(byte[] buffer, int offset, int length) throws IOException
Writes 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 IOException
Writes 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 IOException
Writes the list header to the stream. List writers will callwriteListBegin
followed 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 IOException
Writes 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 callwriteMapBegin
followed by the map contents and then callwriteMapEnd
.M type (
)* Z - 抛出:
IOException
-
writeMapEnd
public abstract void writeMapEnd() throws IOException
Writes 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 callwriteObjectBegin
followed 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 IOException
Writes the end of the class.- 抛出:
IOException
-
writeObjectEnd
public void writeObjectEnd() throws IOException
Writes 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
-
-