DLV.io
Class RandomAccessCharacterFile

java.lang.Object
  extended by DLV.io.RandomAccessCharacterFile

public class RandomAccessCharacterFile
extends java.lang.Object

This class allows to access a text file in random access. This class supports fixed size encodings. In other words, it works only if in the specified encoding each character maps in k byte andtop vice versa.
This class works with Unicode and UnicodeBig encodings but is not tested with other encodings that have byte order marks at the beginning of the file. UTF encoding (and similar) are not supported

Version:
1.0
Author:
Francesco Ricca

Constructor Summary
RandomAccessCharacterFile(java.lang.String file, java.lang.String encoding)
           
RandomAccessCharacterFile(java.lang.String file, java.lang.String encoding, int cbSize)
           
 
Method Summary
static void allignMark(java.lang.String inputFile, java.lang.String outFile, java.lang.String encoding)
           
 void close()
           
 void flush()
           
 int getBufferSize()
           
 java.lang.String getEncoding()
           
 long getFilePointer()
           
 long getLength()
           
 java.lang.String getName()
           
 int read()
           
 void seek(long n)
           
 void setLength(long len)
           
 void write(char c)
           
 void writeString(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomAccessCharacterFile

public RandomAccessCharacterFile(java.lang.String file,
                                 java.lang.String encoding,
                                 int cbSize)
                          throws java.io.IOException
Throws:
java.io.IOException

RandomAccessCharacterFile

public RandomAccessCharacterFile(java.lang.String file,
                                 java.lang.String encoding)
                          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getName

public java.lang.String getName()

getBufferSize

public int getBufferSize()

allignMark

public static void allignMark(java.lang.String inputFile,
                              java.lang.String outFile,
                              java.lang.String encoding)
                       throws java.io.IOException
Throws:
java.io.IOException

getEncoding

public java.lang.String getEncoding()

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

writeString

public void writeString(java.lang.String s)
                 throws java.io.IOException
Throws:
java.io.IOException

getFilePointer

public long getFilePointer()
                    throws java.io.IOException
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

write

public void write(char c)
           throws java.io.IOException
Throws:
java.io.IOException

seek

public void seek(long n)
          throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

getLength

public long getLength()
               throws java.io.IOException
Throws:
java.io.IOException

setLength

public void setLength(long len)
               throws java.io.IOException
Throws:
java.io.IOException