TinyLine 2.3

com.tinyline.util
Class TinyInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.tinyline.util.TinyInputStream
All Implemented Interfaces:
java.io.Closeable

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.1

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.
 TinyColor readTinyColor()
          Reads a TinyColor object.
 TinyFont readTinyFont()
          Reads a TinyFont object.
 TinyMatrix readTinyMatrix()
          Reads a TinyMatrix object.
 TinyPaint readTinyPaint()
          Reads a TinyPaint object.
 TinyPath readTinyPath()
          Reads a TinyPath object.
 TinyRect readTinyRect()
          Reads a TinyRect 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

align

public final void align()
Aligns the stream


available

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

Overrides:
available in class java.io.InputStream
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.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException - if an I/O error has occurred

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.

Specified by:
read in class java.io.InputStream
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.

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

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

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

readTinyColor

public TinyColor readTinyColor()
                        throws java.io.IOException
Reads a TinyColor object.

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

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.

readTinyMatrix

public TinyMatrix readTinyMatrix()
                          throws java.io.IOException
Reads a TinyMatrix object.

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

readTinyPaint

public TinyPaint readTinyPaint()
                        throws java.io.IOException
Reads a TinyPaint object.

Returns:
the TinyPaint 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.

readTinyRect

public TinyRect readTinyRect()
                      throws java.io.IOException
Reads a TinyRect object.

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

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

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

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

skip

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

Overrides:
skip in class java.io.InputStream
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

TinyLine 2.3

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