hultig.io
Class FileIN

java.lang.Object
  extended by java.io.File
      extended by hultig.io.FileIN
All Implemented Interfaces:
Serializable, Comparable<File>

public class FileIN
extends File

NOT YET WELL COMMENTED. *

Copyright: Copyright (c) 2007

Company: UBI/HULTIG

See Also:
Serialized Form

Field Summary
protected  BufferedReader br
           
protected  String encode
           
static Toolkit to
           
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
FileIN(String fname)
          Constructor.
 
Method Summary
 void close()
          Close the current file
 int countNumLines()
          Count the number of lines in this file.
 String getEncoding()
          Return the current encoding.
static void main(String[] args)
          MAIN - Just for testing.
 void open()
          Open/reopen this file.
static void print(String[] v)
          Output a static array of strings.
 String read()
          Read the next line from the opened text.
 String[] read(int limit)
          Read a maximum amount of strings, from this file.
 String[] readAll()
          Read all strings from file.
 String[] readPattern(String pattern)
          Read all strings that matches a given regular expression.
 void setEncoding(String encode)
          Set the encoding.
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

br

protected BufferedReader br

encode

protected String encode

to

public static Toolkit to
Constructor Detail

FileIN

public FileIN(String fname)
Constructor. Sets the encoding for the default, which is ISO-8858-1

Parameters:
fname - String
Method Detail

getEncoding

public String getEncoding()
Return the current encoding.

Returns:
String

setEncoding

public void setEncoding(String encode)
Set the encoding.

Parameters:
encode - String

open

public void open()
Open/reopen this file.


close

public void close()
Close the current file


countNumLines

public int countNumLines()
Count the number of lines in this file.

Returns:
The number of lines counted. The file will end closed!.

readAll

public String[] readAll()
Read all strings from file.

Returns:
String[]

read

public String read()
Read the next line from the opened text.

Returns:
The line read or else the null value.

read

public String[] read(int limit)
Read a maximum amount of strings, from this file.

Parameters:
limit - int
Returns:
String[]

readPattern

public String[] readPattern(String pattern)
Read all strings that matches a given regular expression.

Parameters:
pattern - String
Returns:
String[]

print

public static void print(String[] v)
Output a static array of strings.

Parameters:
v - String[]

main

public static void main(String[] args)
MAIN - Just for testing.

Parameters:
args - String[]