util
Class DataFile

java.lang.Object
  extended by util.DataFile

public class DataFile
extends java.lang.Object

DataFile provides Stream to read and write to the files.

Author:
shankar

Constructor Summary
DataFile(java.lang.String fileName, java.lang.String type)
          Constructs DataFile object for given file name and mode of opening file like "r", "w" and throws null point exception in read mode
 
Method Summary
 void close()
          Closes the opened Files
 int readInt()
          readInt reads a int bit into memory
 long readLong()
          Reads a long value from the file
 void writeDouble(double bit)
          writeDouble writes a double bit to file or stream
 void writeInt(int bit)
          writeInt writes a int bit to file or stream
 void writeLong(long bit)
          writeLong writes a long bit to file or stream
 void writeString(java.lang.String str)
          writeString writes a String to file or stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFile

public DataFile(java.lang.String fileName,
                java.lang.String type)
         throws java.lang.NullPointerException,
                java.io.IOException
Constructs DataFile object for given file name and mode of opening file like "r", "w" and throws null point exception in read mode

Parameters:
fileName - holds file name of the stream
type -
Throws:
java.lang.NullPointerException
java.io.IOException - if file does not exist or unable to write to the stream
Method Detail

writeInt

public void writeInt(int bit)
              throws java.io.IOException
writeInt writes a int bit to file or stream

Parameters:
bit -
Throws:
java.io.IOException

writeLong

public void writeLong(long bit)
               throws java.io.IOException
writeLong writes a long bit to file or stream

Parameters:
bit -
Throws:
java.io.IOException

writeDouble

public void writeDouble(double bit)
                 throws java.io.IOException
writeDouble writes a double bit to file or stream

Parameters:
bit -
Throws:
java.io.IOException

writeString

public void writeString(java.lang.String str)
                 throws java.io.IOException
writeString writes a String to file or stream

Parameters:
str -
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
readInt reads a int bit into memory

Returns:
bit of int type
Throws:
java.io.IOException - if unable to read from File

readLong

public long readLong()
              throws java.io.IOException
Reads a long value from the file

Returns:
bit long type
Throws:
java.io.IOException - if unable to access

close

public void close()
           throws java.io.IOException
Closes the opened Files

Throws:
java.io.IOException - if the file is not accessible.