Class BurlapInput


  • public class BurlapInput
    extends AbstractBurlapInput
    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
     
    • Constructor Detail

      • BurlapInput

        public BurlapInput()
        Creates an uninitialized Burlap input stream.
      • BurlapInput

        public BurlapInput​(java.io.InputStream is)
        Creates a new Burlap input stream, initialized with an underlying input stream.
        Parameters:
        is - the underlying input stream.
    • Method Detail

      • getSerializerFactory

        public SerializerFactory getSerializerFactory()
        Gets the serializer factory.
      • init

        public void init​(java.io.InputStream is)
        Initialize the burlap stream with the underlying input stream.
        Overrides:
        init in class AbstractHessianInput
      • getReplyFault

        public java.lang.Throwable getReplyFault()
        Returns any reply fault.
      • startCall

        public void startCall()
                       throws java.io.IOException
        Starts reading the call
         <burlap:call>
         <method>method</method>
         
        Specified by:
        startCall in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readCall

        public int readCall()
                     throws java.io.IOException
        Starts reading the call

        A successful completion will have a single value:

         <burlap:call>
         
        Specified by:
        readCall in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readMethod

        public java.lang.String readMethod()
                                    throws java.io.IOException
        Reads the method
         <method>method</method>
         
        Specified by:
        readMethod in class AbstractHessianInput
        Throws:
        java.io.IOException
      • completeCall

        public void completeCall()
                          throws java.io.IOException
        Completes reading the call

        A successful completion will have a single value:

         </burlap:call>
         
        Specified by:
        completeCall in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readReply

        public java.lang.Object readReply​(java.lang.Class expectedClass)
                                   throws java.lang.Throwable
        Reads a reply as an object. If the reply has a fault, throws the exception.
        Specified by:
        readReply in class AbstractHessianInput
        Throws:
        java.lang.Throwable
      • startReply

        public void startReply()
                        throws java.lang.Throwable
        Starts reading the reply

        A successful completion will have a single value:

         <burlap:reply>
         <value>
         
        Specified by:
        startReply in class AbstractHessianInput
        Throws:
        java.lang.Throwable
      • completeReply

        public void completeReply()
                           throws java.io.IOException
        Completes reading the call

        A successful completion will have a single value:

         </burlap:reply>
         
        Specified by:
        completeReply in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readHeader

        public java.lang.String readHeader()
                                    throws java.io.IOException
        Reads a header, returning null if there are no headers.
         <header>value</header>
         
        Specified by:
        readHeader in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readNull

        public void readNull()
                      throws java.io.IOException
        Reads a null
         <null></null>
         
        Specified by:
        readNull in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readBoolean

        public boolean readBoolean()
                            throws java.io.IOException
        Reads a boolean
         <boolean>0</boolean>
         <boolean>1</boolean>
         
        Specified by:
        readBoolean in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readByte

        public byte readByte()
                      throws java.io.IOException
        Reads a byte
         <int>value</int>
         
        Throws:
        java.io.IOException
      • readShort

        public short readShort()
                        throws java.io.IOException
        Reads a short
         <int>value</int>
         
        Throws:
        java.io.IOException
      • readInt

        public int readInt()
                    throws java.io.IOException
        Reads an integer
         <int>value</int>
         
        Specified by:
        readInt in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readLong

        public long readLong()
                      throws java.io.IOException
        Reads a long
         <long>value</long>
         
        Specified by:
        readLong in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readFloat

        public float readFloat()
                        throws java.io.IOException
        Reads a float
         <double>value</double>
         
        Throws:
        java.io.IOException
      • readDouble

        public double readDouble()
                          throws java.io.IOException
        Reads a double
         <double>value</double>
         
        Specified by:
        readDouble in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readUTCDate

        public long readUTCDate()
                         throws java.io.IOException
        Reads a date.
         <date>ISO-8609 date</date>
         
        Specified by:
        readUTCDate in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readLocalDate

        public long readLocalDate()
                           throws java.io.IOException
        Reads a date.
         <date>ISO-8609 date</date>
         
        Throws:
        java.io.IOException
      • readString

        public java.lang.String readString()
                                    throws java.io.IOException
        Reads a string
         <string>value</string>
         
        Specified by:
        readString in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readNode

        public org.w3c.dom.Node readNode()
                                  throws java.io.IOException
        Reads an XML node.
         &xml;xml string</xml>
         
        Overrides:
        readNode in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readBytes

        public byte[] readBytes()
                         throws java.io.IOException
        Reads a byte array
         <base64>...</base64>
         
        Specified by:
        readBytes in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readLength

        public int readLength()
                       throws java.io.IOException
        Reads a length
         <length>value</length>
         
        Specified by:
        readLength in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readObject

        public java.lang.Object readObject​(java.lang.Class cl)
                                    throws java.io.IOException
        Reads an object from the input stream with an expected type.
        Specified by:
        readObject in class AbstractHessianInput
        Parameters:
        cl - the expected class if the protocol doesn't supply it.
        Throws:
        java.io.IOException
      • readObject

        public java.lang.Object readObject()
                                    throws java.io.IOException
        Reads an arbitrary object from the input stream when the type is unknown.
        Specified by:
        readObject in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readRemote

        public java.lang.Object readRemote()
                                    throws java.io.IOException
        Reads a remote object.
        Specified by:
        readRemote in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readRef

        public java.lang.Object readRef()
                                 throws java.io.IOException
        Reads a reference.
        Specified by:
        readRef in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readListStart

        public int readListStart()
                          throws java.io.IOException
        Reads the start of a list.
        Specified by:
        readListStart in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readMapStart

        public int readMapStart()
                         throws java.io.IOException
        Reads the start of a map.
        Specified by:
        readMapStart in class AbstractHessianInput
        Throws:
        java.io.IOException
      • isEnd

        public boolean isEnd()
                      throws java.io.IOException
        Returns true if this is the end of a list or a map.
        Specified by:
        isEnd in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readEnd

        public void readEnd()
                     throws java.io.IOException
        Reads the end byte.
        Specified by:
        readEnd in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readMapEnd

        public void readMapEnd()
                        throws java.io.IOException
        Reads the end of the map
        Specified by:
        readMapEnd in class AbstractHessianInput
        Throws:
        java.io.IOException
      • readListEnd

        public void readListEnd()
                         throws java.io.IOException
        Reads the end of the map
        Specified by:
        readListEnd in class AbstractHessianInput
        Throws:
        java.io.IOException
      • addRef

        public int addRef​(java.lang.Object ref)
        Adds a list/map reference.
        Specified by:
        addRef in class AbstractHessianInput
      • setRef

        public void setRef​(int i,
                           java.lang.Object ref)
        Adds a list/map reference.
        Specified by:
        setRef in class AbstractHessianInput
      • resolveRemote

        public java.lang.Object resolveRemote​(java.lang.String type,
                                              java.lang.String url)
                                       throws java.io.IOException
        Resolves a remote object.
        Throws:
        java.io.IOException
      • readType

        public java.lang.String readType()
                                  throws java.io.IOException
        Parses a type from the stream.
         <type>type</type>
         
        Specified by:
        readType in class AbstractHessianInput
        Throws:
        java.io.IOException
      • parseDate

        protected long parseDate()
                          throws java.io.IOException
        Parses a date value from the stream.
        Throws:
        java.io.IOException
      • parseDate

        protected long parseDate​(java.util.Calendar calendar)
                          throws java.io.IOException
        Parses a date value from the stream.
        Throws:
        java.io.IOException
      • parseString

        protected java.lang.String parseString()
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • parseString

        protected java.lang.StringBuffer parseString​(java.lang.StringBuffer sbuf)
                                              throws java.io.IOException
        Parses a string value from the stream. The burlap object's string buffer is used for the result.
        Throws:
        java.io.IOException
      • parseBytes

        protected byte[] parseBytes()
                             throws java.io.IOException
        Parses a byte array.
        Throws:
        java.io.IOException
      • parseBytes

        protected java.io.ByteArrayOutputStream parseBytes​(java.io.ByteArrayOutputStream bos)
                                                    throws java.io.IOException
        Parses a byte array.
        Throws:
        java.io.IOException
      • expectTag

        public void expectTag​(int expectTag)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • parseTag

        protected int parseTag()
                        throws java.io.IOException
        Parses a tag. Returns true if it's a start tag.
        Throws:
        java.io.IOException
      • skipWhitespace

        protected int skipWhitespace()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • isWhitespace

        protected boolean isWhitespace​(int ch)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • getReader

        public java.io.Reader 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 class AbstractHessianInput
      • readInputStream

        public java.io.InputStream 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 class AbstractHessianInput
      • getInputStream

        public java.io.InputStream getInputStream()
      • expectBeginTag

        protected java.io.IOException expectBeginTag​(java.lang.String expect,
                                                     java.lang.String tag)
      • expectedChar

        protected java.io.IOException expectedChar​(java.lang.String expect,
                                                   int ch)
      • expectedTag

        protected java.io.IOException expectedTag​(java.lang.String expect,
                                                  int tag)
      • error

        protected java.io.IOException error​(java.lang.String message)
      • tagName

        protected static java.lang.String tagName​(int tag)