public class HessianOutput extends AbstractHessianOutput
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addRef(Object object)
If the object has already been written, just write its ref.
|
void |
call(String method,
Object[] args)
Writes a complete method call.
|
void |
close() |
void |
completeCall()
Completes.
|
void |
completeReply()
Completes reading the reply
A successful completion will have a single value:
z
|
void |
flush() |
void |
init(OutputStream os)
Initializes the output
|
void |
printLenString(String v)
Prints a string to the stream, encoded as UTF-8 with preceeding length
|
void |
printString(char[] v,
int offset,
int length)
Prints a string to the stream, encoded as UTF-8
|
void |
printString(String v)
Prints a string to the stream, encoded as UTF-8
|
void |
printString(String v,
int offset,
int length)
Prints a string to the stream, encoded as UTF-8
|
boolean |
removeRef(Object obj)
Removes a reference.
|
boolean |
replaceRef(Object oldRef,
Object newRef)
Replaces a reference from one object to another.
|
void |
resetReferences()
Resets the references for streaming.
|
void |
setVersion(int version)
Sets the client's version.
|
void |
startCall()
Writes the call tag.
|
void |
startCall(String method,
int length)
Starts the method call.
|
void |
startReply()
Starts the reply
A successful completion will have a single value:
r
|
void |
writeBoolean(boolean value)
Writes a boolean value to the stream.
|
void |
writeByteBufferEnd(byte[] buffer,
int offset,
int length)
Writes a byte buffer to the stream.
|
void |
writeByteBufferPart(byte[] buffer,
int offset,
int length)
Writes a byte buffer to the stream.
|
void |
writeByteBufferStart()
Writes a byte buffer to the stream.
|
void |
writeBytes(byte[] buffer)
Writes a byte array to the stream.
|
void |
writeBytes(byte[] buffer,
int offset,
int length)
Writes a byte array to the stream.
|
void |
writeDouble(double value)
Writes a double value to the stream.
|
void |
writeFault(String code,
String message,
Object detail)
Writes a fault.
|
void |
writeHeader(String name)
Writes a header name.
|
void |
writeInt(int value)
Writes an integer value to the stream.
|
boolean |
writeListBegin(int length,
String type)
Writes the list header to the stream.
|
void |
writeListEnd()
Writes the tail of the list to the stream.
|
void |
writeLong(long value)
Writes a long value to the stream.
|
void |
writeMapBegin(String type)
Writes the map header to the stream.
|
void |
writeMapEnd()
Writes the tail of the map to the stream.
|
void |
writeMethod(String method)
Writes the method tag.
|
void |
writeNull()
Writes a null value to the stream.
|
void |
writeObject(Object object)
Writes any object to the output stream.
|
void |
writePlaceholder()
Writes a placeholder.
|
void |
writeRef(int value)
Writes a reference.
|
void |
writeRemote(String type,
String url)
Writes a remote object reference to the stream.
|
void |
writeString(char[] buffer,
int offset,
int length)
Writes a string value to the stream using UTF-8 encoding.
|
void |
writeString(String value)
Writes a string value to the stream using UTF-8 encoding.
|
void |
writeUTCDate(long time)
Writes a date to the stream.
|
findSerializerFactory, getSerializerFactory, setSerializerFactory, writeClassFieldLength, writeObjectBegin, writeObjectEnd, writeReplypublic HessianOutput(OutputStream os)
os - the underlying output stream.public HessianOutput()
public void init(OutputStream os)
init 在类中 AbstractHessianOutputpublic void setVersion(int version)
public void call(String method, Object[] args) throws IOException
call 在类中 AbstractHessianOutputIOExceptionpublic void startCall(String method, int length) throws IOException
startCall
instead of call if they wanted finer control over
writing the arguments, or needed to write headers.
c major minor
m b16 b8 method-name
startCall 在类中 AbstractHessianOutputmethod - the method name to call.IOExceptionpublic void startCall()
throws IOException
c major minor
startCall 在类中 AbstractHessianOutputmethod - the method name to call.IOExceptionpublic void writeMethod(String method) throws IOException
m b16 b8 method-name
writeMethod 在类中 AbstractHessianOutputmethod - the method name to call.IOExceptionpublic void completeCall()
throws IOException
z
completeCall 在类中 AbstractHessianOutputIOExceptionpublic void startReply()
throws IOException
A successful completion will have a single value:
r
startReply 在类中 AbstractHessianOutputIOExceptionpublic void completeReply()
throws IOException
A successful completion will have a single value:
z
completeReply 在类中 AbstractHessianOutputIOExceptionpublic void writeHeader(String name) throws IOException
H b16 b8 foo value
writeHeader 在类中 AbstractHessianOutputIOExceptionpublic void writeFault(String code, String message, Object detail) throws IOException
<string>message
<string>the fault mesage
<string>detail
mt\x00\xnnjavax.ejb.FinderException
...
z
z
f
<string>code
<string>the fault code
writeFault 在类中 AbstractHessianOutputcode - the fault code, a three digitIOExceptionpublic void writeObject(Object object) throws IOException
writeObject 在类中 AbstractHessianOutputIOExceptionpublic boolean writeListBegin(int length,
String type)
throws IOException
writeListBegin followed by the list contents and then
call writeListEnd.
V
t b16 b8 type
l b32 b24 b16 b8
writeListBegin 在类中 AbstractHessianOutputIOExceptionpublic void writeListEnd()
throws IOException
writeListEnd 在类中 AbstractHessianOutputIOExceptionpublic void writeMapBegin(String type) throws IOException
writeMapBegin followed by the map contents and then
call writeMapEnd.
Mt b16 b8 (
writeMapBegin 在类中 AbstractHessianOutputIOExceptionpublic void writeMapEnd()
throws IOException
writeMapEnd 在类中 AbstractHessianOutputIOExceptionpublic void writeRemote(String type, String url) throws IOException
'r' 't' b16 b8 type url
IOExceptionpublic void writeBoolean(boolean value)
throws IOException
T
F
writeBoolean 在类中 AbstractHessianOutputvalue - the boolean value to write.IOExceptionpublic void writeInt(int value)
throws IOException
I b32 b24 b16 b8
writeInt 在类中 AbstractHessianOutputvalue - the integer value to write.IOExceptionpublic void writeLong(long value)
throws IOException
L b64 b56 b48 b40 b32 b24 b16 b8
writeLong 在类中 AbstractHessianOutputvalue - the long value to write.IOExceptionpublic void writeDouble(double value)
throws IOException
D b64 b56 b48 b40 b32 b24 b16 b8
writeDouble 在类中 AbstractHessianOutputvalue - the double value to write.IOExceptionpublic void writeUTCDate(long time)
throws IOException
T b64 b56 b48 b40 b32 b24 b16 b8
writeUTCDate 在类中 AbstractHessianOutputtime - the date in milliseconds from the epoch in UTCIOExceptionpublic void writeNull()
throws IOException
N
writeNull 在类中 AbstractHessianOutputvalue - the string value to write.IOExceptionpublic void writeString(String value) throws IOException
S b16 b8 string-value
If the value is null, it will be written as
N
writeString 在类中 AbstractHessianOutputvalue - the string value to write.IOExceptionpublic void writeString(char[] buffer,
int offset,
int length)
throws IOException
S b16 b8 string-value
If the value is null, it will be written as
N
writeString 在类中 AbstractHessianOutputvalue - the string value to write.IOExceptionpublic void writeBytes(byte[] buffer)
throws IOException
B b16 b18 bytes
If the value is null, it will be written as
N
writeBytes 在类中 AbstractHessianOutputvalue - the string value to write.IOExceptionpublic void writeBytes(byte[] buffer,
int offset,
int length)
throws IOException
B b16 b18 bytes
If the value is null, it will be written as
N
writeBytes 在类中 AbstractHessianOutputvalue - the string value to write.IOExceptionpublic void writeByteBufferStart()
throws IOException
writeByteBufferStart 在类中 AbstractHessianOutputIOExceptionpublic void writeByteBufferPart(byte[] buffer,
int offset,
int length)
throws IOException
b b16 b18 bytes
writeByteBufferPart 在类中 AbstractHessianOutputIOExceptionpublic void writeByteBufferEnd(byte[] buffer,
int offset,
int length)
throws IOException
b b16 b18 bytes
writeByteBufferEnd 在类中 AbstractHessianOutputIOExceptionpublic void writeRef(int value)
throws IOException
R b32 b24 b16 b8
value - the integer value to write.IOExceptionpublic void writePlaceholder()
throws IOException
P
IOExceptionpublic boolean addRef(Object object) throws IOException
addRef 在类中 AbstractHessianOutputobject - the object to add as a reference.IOExceptionpublic void resetReferences()
resetReferences 在类中 AbstractHessianOutputpublic boolean removeRef(Object obj) throws IOException
removeRef 在类中 AbstractHessianOutputIOExceptionpublic boolean replaceRef(Object oldRef, Object newRef) throws IOException
replaceRef 在类中 AbstractHessianOutputIOExceptionpublic void printLenString(String v) throws IOException
v - the string to print.IOExceptionpublic void printString(String v) throws IOException
v - the string to print.IOExceptionpublic void printString(String v, int offset, int length) throws IOException
v - the string to print.IOExceptionpublic void printString(char[] v,
int offset,
int length)
throws IOException
v - the string to print.IOExceptionpublic void flush()
throws IOException
flush 在类中 AbstractHessianOutputIOExceptionpublic void close()
throws IOException
close 在类中 AbstractHessianOutputIOExceptionCopyright © 2011–2019 The Apache Software Foundation. All rights reserved.