类 HessianOutput
- java.lang.Object
-
- com.alibaba.com.caucho.hessian.io.AbstractHessianOutput
-
- com.alibaba.com.caucho.hessian.io.HessianOutput
-
- 直接已知子类:
HessianSerializerOutput
public class HessianOutput extends AbstractHessianOutput
Output stream for Hessian requests, compatible with microedition Java. It only uses classes and types available in JDK.Since HessianOutput does not depend on any classes other than in the JDK, it can be extracted independently into a smaller package.
HessianOutput is unbuffered, so any client needs to provide its own buffering.
OutputStream os = ...; // from http connection HessianOutput out = new HessianOutput(os); String value; out.startCall("hello"); // start hello call out.writeString("arg1"); // write a string argument out.completeCall(); // complete the call
-
-
构造器概要
构造器 构造器 说明 HessianOutput()Creates an uninitialized Hessian output stream.HessianOutput(OutputStream os)Creates a new Hessian output stream, initialized with an underlying output stream.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanaddRef(Object object)If the object has already been written, just write its ref.voidcall(String method, Object[] args)Writes a complete method call.voidclose()voidcompleteCall()Completes.voidcompleteReply()Completes reading the replyvoidflush()voidinit(OutputStream os)Initializes the outputvoidprintLenString(String v)Prints a string to the stream, encoded as UTF-8 with preceeding lengthvoidprintString(char[] v, int offset, int length)Prints a string to the stream, encoded as UTF-8voidprintString(String v)Prints a string to the stream, encoded as UTF-8voidprintString(String v, int offset, int length)Prints a string to the stream, encoded as UTF-8booleanremoveRef(Object obj)Removes a reference.booleanreplaceRef(Object oldRef, Object newRef)Replaces a reference from one object to another.voidresetReferences()Resets the references for streaming.voidsetVersion(int version)Sets the client's version.voidstartCall()Writes the call tag.voidstartCall(String method, int length)Starts the method call.voidstartReply()Starts the replyvoidwriteBoolean(boolean value)Writes a boolean value to the stream.voidwriteByteBufferEnd(byte[] buffer, int offset, int length)Writes a byte buffer to the stream.voidwriteByteBufferPart(byte[] buffer, int offset, int length)Writes a byte buffer to the stream.voidwriteByteBufferStart()Writes a byte buffer to the stream.voidwriteBytes(byte[] buffer)Writes a byte array to the stream.voidwriteBytes(byte[] buffer, int offset, int length)Writes a byte array to the stream.voidwriteDouble(double value)Writes a double value to the stream.voidwriteFault(String code, String message, Object detail)Writes a fault.voidwriteHeader(String name)Writes a header name.voidwriteInt(int value)Writes an integer value to the stream.booleanwriteListBegin(int length, String type)Writes the list header to the stream.voidwriteListEnd()Writes the tail of the list to the stream.voidwriteLong(long value)Writes a long value to the stream.voidwriteMapBegin(String type)Writes the map header to the stream.voidwriteMapEnd()Writes the tail of the map to the stream.voidwriteMethod(String method)Writes the method tag.voidwriteNull()Writes a null value to the stream.voidwriteObject(Object object)Writes any object to the output stream.voidwritePlaceholder()Writes a placeholder.voidwriteRef(int value)Writes a reference.voidwriteRemote(String type, String url)Writes a remote object reference to the stream.voidwriteString(char[] buffer, int offset, int length)Writes a string value to the stream using UTF-8 encoding.voidwriteString(String value)Writes a string value to the stream using UTF-8 encoding.voidwriteUTCDate(long time)Writes a date to the stream.-
从类继承的方法 com.alibaba.com.caucho.hessian.io.AbstractHessianOutput
findSerializerFactory, getSerializerFactory, setSerializerFactory, writeClassFieldLength, writeObjectBegin, writeObjectEnd, writeReply
-
-
-
-
构造器详细资料
-
HessianOutput
public HessianOutput(OutputStream os)
Creates a new Hessian output stream, initialized with an underlying output stream.- 参数:
os- the underlying output stream.
-
HessianOutput
public HessianOutput()
Creates an uninitialized Hessian output stream.
-
-
方法详细资料
-
init
public void init(OutputStream os)
Initializes the output- 覆盖:
init在类中AbstractHessianOutput
-
setVersion
public void setVersion(int version)
Sets the client's version.
-
call
public void call(String method, Object[] args) throws IOException
Writes a complete method call.- 覆盖:
call在类中AbstractHessianOutput- 抛出:
IOException
-
startCall
public void startCall(String method, int length) throws IOException
Starts the method call. Clients would usestartCallinstead ofcallif they wanted finer control over writing the arguments, or needed to write headers.c major minor m b16 b8 method-name
- 指定者:
startCall在类中AbstractHessianOutput- 参数:
method- the method name to call.- 抛出:
IOException
-
startCall
public void startCall() throws IOExceptionWrites the call tag. This would be followed by the headers and the method tag.c major minor
- 指定者:
startCall在类中AbstractHessianOutput- 参数:
method- the method name to call.- 抛出:
IOException
-
writeMethod
public void writeMethod(String method) throws IOException
Writes the method tag.m b16 b8 method-name
- 指定者:
writeMethod在类中AbstractHessianOutput- 参数:
method- the method name to call.- 抛出:
IOException
-
completeCall
public void completeCall() throws IOExceptionCompletes.z
- 指定者:
completeCall在类中AbstractHessianOutput- 抛出:
IOException
-
startReply
public void startReply() throws IOExceptionStarts the replyA successful completion will have a single value:
r
- 覆盖:
startReply在类中AbstractHessianOutput- 抛出:
IOException
-
completeReply
public void completeReply() throws IOExceptionCompletes reading the replyA successful completion will have a single value:
z
- 覆盖:
completeReply在类中AbstractHessianOutput- 抛出:
IOException
-
writeHeader
public void writeHeader(String name) throws IOException
Writes a header name. The header value must immediately follow.H b16 b8 foo value
- 覆盖:
writeHeader在类中AbstractHessianOutput- 抛出:
IOException
-
writeFault
public void writeFault(String code, String message, Object detail) throws IOException
Writes a fault. The fault will be written as a descriptive string followed by an object:f <string>code <string>the fault code
<string>message <string>the fault mesage
<string>detail mt\x00\xnnjavax.ejb.FinderException ... z z
- 覆盖:
writeFault在类中AbstractHessianOutput- 参数:
code- the fault code, a three digit- 抛出:
IOException
-
writeObject
public void writeObject(Object object) throws IOException
Writes any object to the output stream.- 指定者:
writeObject在类中AbstractHessianOutput- 抛出:
IOException
-
writeListBegin
public 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 t b16 b8 type l b32 b24 b16 b8
- 指定者:
writeListBegin在类中AbstractHessianOutput- 抛出:
IOException
-
writeListEnd
public void writeListEnd() throws IOExceptionWrites the tail of the list to the stream.- 指定者:
writeListEnd在类中AbstractHessianOutput- 抛出:
IOException
-
writeMapBegin
public void writeMapBegin(String type) throws IOException
Writes the map header to the stream. Map writers will callwriteMapBeginfollowed by the map contents and then callwriteMapEnd.Mt b16 b8 (
)z - 指定者:
writeMapBegin在类中AbstractHessianOutput- 抛出:
IOException
-
writeMapEnd
public void writeMapEnd() throws IOExceptionWrites the tail of the map to the stream.- 指定者:
writeMapEnd在类中AbstractHessianOutput- 抛出:
IOException
-
writeRemote
public void writeRemote(String type, String url) throws IOException
Writes a remote object reference to the stream. The type is the type of the remote interface.'r' 't' b16 b8 type url
- 抛出:
IOException
-
writeBoolean
public void writeBoolean(boolean value) throws IOExceptionWrites a boolean value to the stream. The boolean will be written with the following syntax:T F
- 指定者:
writeBoolean在类中AbstractHessianOutput- 参数:
value- the boolean value to write.- 抛出:
IOException
-
writeInt
public 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
- 指定者:
writeInt在类中AbstractHessianOutput- 参数:
value- the integer value to write.- 抛出:
IOException
-
writeLong
public 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
- 指定者:
writeLong在类中AbstractHessianOutput- 参数:
value- the long value to write.- 抛出:
IOException
-
writeDouble
public 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
- 指定者:
writeDouble在类中AbstractHessianOutput- 参数:
value- the double value to write.- 抛出:
IOException
-
writeUTCDate
public void writeUTCDate(long time) throws IOExceptionWrites a date to the stream.T b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
writeUTCDate在类中AbstractHessianOutput- 参数:
time- the date in milliseconds from the epoch in UTC- 抛出:
IOException
-
writeNull
public void writeNull() throws IOExceptionWrites a null value to the stream. The null will be written with the following syntaxN
- 指定者:
writeNull在类中AbstractHessianOutput- 参数:
value- the string value to write.- 抛出:
IOException
-
writeString
public 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
- 指定者:
writeString在类中AbstractHessianOutput- 参数:
value- the string value to write.- 抛出:
IOException
-
writeString
public 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
- 指定者:
writeString在类中AbstractHessianOutput- 参数:
value- the string value to write.- 抛出:
IOException
-
writeBytes
public 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
- 指定者:
writeBytes在类中AbstractHessianOutput- 参数:
value- the string value to write.- 抛出:
IOException
-
writeBytes
public 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
- 指定者:
writeBytes在类中AbstractHessianOutput- 参数:
value- the string value to write.- 抛出:
IOException
-
writeByteBufferStart
public void writeByteBufferStart() throws IOExceptionWrites a byte buffer to the stream.- 指定者:
writeByteBufferStart在类中AbstractHessianOutput- 抛出:
IOException
-
writeByteBufferPart
public void writeByteBufferPart(byte[] buffer, int offset, int length) throws IOExceptionWrites a byte buffer to the stream.b b16 b18 bytes
- 指定者:
writeByteBufferPart在类中AbstractHessianOutput- 抛出:
IOException
-
writeByteBufferEnd
public void writeByteBufferEnd(byte[] buffer, int offset, int length) throws IOExceptionWrites a byte buffer to the stream.b b16 b18 bytes
- 指定者:
writeByteBufferEnd在类中AbstractHessianOutput- 抛出:
IOException
-
writeRef
public void writeRef(int value) throws IOExceptionWrites a reference.R b32 b24 b16 b8
- 参数:
value- the integer value to write.- 抛出:
IOException
-
writePlaceholder
public void writePlaceholder() throws IOExceptionWrites a placeholder.P
- 抛出:
IOException
-
addRef
public boolean addRef(Object object) throws IOException
If the object has already been written, just write its ref.- 指定者:
addRef在类中AbstractHessianOutput- 参数:
object- the object to add as a reference.- 返回:
- true if we're writing a ref.
- 抛出:
IOException
-
resetReferences
public void resetReferences()
Resets the references for streaming.- 覆盖:
resetReferences在类中AbstractHessianOutput
-
removeRef
public boolean removeRef(Object obj) throws IOException
Removes a reference.- 指定者:
removeRef在类中AbstractHessianOutput- 抛出:
IOException
-
replaceRef
public boolean replaceRef(Object oldRef, Object newRef) throws IOException
Replaces a reference from one object to another.- 指定者:
replaceRef在类中AbstractHessianOutput- 抛出:
IOException
-
printLenString
public void printLenString(String v) throws IOException
Prints a string to the stream, encoded as UTF-8 with preceeding length- 参数:
v- the string to print.- 抛出:
IOException
-
printString
public void printString(String v) throws IOException
Prints a string to the stream, encoded as UTF-8- 参数:
v- the string to print.- 抛出:
IOException
-
printString
public void printString(String v, int offset, int length) throws IOException
Prints a string to the stream, encoded as UTF-8- 参数:
v- the string to print.- 抛出:
IOException
-
printString
public void printString(char[] v, int offset, int length) throws IOExceptionPrints a string to the stream, encoded as UTF-8- 参数:
v- the string to print.- 抛出:
IOException
-
flush
public void flush() throws IOException- 覆盖:
flush在类中AbstractHessianOutput- 抛出:
IOException
-
close
public void close() throws IOException- 覆盖:
close在类中AbstractHessianOutput- 抛出:
IOException
-
-