com.pmstation.spss.reader
Class SPSSReader

java.lang.Object
  extended by com.pmstation.spss.reader.SPSSReader

public class SPSSReader
extends java.lang.Object

Reads data from spss file.

Author:
Ivan

Constructor Summary
SPSSReader(java.io.File file, java.lang.String charset)
          Instantiates a new SPSS reader.
SPSSReader(java.io.InputStream in, java.lang.String charset)
          Instantiates a new sPSS reader.
SPSSReader(java.lang.String fileName, java.lang.String charset)
          Instantiates a new SPSS reader.
 
Method Summary
 java.lang.String getCharset()
          Gets the charset.
 double getCompressionBias()
          Gets the compression bias.
 java.util.Date getCreationDate()
          Gets the creation date.
 java.lang.String getFileLabel()
          Gets the file label.
 java.io.InputStream getIn()
          Gets the input stream.
 int getLayoutCode()
          Gets the layout code.
 int getNumberOfCases()
          Gets the number of cases.
 int getNumberOfVariables()
          Gets the number of variables.
 int getOrdinal(SPSSVariable var)
          Gets index of given variable.
 int getOrdinal(java.lang.String varName)
          Gets index of the variable with given name .
 SPSSRecord getRawDictionaryRecord(java.lang.Class cls, int idx)
          Gets the raw dictionary record of specified class.
 java.util.Vector getRawDictionaryRecords()
          Gets the raw dictionary records.
 java.util.Vector getRawDictionaryRecords(java.lang.Class cls)
          Gets the raw dictionary records of specified class.
 java.lang.Object getValue(int ordinal)
          Gets value of specified variable number in last read row.
 java.lang.Object getValue(SPSSVariable var)
          Gets the value for given variable in last read row.
 java.lang.Object getValue(java.lang.String varName)
          Gets the value of variable with given name in last read row.
 java.util.Vector getVariables()
          Gets the variables.
 boolean isCompressed()
          Checks if is compressed.
 boolean read()
          Reads next data row.
 void setCharset(java.lang.String charset)
          Sets the charset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPSSReader

public SPSSReader(java.lang.String fileName,
                  java.lang.String charset)
           throws java.io.IOException
Instantiates a new SPSS reader.

Parameters:
fileName - the file name
charset - the charset
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

SPSSReader

public SPSSReader(java.io.InputStream in,
                  java.lang.String charset)
           throws java.io.IOException
Instantiates a new sPSS reader.

Parameters:
in - Input stream
charset - the charset
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

SPSSReader

public SPSSReader(java.io.File file,
                  java.lang.String charset)
           throws java.io.IOException
Instantiates a new SPSS reader.

Parameters:
file - the file
charset - the charset
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
Method Detail

getIn

public java.io.InputStream getIn()
Gets the input stream. Always returns instance of SPSSInputStream class built over supplied stream

Returns:
instance of SPSSInputStream built over supplied stream

getCharset

public java.lang.String getCharset()
Gets the charset.

Returns:
the charset

setCharset

public void setCharset(java.lang.String charset)
Sets the charset.

Parameters:
charset - the new charset

getNumberOfCases

public int getNumberOfCases()
Gets the number of cases.

Returns:
the number of cases

getNumberOfVariables

public int getNumberOfVariables()
Gets the number of variables.

Returns:
the number of variables

getVariables

public java.util.Vector getVariables()
Gets the variables. Vector contains instances of SPSSVariable class

Returns:
the variables

getRawDictionaryRecords

public java.util.Vector getRawDictionaryRecords()
Gets the raw dictionary records.

Returns:
the raw dictionary records
See Also:
SPSSRecord

getRawDictionaryRecords

public java.util.Vector getRawDictionaryRecords(java.lang.Class cls)
Gets the raw dictionary records of specified class.

Parameters:
cls - the record class
Returns:
the raw dictionary records

getRawDictionaryRecord

public SPSSRecord getRawDictionaryRecord(java.lang.Class cls,
                                         int idx)
Gets the raw dictionary record of specified class.

Parameters:
cls - the record class
idx - the record index in class
Returns:
the raw dictionary record

read

public boolean read()
             throws java.io.IOException
Reads next data row.

Returns:
true, if successful
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

getValue

public java.lang.Object getValue(int ordinal)
Gets value of specified variable number in last read row. Variable numbers corresponds to their indexes in variables vector.

Parameters:
ordinal - variable number
Returns:
the value

getValue

public java.lang.Object getValue(SPSSVariable var)
Gets the value for given variable in last read row.

Parameters:
var - the variable
Returns:
the value

getValue

public java.lang.Object getValue(java.lang.String varName)
Gets the value of variable with given name in last read row.

Parameters:
varName - the variable name
Returns:
the value

getOrdinal

public int getOrdinal(java.lang.String varName)
Gets index of the variable with given name .

Parameters:
varName - the variable name
Returns:
ordinal, if found else -1

getOrdinal

public int getOrdinal(SPSSVariable var)
Gets index of given variable.

Parameters:
var - the variable
Returns:
the ordinal, if found else -1.

getCompressionBias

public double getCompressionBias()
Gets the compression bias.

Returns:
the compression bias

isCompressed

public boolean isCompressed()
Checks if is compressed.

Returns:
true, if is compressed

getCreationDate

public java.util.Date getCreationDate()
Gets the creation date.

Returns:
the creation date

getFileLabel

public java.lang.String getFileLabel()
Gets the file label.

Returns:
the file label

getLayoutCode

public int getLayoutCode()
Gets the layout code.

Returns:
the layout code


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