anvil.core
Class Unserializer

java.lang.Object
  |
  +--anvil.core.Unserializer

public final class Unserializer
extends java.lang.Object

Class for wrapping byte array and pointer to it.

Version:
$Revision: 1.23 $
Author:
Jani Lehtimäki

Constructor Summary
protected Unserializer(Context context, byte[] data)
           
protected Unserializer(Context context, byte[] data, int begin, int end)
           
 
Method Summary
 void back()
           
 void close()
           
 void consume(int ch)
           
 boolean consumeIf(int ch)
           
 java.lang.Object consumeRegisteredIf()
           
 int get()
           
 java.lang.String getBinaryString()
           
 char getCharUTF16()
           
 Context getContext()
           
 double getDouble()
          Helper method for unserializing Double.
 float getFloat()
          Helper method for unserializing float.
 long getLong()
          Helper method for unserializing integer.
 java.lang.String getUTF16String()
          Helper method for unserializing String.
 java.lang.String getView()
           
 int peek()
           
 void register(java.lang.Object o)
           
 Any unserialize()
          Helper method which actually does the serialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Unserializer

protected Unserializer(Context context,
                       byte[] data)
                throws UnserializationException

Unserializer

protected Unserializer(Context context,
                       byte[] data,
                       int begin,
                       int end)
                throws UnserializationException
Method Detail

getContext

public Context getContext()
                   throws UnserializationException
UnserializationException

register

public void register(java.lang.Object o)

close

public void close()

peek

public int peek()

back

public void back()

getView

public java.lang.String getView()

get

public int get()
        throws UnserializationException
UnserializationException

consume

public void consume(int ch)
             throws UnserializationException
UnserializationException

consumeRegisteredIf

public java.lang.Object consumeRegisteredIf()
                                     throws UnserializationException
UnserializationException

consumeIf

public boolean consumeIf(int ch)
                  throws UnserializationException
UnserializationException

unserialize

public final Any unserialize()
                      throws UnserializationException
Helper method which actually does the serialization.

Returns:
Unserialized value
Throws:
UnserializationException - If data has been corrupted

getUTF16String

public final java.lang.String getUTF16String()
                                      throws UnserializationException
Helper method for unserializing String. This method uses deprecated API when instantiating new Strings for the purposes of efficiency.

Returns:
Unserialized String
Throws:
UnserializationException - If data has been corrupted

getBinaryString

public final java.lang.String getBinaryString()
                                       throws UnserializationException
UnserializationException

getLong

public final long getLong()
                   throws UnserializationException
Helper method for unserializing integer.

Returns:
Unserialized integer
Throws:
UnserializationException - If data has been corrupted

getDouble

public final double getDouble()
                       throws UnserializationException
Helper method for unserializing Double.

Returns:
Unserialized Double
Throws:
UnserializationException - If data has been corrupted

getFloat

public final float getFloat()
                     throws UnserializationException
Helper method for unserializing float.

Returns:
Unserialized float
Throws:
UnserializationException - If data has been corrupted

getCharUTF16

public char getCharUTF16()
                  throws UnserializationException
UnserializationException