public class Hessian2Input extends AbstractHessianInput implements Hessian2Constants
HessianInput is unbuffered, so any client needs to provide its own buffering.
InputStream is = ...; // from http connection HessianInput in = new HessianInput(is); String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
Hessian2Input.ObjectDefinition |
(package private) class |
Hessian2Input.ReadInputStream |
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
_buffer |
private int |
_chunkLength |
protected java.util.ArrayList<Hessian2Input.ObjectDefinition> |
_classDefs |
protected SerializerFactory |
_defaultSerializerFactory |
private static java.lang.reflect.Field |
_detailMessageField |
private HessianDebugInputStream |
_dIs |
private java.io.InputStream |
_is |
private static boolean |
_isCloseStreamOnClose |
private boolean |
_isLastChunk |
private int |
_length |
private java.lang.String |
_method |
private int |
_offset |
protected java.util.ArrayList<java.lang.Object> |
_refs |
private java.lang.Throwable |
_replyFault |
private java.lang.StringBuilder |
_sbuf |
protected SerializerFactory |
_serializerFactory |
protected java.util.ArrayList<java.lang.String> |
_types |
private static int |
END_OF_DATA |
private static int |
GAP |
private static java.util.logging.Logger |
log |
private static int |
SIZE |
BC_BINARY, BC_BINARY_CHUNK, BC_BINARY_DIRECT, BC_BINARY_SHORT, BC_CLASS_DEF, BC_DATE, BC_DATE_MINUTE, BC_DOUBLE, BC_DOUBLE_BYTE, BC_DOUBLE_MILL, BC_DOUBLE_ONE, BC_DOUBLE_SHORT, BC_DOUBLE_ZERO, BC_END, BC_FALSE, BC_INT, BC_INT_BYTE_ZERO, BC_INT_SHORT_ZERO, BC_INT_ZERO, BC_LIST_DIRECT, BC_LIST_DIRECT_UNTYPED, BC_LIST_FIXED, BC_LIST_FIXED_UNTYPED, BC_LIST_VARIABLE, BC_LIST_VARIABLE_UNTYPED, BC_LONG, BC_LONG_BYTE_ZERO, BC_LONG_INT, BC_LONG_SHORT_ZERO, BC_LONG_ZERO, BC_MAP, BC_MAP_UNTYPED, BC_NULL, BC_OBJECT, BC_OBJECT_DEF, BC_OBJECT_DIRECT, BC_REF, BC_STRING, BC_STRING_CHUNK, BC_STRING_DIRECT, BC_STRING_SHORT, BC_TRUE, BINARY_DIRECT_MAX, BINARY_SHORT_MAX, INT_BYTE_MAX, INT_BYTE_MIN, INT_DIRECT_MAX, INT_DIRECT_MIN, INT_SHORT_MAX, INT_SHORT_MIN, LIST_DIRECT_MAX, LONG_BYTE_MAX, LONG_BYTE_MIN, LONG_DIRECT_MAX, LONG_DIRECT_MIN, LONG_SHORT_MAX, LONG_SHORT_MIN, OBJECT_DIRECT_MAX, P_PACKET, P_PACKET_CHUNK, P_PACKET_DIRECT, P_PACKET_SHORT, PACKET_DIRECT_MAX, PACKET_SHORT_MAX, STRING_DIRECT_MAX, STRING_SHORT_MAX| Constructor and Description |
|---|
Hessian2Input() |
Hessian2Input(java.io.InputStream is)
Creates a new Hessian input stream, initialized with an
underlying input stream.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addDebugChar(java.lang.StringBuilder sb,
int ch) |
int |
addRef(java.lang.Object ref)
Adds a list/map reference.
|
private java.lang.String |
buildDebugContext(byte[] buffer,
int offset,
int length,
int errorOffset) |
void |
close() |
protected java.lang.String |
codeName(int ch) |
void |
completeCall()
Completes reading the call
|
void |
completeEnvelope()
Completes reading the envelope
|
void |
completeMessage()
Completes reading the message
|
void |
completeReply()
Completes reading the call
|
void |
completeValueReply()
Completes reading the call
|
protected java.io.IOException |
error(java.lang.String message) |
protected java.io.IOException |
expect(java.lang.String expect,
int ch) |
protected SerializerFactory |
findSerializerFactory()
Gets the serializer factory.
|
void |
free() |
java.lang.String |
getMethod()
Returns the calls method
|
java.io.Reader |
getReader()
Starts reading a string.
|
java.lang.Throwable |
getReplyFault()
Returns any reply fault.
|
SerializerFactory |
getSerializerFactory()
Gets the serializer factory.
|
void |
init(java.io.InputStream is)
Initialize the Hessian stream with the underlying input stream.
|
void |
initPacket(java.io.InputStream is) |
boolean |
isCloseStreamOnClose() |
boolean |
isEnd()
Returns true if this is the end of a list or a map.
|
private int |
parseByte()
Reads a byte from the underlying stream.
|
private int |
parseChar()
Reads a character from the underlying stream.
|
private boolean |
parseChunkLength() |
private double |
parseDouble()
Parses a 64-bit double value from the stream.
|
private int |
parseInt()
Parses a 32-bit integer value from the stream.
|
private long |
parseLong()
Parses a 64-bit long value from the stream.
|
private void |
parseString(java.lang.StringBuilder sbuf) |
private int |
parseUTF8Char()
Parses a single UTF8 character.
|
(package private) org.w3c.dom.Node |
parseXML() |
private java.lang.Throwable |
prepareFault(java.util.HashMap fault)
Prepares the fault.
|
int |
read()
Normally, shouldn't be called externally, but needed for QA, e.g.
|
(package private) int |
read(byte[] buffer,
int offset,
int length)
Reads bytes from the underlying stream.
|
java.lang.Object[] |
readArguments() |
boolean |
readBoolean()
Reads a boolean
|
private boolean |
readBuffer() |
int |
readByte()
Reads a byte from the stream.
|
byte[] |
readBytes()
Reads a byte array
|
int |
readBytes(byte[] buffer,
int offset,
int length)
Reads a byte array from the stream.
|
int |
readCall()
Starts reading the call
|
int |
readChar()
Reads a byte from the stream.
|
double |
readDouble()
Reads a double
|
void |
readEnd()
Reads the end byte.
|
int |
readEnvelope()
Starts reading the envelope
|
private java.util.HashMap |
readFault()
Reads a fault.
|
float |
readFloat()
Reads a float
|
java.lang.String |
readHeader()
Reads a header, returning null if there are no headers.
|
java.io.InputStream |
readInputStream()
Reads bytes based on an input stream.
|
int |
readInt()
Reads an integer
|
int |
readLength()
Parses the length for an array
|
void |
readListEnd()
Reads the end byte.
|
int |
readListStart()
Reads the start of a list.
|
long |
readLong()
Reads a long
|
void |
readMapEnd()
Reads the end byte.
|
int |
readMapStart()
Reads the start of a list.
|
java.lang.String |
readMethod()
Starts reading the call
|
int |
readMethodArgLength()
Returns the number of method arguments
|
void |
readNull()
Reads a null
|
java.lang.Object |
readObject()
Reads an arbitrary object from the input stream when the type
is unknown.
|
java.lang.Object |
readObject(java.lang.Class cl)
Reads an object from the input stream with an expected type.
|
private void |
readObjectDefinition(java.lang.Class<?> cl)
Reads an object definition:
|
private java.lang.Object |
readObjectInstance(java.lang.Class<?> cl,
Hessian2Input.ObjectDefinition def) |
java.lang.Object |
readRef()
Reads a reference.
|
java.lang.Object |
readRemote()
Reads a remote object.
|
java.lang.Object |
readReply(java.lang.Class expectedClass)
Reads a reply as an object.
|
short |
readShort()
Reads a short
|
java.lang.Object |
readStreamingObject() |
java.lang.String |
readString()
Reads a string
|
int |
readString(char[] buffer,
int offset,
int length)
Reads a byte array from the stream.
|
java.lang.String |
readType()
Parses a type from the stream.
|
long |
readUTCDate()
Reads a date.
|
void |
reset() |
void |
resetBuffer() |
void |
resetReferences()
Resets the references for streaming.
|
java.lang.Object |
resolveRemote(java.lang.String type,
java.lang.String url)
Resolves a remote object.
|
void |
setCloseStreamOnClose(boolean isClose) |
void |
setRef(int i,
java.lang.Object ref)
Adds a list/map reference.
|
void |
setSerializerFactory(SerializerFactory factory)
Sets the serializer factory.
|
void |
startCall()
Starts reading the call, including the headers.
|
int |
startMessage()
Starts reading a packet
|
void |
startReply()
Starts reading the reply
|
protected void |
unread() |
getRemoteResolver, readNode, readToOutputStream, setRemoteResolver, skipOptionalCall, startReplyBodyprivate static final java.util.logging.Logger log
private static final int END_OF_DATA
private static java.lang.reflect.Field _detailMessageField
private static final int SIZE
private static final int GAP
protected SerializerFactory _defaultSerializerFactory
protected SerializerFactory _serializerFactory
private static boolean _isCloseStreamOnClose
protected java.util.ArrayList<java.lang.Object> _refs
protected java.util.ArrayList<Hessian2Input.ObjectDefinition> _classDefs
protected java.util.ArrayList<java.lang.String> _types
private java.io.InputStream _is
private final byte[] _buffer
private int _offset
private int _length
private java.lang.String _method
private java.lang.Throwable _replyFault
private java.lang.StringBuilder _sbuf
private boolean _isLastChunk
private int _chunkLength
private HessianDebugInputStream _dIs
public Hessian2Input()
public Hessian2Input(java.io.InputStream is)
is - the underlying input stream.public void setSerializerFactory(SerializerFactory factory)
setSerializerFactory in class AbstractHessianInputpublic SerializerFactory getSerializerFactory()
protected final SerializerFactory findSerializerFactory()
public void setCloseStreamOnClose(boolean isClose)
public boolean isCloseStreamOnClose()
public java.lang.String getMethod()
getMethod in class AbstractHessianInputpublic java.lang.Throwable getReplyFault()
public void init(java.io.InputStream is)
AbstractHessianInputinit in class AbstractHessianInputpublic void initPacket(java.io.InputStream is)
public int readCall()
throws java.io.IOException
c major minor
readCall in class AbstractHessianInputjava.io.IOExceptionpublic int readEnvelope()
throws java.io.IOException
E major minor
java.io.IOExceptionpublic void completeEnvelope()
throws java.io.IOException
A successful completion will have a single value:
Z
java.io.IOExceptionpublic java.lang.String readMethod()
throws java.io.IOException
A successful completion will have a single value:
string
readMethod in class AbstractHessianInputjava.io.IOExceptionpublic int readMethodArgLength()
throws java.io.IOException
int
readMethodArgLength in class AbstractHessianInputjava.io.IOExceptionpublic void startCall()
throws java.io.IOException
The call expects the following protocol data
c major minor m b16 b8 method
startCall in class AbstractHessianInputjava.io.IOExceptionpublic java.lang.Object[] readArguments()
throws java.io.IOException
java.io.IOExceptionpublic void completeCall()
throws java.io.IOException
A successful completion will have a single value:
completeCall in class AbstractHessianInputjava.io.IOExceptionpublic java.lang.Object readReply(java.lang.Class expectedClass)
throws java.lang.Throwable
readReply in class AbstractHessianInputjava.lang.Throwablepublic void startReply()
throws java.lang.Throwable
A successful completion will have a single value:
r
startReply in class AbstractHessianInputjava.lang.Throwableprivate java.lang.Throwable prepareFault(java.util.HashMap fault)
throws java.io.IOException
java.io.IOExceptionpublic void completeReply()
throws java.io.IOException
A successful completion will have a single value:
z
completeReply in class AbstractHessianInputjava.io.IOExceptionpublic void completeValueReply()
throws java.io.IOException
A successful completion will have a single value:
z
java.io.IOExceptionpublic java.lang.String readHeader()
throws java.io.IOException
H b16 b8 value
readHeader in class AbstractHessianInputjava.io.IOExceptionpublic int startMessage()
throws java.io.IOException
p major minor
java.io.IOExceptionpublic void completeMessage()
throws java.io.IOException
A successful completion will have a single value:
z
java.io.IOExceptionpublic void readNull()
throws java.io.IOException
N
readNull in class AbstractHessianInputjava.io.IOExceptionpublic boolean readBoolean()
throws java.io.IOException
T F
readBoolean in class AbstractHessianInputjava.io.IOExceptionpublic short readShort()
throws java.io.IOException
I b32 b24 b16 b8
java.io.IOExceptionpublic final int readInt()
throws java.io.IOException
I b32 b24 b16 b8
readInt in class AbstractHessianInputjava.io.IOExceptionpublic long readLong()
throws java.io.IOException
L b64 b56 b48 b40 b32 b24 b16 b8
readLong in class AbstractHessianInputjava.io.IOExceptionpublic float readFloat()
throws java.io.IOException
D b64 b56 b48 b40 b32 b24 b16 b8
java.io.IOExceptionpublic double readDouble()
throws java.io.IOException
D b64 b56 b48 b40 b32 b24 b16 b8
readDouble in class AbstractHessianInputjava.io.IOExceptionpublic long readUTCDate()
throws java.io.IOException
T b64 b56 b48 b40 b32 b24 b16 b8
readUTCDate in class AbstractHessianInputjava.io.IOExceptionpublic int readChar()
throws java.io.IOException
java.io.IOExceptionpublic int readString(char[] buffer,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readString()
throws java.io.IOException
S b16 b8 string value
readString in class AbstractHessianInputjava.io.IOExceptionpublic byte[] readBytes()
throws java.io.IOException
B b16 b8 data value
readBytes in class AbstractHessianInputjava.io.IOExceptionpublic int readByte()
throws java.io.IOException
java.io.IOExceptionpublic int readBytes(byte[] buffer,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionprivate java.util.HashMap readFault()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object readObject(java.lang.Class cl)
throws java.io.IOException
readObject in class AbstractHessianInputcl - the expected class if the protocol doesn't supply it.java.io.IOExceptionpublic java.lang.Object readObject()
throws java.io.IOException
readObject in class AbstractHessianInputjava.io.IOExceptionprivate void readObjectDefinition(java.lang.Class<?> cl)
throws java.io.IOException
O string(string)* *
java.io.IOExceptionprivate java.lang.Object readObjectInstance(java.lang.Class<?> cl,
Hessian2Input.ObjectDefinition def)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object readRemote()
throws java.io.IOException
readRemote in class AbstractHessianInputjava.io.IOExceptionpublic java.lang.Object readRef()
throws java.io.IOException
readRef in class AbstractHessianInputjava.io.IOExceptionpublic int readListStart()
throws java.io.IOException
readListStart in class AbstractHessianInputjava.io.IOExceptionpublic int readMapStart()
throws java.io.IOException
readMapStart in class AbstractHessianInputjava.io.IOExceptionpublic boolean isEnd()
throws java.io.IOException
isEnd in class AbstractHessianInputjava.io.IOExceptionpublic void readEnd()
throws java.io.IOException
readEnd in class AbstractHessianInputjava.io.IOExceptionpublic void readMapEnd()
throws java.io.IOException
readMapEnd in class AbstractHessianInputjava.io.IOExceptionpublic void readListEnd()
throws java.io.IOException
readListEnd in class AbstractHessianInputjava.io.IOExceptionpublic int addRef(java.lang.Object ref)
addRef in class AbstractHessianInputpublic void setRef(int i,
java.lang.Object ref)
setRef in class AbstractHessianInputpublic void resetReferences()
resetReferences in class AbstractHessianInputpublic void reset()
public void resetBuffer()
public java.lang.Object readStreamingObject()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object resolveRemote(java.lang.String type,
java.lang.String url)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readType()
throws java.io.IOException
type ::= string type ::= int
readType in class AbstractHessianInputjava.io.IOExceptionpublic int readLength()
throws java.io.IOException
l b32 b24 b16 b8
readLength in class AbstractHessianInputjava.io.IOExceptionprivate int parseInt()
throws java.io.IOException
b32 b24 b16 b8
java.io.IOExceptionprivate long parseLong()
throws java.io.IOException
b64 b56 b48 b40 b32 b24 b16 b8
java.io.IOExceptionprivate double parseDouble()
throws java.io.IOException
b64 b56 b48 b40 b32 b24 b16 b8
java.io.IOExceptionorg.w3c.dom.Node parseXML()
throws java.io.IOException
java.io.IOExceptionprivate void parseString(java.lang.StringBuilder sbuf)
throws java.io.IOException
java.io.IOExceptionprivate int parseChar()
throws java.io.IOException
java.io.IOExceptionprivate boolean parseChunkLength()
throws java.io.IOException
java.io.IOExceptionprivate int parseUTF8Char()
throws java.io.IOException
java.io.IOExceptionprivate int parseByte()
throws java.io.IOException
java.io.IOExceptionpublic java.io.InputStream readInputStream()
throws java.io.IOException
readInputStream in class AbstractHessianInputjava.io.IOExceptionint read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic final int read()
throws java.io.IOException
java.io.IOExceptionprotected void unread()
private final boolean readBuffer()
throws java.io.IOException
java.io.IOExceptionpublic java.io.Reader getReader()
AbstractHessianInputs b16 b8 non-final string chunk S b16 b8 final string chunk
getReader in class AbstractHessianInputprotected java.io.IOException expect(java.lang.String expect,
int ch)
throws java.io.IOException
java.io.IOExceptionprivate java.lang.String buildDebugContext(byte[] buffer,
int offset,
int length,
int errorOffset)
private void addDebugChar(java.lang.StringBuilder sb,
int ch)
protected java.lang.String codeName(int ch)
protected java.io.IOException error(java.lang.String message)
public void free()
public void close()
throws java.io.IOException
close in class AbstractHessianInputjava.io.IOException