TinyLine
v2.0

com.tinyline.util
Class TinyInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.tinyline.util.TinyInputStream

public final class TinyInputStream
extends java.io.InputStream

A data input stream lets an application read primitive TinyLine 2D data types from an input stream.

Version:
2.0
Author:
Andrew Girow

Constructor Summary
TinyInputStream(java.io.InputStream in)
          Creates a new input stream with a default buffer size.
 
Method Summary
 void align()
          Aligns the stream
 int available()
          Returns the number of bytes that can be read from this input stream without blocking.
 void close()
          Closes the input stream.
 int read()
          Reads the next byte of data from the input stream.
 boolean readBoolean()
          Reads a boolean value.
 int readSB(int n)
          Reads a signed n-bit value.
 short readSI16()
          Reads a signed integer 16-bit value.
 int readSI32()
          Reads a signed integer 32-bit value.
 byte readSI8()
          Reads a signed integer 8-bit value.
 TinyFont readTinyFont()
          Reads a TinyFont object.
 TinyPath readTinyPath()
          Reads a TinyPath object.
 TinyString readTinyString()
          Reads a TinyString
 int readUB(int n)
          Reads an unsigned n-bit value.
 int readUI16()
          Reads an unsigned integer 16-bit value.
 int readUI32()
          Reads an unsigned integer 32-bit value.
 short readUI8()
          Reads an unsigned integer 8-bit value.
 long skip(long n)
          Skips the specified number of bytes.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, read, reset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TinyInputStream

public TinyInputStream(java.io.InputStream in)
Creates a new input stream with a default buffer size.

Parameters:
in - the input stream
Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
java.io.IOException - if an I/O error occurs.

available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read from this input stream without blocking.

Returns:
the number of bytes that can be read from the input in without blocking.
Throws:
java.io.IOException - if an I/O error occurs.

close

public void close()
           throws java.io.IOException
Closes the input stream.

Throws:
java.io.IOException - if an I/O error has occurred

skip

public long skip(long n)
          throws java.io.IOException
Skips the specified number of bytes.

Parameters:
n - the number of bytes to skip. Maximum the Integer.MAX_VALUE number of bytes to skip is allowed.
Returns:
the actual number of bytes skipped.
Throws:
java.io.IOException - if an I/O error has occurred

align

public final void align()
Aligns the stream


readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Reads a boolean value.

Returns:
a bollean value
Throws:
java.io.IOException - if an I/O error has occurred

readSI16

public short readSI16()
               throws java.io.IOException
Reads a signed integer 16-bit value.

Returns:
a signed integer 16-bit value
Throws:
java.io.IOException - if an I/O error has occurred

readSI32

public int readSI32()
             throws java.io.IOException
Reads a signed integer 32-bit value.

Returns:
a signed integer 32-bit value
Throws:
java.io.IOException - if an I/O error has occurred

readSI8

public byte readSI8()
             throws java.io.IOException
Reads a signed integer 8-bit value.

Returns:
a signed integer 8-bit value
Throws:
java.io.IOException - if an I/O error has occurred

readSB

public int readSB(int n)
           throws java.io.IOException
Reads a signed n-bit value.

Parameters:
n - the number of bits to be read
Returns:
a signed n-bit value.
Throws:
java.io.IOException - if an I/O error has occurred

readTinyString

public TinyString readTinyString()
                          throws java.io.IOException
Reads a TinyString

Returns:
a TinyString object
Throws:
java.io.IOException - if an I/O error has occurred

readUI16

public int readUI16()
             throws java.io.IOException
Reads an unsigned integer 16-bit value.

Returns:
an unsigned integer 16-bit value.
Throws:
java.io.IOException - if an I/O error has occurred

readUI32

public int readUI32()
             throws java.io.IOException
Reads an unsigned integer 32-bit value.

Returns:
an unsigned integer 32-bit value.
Throws:
java.io.IOException - if an I/O error has occurred

readUI8

public short readUI8()
              throws java.io.IOException
Reads an unsigned integer 8-bit value.

Returns:
an unsigned integer 8-bit value
Throws:
java.io.IOException - if an I/O error has occurred

readUB

public int readUB(int n)
           throws java.io.IOException
Reads an unsigned n-bit value.

Parameters:
n - the number of bits to be read
Returns:
an unsigned n-bit value.
Throws:
java.io.IOException - if an I/O error has occurred

readTinyFont

public TinyFont readTinyFont()
                      throws java.io.IOException
Reads a TinyFont object.

Returns:
the TinyFont object.
Throws:
java.io.IOException - if an I/O error occurs.

readTinyPath

public TinyPath readTinyPath()
                      throws java.io.IOException
Reads a TinyPath object.

Returns:
the TinyPath object.
Throws:
java.io.IOException - if an I/O error occurs.

TinyLine
v2.0

Provided under the terms of the TinyLine License Agreement that has been included with this distribution