类 Hessian2Input
- java.lang.Object
-
- com.alibaba.com.caucho.hessian.io.AbstractHessianInput
-
- com.alibaba.com.caucho.hessian.io.Hessian2Input
-
- 所有已实现的接口:
Hessian2Constants
public class Hessian2Input extends AbstractHessianInput implements Hessian2Constants
Input stream for Hessian requests.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
-
-
字段概要
-
从接口继承的字段 com.alibaba.com.caucho.hessian.io.Hessian2Constants
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
-
-
构造器概要
构造器 构造器 说明 Hessian2Input(InputStream is)
Creates a new Hessian input stream, initialized with an underlying input stream.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 int
addRef(Object ref)
Adds a list/map reference.boolean
checkAndReadNull()
void
close()
void
completeCall()
Completes reading the callvoid
completeEnvelope()
Completes reading the envelopevoid
completeMessage()
Completes reading the messagevoid
completeReply()
Completes reading the callvoid
completeValueReply()
Completes reading the callSerializerFactory
findSerializerFactory()
Gets the serializer factory, creating a default if necessary.String
getMethod()
Returns the calls methodReader
getReader()
Starts reading a string.Throwable
getReplyFault()
Returns any reply fault.SerializerFactory
getSerializerFactory()
Gets the serializer factory.void
init(InputStream is)
Initialize the Hessian stream with the underlying input stream.boolean
isCloseStreamOnClose()
boolean
isEnd()
Returns true if this is the end of a list or a map.int
read()
Normally, shouldn't be called externally, but needed for QA, e.g.boolean
readBoolean()
Reads a booleanint
readByte()
Reads a byte from the stream.byte[]
readBytes()
Reads a byte arrayint
readBytes(byte[] buffer, int offset, int length)
Reads a byte array from the stream.int
readCall()
Starts reading the callint
readChar()
Reads a byte from the stream.double
readDouble()
Reads a doublevoid
readEnd()
Reads the end byte.int
readEnvelope()
Starts reading the envelopefloat
readFloat()
Reads a floatString
readHeader()
Reads a header, returning null if there are no headers.InputStream
readInputStream()
Reads bytes based on an input stream.int
readInt()
Reads an integerint
readLength()
Parses the length for an arrayvoid
readListEnd()
Reads the end byte.int
readListStart()
Reads the start of a list.long
readLong()
Reads a longvoid
readMapEnd()
Reads the end byte.int
readMapStart()
Reads the start of a list.String
readMethod()
Starts reading the callint
readMethodArgLength()
Returns the number of method argumentsvoid
readNull()
Reads a nullObject
readObject()
Reads an arbitrary object from the input stream when the type is unknown.Object
readObject(Class cl)
Reads an object from the input stream with an expected type.Object
readObject(Class expectedClass, Class<?>... expectedTypes)
Reads an arbitrary object from the input stream.Object
readObject(List<Class<?>> expectedTypes)
Reads an arbitrary object from the input stream.Object
readRef()
Reads a reference.Object
readRemote()
Reads a remote object.Object
readReply(Class expectedClass)
Reads a reply as an object.short
readShort()
Reads a shortObject
readStreamingObject()
String
readString()
Reads a stringint
readString(char[] buffer, int offset, int length)
Reads a byte array from the stream.String
readType()
Parses a type from the stream.long
readUTCDate()
Reads a date.void
reset()
void
resetReferences()
Resets the references for streaming.Object
resolveRemote(String type, String url)
Resolves a remote object.void
setCloseStreamOnClose(boolean isClose)
void
setRef(int i, 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 the messagevoid
startReply()
Starts reading the reply-
从类继承的方法 com.alibaba.com.caucho.hessian.io.AbstractHessianInput
getRemoteResolver, readNode, setRemoteResolver, skipOptionalCall
-
-
-
-
构造器详细资料
-
Hessian2Input
public Hessian2Input(InputStream is)
Creates a new Hessian input stream, initialized with an underlying input stream.- 参数:
is
- the underlying input 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, creating a default if necessary.
-
isCloseStreamOnClose
public boolean isCloseStreamOnClose()
-
setCloseStreamOnClose
public void setCloseStreamOnClose(boolean isClose)
-
getMethod
public String getMethod()
Returns the calls method- 指定者:
getMethod
在类中AbstractHessianInput
-
getReplyFault
public Throwable getReplyFault()
Returns any reply fault.
-
init
public void init(InputStream is)
从类复制的说明:AbstractHessianInput
Initialize the Hessian stream with the underlying input stream.- 覆盖:
init
在类中AbstractHessianInput
-
reset
public void reset()
-
checkAndReadNull
public boolean checkAndReadNull()
- 指定者:
checkAndReadNull
在类中AbstractHessianInput
-
readCall
public int readCall() throws IOException
Starts reading the callc major minor
- 指定者:
readCall
在类中AbstractHessianInput
- 抛出:
IOException
-
readEnvelope
public int readEnvelope() throws IOException
Starts reading the envelopeE major minor
- 抛出:
IOException
-
completeEnvelope
public void completeEnvelope() throws IOException
Completes reading the envelopeA successful completion will have a single value:
Z
- 抛出:
IOException
-
readMethod
public String readMethod() throws IOException
Starts reading the callA successful completion will have a single value:
string
- 指定者:
readMethod
在类中AbstractHessianInput
- 抛出:
IOException
-
readMethodArgLength
public int readMethodArgLength() throws IOException
Returns the number of method argumentsint
- 覆盖:
readMethodArgLength
在类中AbstractHessianInput
- 返回:
- -1 for a variable length (hessian 1.0)
- 抛出:
IOException
-
startCall
public void startCall() throws IOException
Starts reading the call, including the headers.The call expects the following protocol data
c major minor m b16 b8 method
- 指定者:
startCall
在类中AbstractHessianInput
- 抛出:
IOException
-
completeCall
public void completeCall() throws IOException
Completes reading the callA successful completion will have a single value:
- 指定者:
completeCall
在类中AbstractHessianInput
- 抛出:
IOException
-
readReply
public Object readReply(Class expectedClass) throws Throwable
Reads a reply as an object. If the reply has a fault, throws the exception.- 指定者:
readReply
在类中AbstractHessianInput
- 抛出:
Throwable
-
startReply
public void startReply() throws Throwable
Starts reading the replyA successful completion will have a single value:
r
- 指定者:
startReply
在类中AbstractHessianInput
- 抛出:
Throwable
-
completeReply
public void completeReply() throws IOException
Completes reading the callA successful completion will have a single value:
z
- 指定者:
completeReply
在类中AbstractHessianInput
- 抛出:
IOException
-
completeValueReply
public void completeValueReply() throws IOException
Completes reading the callA successful completion will have a single value:
z
- 抛出:
IOException
-
readHeader
public String readHeader() throws IOException
Reads a header, returning null if there are no headers.H b16 b8 value
- 指定者:
readHeader
在类中AbstractHessianInput
- 抛出:
IOException
-
startMessage
public int startMessage() throws IOException
Starts reading the messagep major minor
- 抛出:
IOException
-
completeMessage
public void completeMessage() throws IOException
Completes reading the messageA successful completion will have a single value:
z
- 抛出:
IOException
-
readNull
public void readNull() throws IOException
Reads a nullN
- 指定者:
readNull
在类中AbstractHessianInput
- 抛出:
IOException
-
readBoolean
public boolean readBoolean() throws IOException
Reads a booleanT F
- 指定者:
readBoolean
在类中AbstractHessianInput
- 抛出:
IOException
-
readShort
public short readShort() throws IOException
Reads a shortI b32 b24 b16 b8
- 抛出:
IOException
-
readInt
public final int readInt() throws IOException
Reads an integerI b32 b24 b16 b8
- 指定者:
readInt
在类中AbstractHessianInput
- 抛出:
IOException
-
readLong
public long readLong() throws IOException
Reads a longL b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
readLong
在类中AbstractHessianInput
- 抛出:
IOException
-
readFloat
public float readFloat() throws IOException
Reads a floatD b64 b56 b48 b40 b32 b24 b16 b8
- 抛出:
IOException
-
readDouble
public double readDouble() throws IOException
Reads a doubleD b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
readDouble
在类中AbstractHessianInput
- 抛出:
IOException
-
readUTCDate
public long readUTCDate() throws IOException
Reads a date.T b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
readUTCDate
在类中AbstractHessianInput
- 抛出:
IOException
-
readChar
public int readChar() throws IOException
Reads a byte from the stream.- 抛出:
IOException
-
readString
public int readString(char[] buffer, int offset, int length) throws IOException
Reads a byte array from the stream.- 抛出:
IOException
-
readString
public String readString() throws IOException
Reads a stringS b16 b8 string value
- 指定者:
readString
在类中AbstractHessianInput
- 抛出:
IOException
-
readBytes
public byte[] readBytes() throws IOException
Reads a byte arrayB b16 b8 data value
- 指定者:
readBytes
在类中AbstractHessianInput
- 抛出:
IOException
-
readByte
public int readByte() throws IOException
Reads a byte from the stream.- 抛出:
IOException
-
readBytes
public int readBytes(byte[] buffer, int offset, int length) throws IOException
Reads a byte array from the stream.- 抛出:
IOException
-
readObject
public Object readObject(Class cl) throws IOException
Reads an object from the input stream with an expected type.- 指定者:
readObject
在类中AbstractHessianInput
- 参数:
cl
- the expected class if the protocol doesn't supply it.- 抛出:
IOException
-
readObject
public Object readObject(Class expectedClass, Class<?>... expectedTypes) throws IOException
从类复制的说明:AbstractHessianInput
Reads an arbitrary object from the input stream.- 覆盖:
readObject
在类中AbstractHessianInput
- 参数:
expectedClass
- the expected class if the protocol doesn't supply it.expectedTypes
- the runtime type hints, eg: expectedClass equals Map, expectedTypes can equals String.class, Short.class- 抛出:
IOException
-
readObject
public Object readObject() throws IOException
Reads an arbitrary object from the input stream when the type is unknown.- 指定者:
readObject
在类中AbstractHessianInput
- 抛出:
IOException
-
readObject
public Object readObject(List<Class<?>> expectedTypes) throws IOException
从类复制的说明:AbstractHessianInput
Reads an arbitrary object from the input stream.- 覆盖:
readObject
在类中AbstractHessianInput
- 参数:
expectedTypes
- the runtime type hints, eg: expectedTypes can equals String.class, Short.class for HashMap- 抛出:
IOException
-
readRemote
public Object readRemote() throws IOException
Reads a remote object.- 指定者:
readRemote
在类中AbstractHessianInput
- 抛出:
IOException
-
readRef
public Object readRef() throws IOException
Reads a reference.- 指定者:
readRef
在类中AbstractHessianInput
- 抛出:
IOException
-
readListStart
public int readListStart() throws IOException
Reads the start of a list.- 指定者:
readListStart
在类中AbstractHessianInput
- 抛出:
IOException
-
readMapStart
public int readMapStart() throws IOException
Reads the start of a list.- 指定者:
readMapStart
在类中AbstractHessianInput
- 抛出:
IOException
-
isEnd
public boolean isEnd() throws IOException
Returns true if this is the end of a list or a map.- 指定者:
isEnd
在类中AbstractHessianInput
- 抛出:
IOException
-
readEnd
public void readEnd() throws IOException
Reads the end byte.- 指定者:
readEnd
在类中AbstractHessianInput
- 抛出:
IOException
-
readMapEnd
public void readMapEnd() throws IOException
Reads the end byte.- 指定者:
readMapEnd
在类中AbstractHessianInput
- 抛出:
IOException
-
readListEnd
public void readListEnd() throws IOException
Reads the end byte.- 指定者:
readListEnd
在类中AbstractHessianInput
- 抛出:
IOException
-
addRef
public int addRef(Object ref)
Adds a list/map reference.- 指定者:
addRef
在类中AbstractHessianInput
-
setRef
public void setRef(int i, Object ref)
Adds a list/map reference.- 指定者:
setRef
在类中AbstractHessianInput
-
resetReferences
public void resetReferences()
Resets the references for streaming.- 覆盖:
resetReferences
在类中AbstractHessianInput
-
readStreamingObject
public Object readStreamingObject() throws IOException
- 抛出:
IOException
-
resolveRemote
public Object resolveRemote(String type, String url) throws IOException
Resolves a remote object.- 抛出:
IOException
-
readType
public String readType() throws IOException
Parses a type from the stream.type ::= string type ::= int
- 指定者:
readType
在类中AbstractHessianInput
- 抛出:
IOException
-
readLength
public int readLength() throws IOException
Parses the length for an arrayl b32 b24 b16 b8
- 指定者:
readLength
在类中AbstractHessianInput
- 抛出:
IOException
-
readInputStream
public InputStream readInputStream() throws IOException
Reads bytes based on an input stream.- 指定者:
readInputStream
在类中AbstractHessianInput
- 抛出:
IOException
-
read
public final int read() throws IOException
Normally, shouldn't be called externally, but needed for QA, e.g. ejb/3b01.- 抛出:
IOException
-
getReader
public Reader getReader()
从类复制的说明:AbstractHessianInput
Starts reading a string. All the characters must be read before calling the next method. The actual characters will be read with the reader's read() or read(char [], int, int).s b16 b8 non-final string chunk S b16 b8 final string chunk
- 指定者:
getReader
在类中AbstractHessianInput
-
close
public void close() throws IOException
- 覆盖:
close
在类中AbstractHessianInput
- 抛出:
IOException
-
-