com.pmstation.spss.reader
Class SPSSInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.pmstation.spss.reader.SPSSInputStream
All Implemented Interfaces:
java.io.Closeable

public class SPSSInputStream
extends java.io.InputStream

A bit extended stream to read bytes, strings, doubles and ints from SPSS save file


Constructor Summary
SPSSInputStream(java.io.InputStream in, java.lang.String charset)
          Instantiates a new SPSS input stream.
 
Method Summary
 int available()
          returns available from underlying stream
 void close()
          closes underlying stream
 void mark(int readlimit)
          mark underlying stream
 boolean markSupported()
           
 int read()
          read byte from underlying stream
 int read(byte[] b)
          read b.length bytes from underlying stream
 int read(byte[] b, int off, int len)
          read len bytes from underlying stream storing them at off offset into b array
 double readDouble()
          Read double from stream.
 float readFloat()
          Read float.
 int readInt()
          Read int from underlying stream.
 long readLong()
          Read long from stream.
 java.lang.String readString()
          Read string.
 java.lang.String readString(int length)
          Read string of specified length.
 void reset()
          resets underlying stream
 long skip(long n)
          skips n bytes in underlying stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPSSInputStream

public SPSSInputStream(java.io.InputStream in,
                       java.lang.String charset)
Instantiates a new SPSS input stream.

Parameters:
in - underlying stream
charset - charset
Method Detail

read

public int read()
         throws java.io.IOException
read byte from underlying stream

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
returns available from underlying stream

Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
closes underlying stream

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

mark

public void mark(int readlimit)
mark underlying stream

Overrides:
mark in class java.io.InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream
Returns:
if mark supported by underlying stream

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
read len bytes from underlying stream storing them at off offset into b array

Overrides:
read in class java.io.InputStream
Returns:
actually bytes read
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
read b.length bytes from underlying stream

Overrides:
read in class java.io.InputStream
Returns:
actually bytes read
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
resets underlying stream

Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
skips n bytes in underlying stream

Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Read int from underlying stream. It is assumed low-to-high bytes order

Returns:
the int
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

readString

public java.lang.String readString(int length)
                            throws java.io.IOException
Read string of specified length.

Parameters:
length - the length
Returns:
the string
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

readString

public java.lang.String readString()
                            throws java.io.IOException
Read string. It is assumed that length of the string written in first 4 bytes as integer.

Returns:
the string
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

readDouble

public double readDouble()
                  throws java.io.IOException
Read double from stream. It is assumed that double stored as longBits with low bytes coming first

Returns:
the double
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

readLong

public long readLong()
              throws java.io.IOException
Read long from stream. It is assumed that low bytes coming first

Returns:
the long
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

readFloat

public float readFloat()
                throws java.io.IOException
Read float. It is assumed that float stored as intBits with low bytes coming first

Returns:
the float
Throws:
java.io.IOException - Signals that an I/O exception has occurred.


Copyright © 2003-2004 pmStation.com. All Rights Reserved.