Package com.caucho.burlap.io
Class BurlapInput
java.lang.Object
com.caucho.hessian.io.AbstractHessianInput
com.caucho.burlap.io.AbstractBurlapInput
com.caucho.burlap.io.BurlapInput
Input stream for Burlap requests.
BurlapInput is unbuffered, so any client needs to provide its own buffering.
InputStream is = ...; // from http connection BurlapInput in = new BurlapInput(is); String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuffer
protected Calendar
protected int
protected ArrayList
protected StringBuffer
protected SerializerFactory
protected Calendar
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an uninitialized Burlap input stream.Creates a new Burlap input stream, initialized with an underlying input stream. -
Method Summary
Modifier and TypeMethodDescriptionint
Adds a list/map reference.void
Completes reading the callvoid
Completes reading the callprotected IOException
protected IOException
expectBeginTag
(String expect, String tag) protected IOException
expectedChar
(String expect, int ch) protected IOException
expectedTag
(String expect, int tag) void
expectTag
(int expectTag) Returns the calls methodStarts reading a string.Returns any reply fault.Gets the serializer factory.void
init
(InputStream is) Initialize the burlap stream with the underlying input stream.boolean
isEnd()
Returns true if this is the end of a list or a map.protected boolean
isWhitespace
(int ch) protected byte[]
Parses a byte array.protected ByteArrayOutputStream
Parses a byte array.protected long
Parses a date value from the stream.protected long
Parses a date value from the stream.protected String
protected StringBuffer
parseString
(StringBuffer sbuf) Parses a string value from the stream.protected int
parseTag()
Parses a tag.boolean
Reads a booleanbyte
readByte()
Reads a bytebyte[]
Reads a byte arrayint
readCall()
Starts reading the calldouble
Reads a doublevoid
readEnd()
Reads the end byte.float
Reads a floatReads a header, returning null if there are no headers.Starts reading a byte array using an input stream.int
readInt()
Reads an integerint
Reads a lengthvoid
Reads the end of the mapint
Reads the start of a list.long
Reads a date.long
readLong()
Reads a longvoid
Reads the end of the mapint
Reads the start of a map.Reads the methodreadNode()
Reads an XML node.void
readNull()
Reads a nullReads an arbitrary object from the input stream when the type is unknown.readObject
(Class cl) Reads an object from the input stream with an expected type.readRef()
Reads a reference.Reads a remote object.Reads a reply as an object.short
Reads a shortReads a stringreadType()
Parses a type from the stream.long
Reads a date.resolveRemote
(String type, String url) Resolves a remote object.void
Adds a list/map reference.void
setSerializerFactory
(SerializerFactory factory) Sets the serializer factory.protected int
void
Starts reading the callvoid
Starts reading the replyprotected static String
tagName
(int tag) Methods inherited from class com.caucho.hessian.io.AbstractHessianInput
close, getRemoteResolver, readMethodArgLength, readToOutputStream, resetReferences, setRemoteResolver, skipOptionalCall, startReplyBody
-
Field Details
-
TAG_EOF
public static final int TAG_EOF- See Also:
-
TAG_NULL
public static final int TAG_NULL- See Also:
-
TAG_BOOLEAN
public static final int TAG_BOOLEAN- See Also:
-
TAG_INT
public static final int TAG_INT- See Also:
-
TAG_LONG
public static final int TAG_LONG- See Also:
-
TAG_DOUBLE
public static final int TAG_DOUBLE- See Also:
-
TAG_DATE
public static final int TAG_DATE- See Also:
-
TAG_STRING
public static final int TAG_STRING- See Also:
-
TAG_XML
public static final int TAG_XML- See Also:
-
TAG_BASE64
public static final int TAG_BASE64- See Also:
-
TAG_MAP
public static final int TAG_MAP- See Also:
-
TAG_LIST
public static final int TAG_LIST- See Also:
-
TAG_TYPE
public static final int TAG_TYPE- See Also:
-
TAG_LENGTH
public static final int TAG_LENGTH- See Also:
-
TAG_REF
public static final int TAG_REF- See Also:
-
TAG_REMOTE
public static final int TAG_REMOTE- See Also:
-
TAG_CALL
public static final int TAG_CALL- See Also:
-
TAG_REPLY
public static final int TAG_REPLY- See Also:
-
TAG_FAULT
public static final int TAG_FAULT- See Also:
-
TAG_METHOD
public static final int TAG_METHOD- See Also:
-
TAG_HEADER
public static final int TAG_HEADER- See Also:
-
TAG_NULL_END
public static final int TAG_NULL_END- See Also:
-
TAG_BOOLEAN_END
public static final int TAG_BOOLEAN_END- See Also:
-
TAG_INT_END
public static final int TAG_INT_END- See Also:
-
TAG_LONG_END
public static final int TAG_LONG_END- See Also:
-
TAG_DOUBLE_END
public static final int TAG_DOUBLE_END- See Also:
-
TAG_DATE_END
public static final int TAG_DATE_END- See Also:
-
TAG_STRING_END
public static final int TAG_STRING_END- See Also:
-
TAG_XML_END
public static final int TAG_XML_END- See Also:
-
TAG_BASE64_END
public static final int TAG_BASE64_END- See Also:
-
TAG_MAP_END
public static final int TAG_MAP_END- See Also:
-
TAG_LIST_END
public static final int TAG_LIST_END- See Also:
-
TAG_TYPE_END
public static final int TAG_TYPE_END- See Also:
-
TAG_LENGTH_END
public static final int TAG_LENGTH_END- See Also:
-
TAG_REF_END
public static final int TAG_REF_END- See Also:
-
TAG_REMOTE_END
public static final int TAG_REMOTE_END- See Also:
-
TAG_CALL_END
public static final int TAG_CALL_END- See Also:
-
TAG_REPLY_END
public static final int TAG_REPLY_END- See Also:
-
TAG_FAULT_END
public static final int TAG_FAULT_END- See Also:
-
TAG_METHOD_END
public static final int TAG_METHOD_END- See Also:
-
TAG_HEADER_END
public static final int TAG_HEADER_END- See Also:
-
_serializerFactory
-
_refs
-
_peek
protected int _peek -
_sbuf
-
_entityBuffer
-
_utcCalendar
-
_localCalendar
-
-
Constructor Details
-
BurlapInput
public BurlapInput()Creates an uninitialized Burlap input stream. -
BurlapInput
Creates a new Burlap input stream, initialized with an underlying input stream.- Parameters:
is
- the underlying input stream.
-
-
Method Details
-
setSerializerFactory
Sets the serializer factory.- Overrides:
setSerializerFactory
in classAbstractHessianInput
-
getSerializerFactory
Gets the serializer factory. -
init
Initialize the burlap stream with the underlying input stream.- Overrides:
init
in classAbstractHessianInput
-
getMethod
Returns the calls method- Specified by:
getMethod
in classAbstractHessianInput
-
getReplyFault
Returns any reply fault. -
startCall
Starts reading the call<burlap:call> <method>method</method>
- Specified by:
startCall
in classAbstractHessianInput
- Throws:
IOException
-
readCall
Starts reading the callA successful completion will have a single value:
<burlap:call>
- Specified by:
readCall
in classAbstractHessianInput
- Throws:
IOException
-
readMethod
Reads the method<method>method</method>
- Specified by:
readMethod
in classAbstractHessianInput
- Throws:
IOException
-
completeCall
Completes reading the callA successful completion will have a single value:
</burlap:call>
- Specified by:
completeCall
in classAbstractHessianInput
- Throws:
IOException
-
readReply
Reads a reply as an object. If the reply has a fault, throws the exception.- Specified by:
readReply
in classAbstractHessianInput
- Throws:
Throwable
-
startReply
Starts reading the replyA successful completion will have a single value:
<burlap:reply> <value>
- Specified by:
startReply
in classAbstractHessianInput
- Throws:
Throwable
-
completeReply
Completes reading the callA successful completion will have a single value:
</burlap:reply>
- Specified by:
completeReply
in classAbstractHessianInput
- Throws:
IOException
-
readHeader
Reads a header, returning null if there are no headers.<header>value</header>
- Specified by:
readHeader
in classAbstractHessianInput
- Throws:
IOException
-
readNull
Reads a null<null></null>
- Specified by:
readNull
in classAbstractHessianInput
- Throws:
IOException
-
readBoolean
Reads a boolean<boolean>0</boolean> <boolean>1</boolean>
- Specified by:
readBoolean
in classAbstractHessianInput
- Throws:
IOException
-
readByte
Reads a byte<int>value</int>
- Throws:
IOException
-
readShort
Reads a short<int>value</int>
- Throws:
IOException
-
readInt
Reads an integer<int>value</int>
- Specified by:
readInt
in classAbstractHessianInput
- Throws:
IOException
-
readLong
Reads a long<long>value</long>
- Specified by:
readLong
in classAbstractHessianInput
- Throws:
IOException
-
readFloat
Reads a float<double>value</double>
- Throws:
IOException
-
readDouble
Reads a double<double>value</double>
- Specified by:
readDouble
in classAbstractHessianInput
- Throws:
IOException
-
readUTCDate
Reads a date.<date>ISO-8609 date</date>
- Specified by:
readUTCDate
in classAbstractHessianInput
- Throws:
IOException
-
readLocalDate
Reads a date.<date>ISO-8609 date</date>
- Throws:
IOException
-
readString
Reads a string<string>value</string>
- Specified by:
readString
in classAbstractHessianInput
- Throws:
IOException
-
readNode
Reads an XML node.&xml;xml string</xml>
- Overrides:
readNode
in classAbstractHessianInput
- Throws:
IOException
-
readBytes
Reads a byte array<base64>...</base64>
- Specified by:
readBytes
in classAbstractHessianInput
- Throws:
IOException
-
readLength
Reads a length<length>value</length>
- Specified by:
readLength
in classAbstractHessianInput
- Throws:
IOException
-
readObject
Reads an object from the input stream with an expected type.- Specified by:
readObject
in classAbstractHessianInput
- Parameters:
cl
- the expected class if the protocol doesn't supply it.- Throws:
IOException
-
readObject
Reads an arbitrary object from the input stream when the type is unknown.- Specified by:
readObject
in classAbstractHessianInput
- Throws:
IOException
-
readRemote
Reads a remote object.- Specified by:
readRemote
in classAbstractHessianInput
- Throws:
IOException
-
readRef
Reads a reference.- Specified by:
readRef
in classAbstractHessianInput
- Throws:
IOException
-
readListStart
Reads the start of a list.- Specified by:
readListStart
in classAbstractHessianInput
- Throws:
IOException
-
readMapStart
Reads the start of a map.- Specified by:
readMapStart
in classAbstractHessianInput
- Throws:
IOException
-
isEnd
Returns true if this is the end of a list or a map.- Specified by:
isEnd
in classAbstractHessianInput
- Throws:
IOException
-
readEnd
Reads the end byte.- Specified by:
readEnd
in classAbstractHessianInput
- Throws:
IOException
-
readMapEnd
Reads the end of the map- Specified by:
readMapEnd
in classAbstractHessianInput
- Throws:
IOException
-
readListEnd
Reads the end of the map- Specified by:
readListEnd
in classAbstractHessianInput
- Throws:
IOException
-
addRef
Adds a list/map reference.- Specified by:
addRef
in classAbstractHessianInput
-
setRef
Adds a list/map reference.- Specified by:
setRef
in classAbstractHessianInput
-
resolveRemote
Resolves a remote object.- Throws:
IOException
-
readType
Parses a type from the stream.<type>type</type>
- Specified by:
readType
in classAbstractHessianInput
- Throws:
IOException
-
parseDate
Parses a date value from the stream.- Throws:
IOException
-
parseDate
Parses a date value from the stream.- Throws:
IOException
-
parseString
- Throws:
IOException
-
parseString
Parses a string value from the stream. The burlap object's string buffer is used for the result.- Throws:
IOException
-
parseBytes
Parses a byte array.- Throws:
IOException
-
parseBytes
Parses a byte array.- Throws:
IOException
-
expectTag
- Throws:
IOException
-
parseTag
Parses a tag. Returns true if it's a start tag.- Throws:
IOException
-
skipWhitespace
- Throws:
IOException
-
isWhitespace
- Throws:
IOException
-
getReader
Description copied from class: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
- Specified by:
getReader
in classAbstractHessianInput
-
readInputStream
Description copied from class:AbstractHessianInput
Starts reading a byte array using an input stream. All the bytes must be read before calling the following method.b b16 b8 non-final binary chunk B b16 b8 final binary chunk
- Specified by:
readInputStream
in classAbstractHessianInput
-
getInputStream
-
expectBeginTag
-
expectedChar
-
expectedTag
-
error
-
tagName
-