gate.creole.morph
Class ReadFile

java.lang.Object
  extended bygate.creole.morph.ReadFile

public class ReadFile
extends Object

Title: ReadFile.java

Description: This class provides methods to read the file (provided by the user) and to have the read access to each and every line separately


Field Summary
private  BufferedReader br
          Instance of BufferedReader used to read the files with UTF-8 encoding
private  ArrayList data
          Stores each line of the file as a separate String in the ArrayList
private  int pointer
          Pointer which keeps track of what line is accessible to the user
 
Constructor Summary
ReadFile(URL fileURL)
          Constructor - Initialise the buffered Reader instance
 
Method Summary
 String getNext()
          This method gives the next available String (line from the file)
 int getPointer()
          Tells the position of the pointer in the file
 boolean hasNext()
          This method tells if next line is available to read
 boolean read()
          Reads the file and stores each line as a separate element in the ArrayList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

br

private BufferedReader br
Instance of BufferedReader used to read the files with UTF-8 encoding


pointer

private int pointer
Pointer which keeps track of what line is accessible to the user


data

private ArrayList data
Stores each line of the file as a separate String in the ArrayList

Constructor Detail

ReadFile

public ReadFile(URL fileURL)
Constructor - Initialise the buffered Reader instance

Method Detail

read

public boolean read()
Reads the file and stores each line as a separate element in the ArrayList

Returns:
true if read operation is successful, false otherwise

hasNext

public boolean hasNext()
This method tells if next line is available to read

Returns:
true if line is available, false otherwise

getNext

public String getNext()
This method gives the next available String (line from the file)

Returns:
line if available, null otherwise

getPointer

public int getPointer()
Tells the position of the pointer in the file

Returns:
line number where the pointer is located in the file