Jetif v1.8.0

jetif.ext
Class TextFile

java.lang.Object
  extended byjetif.ext.TextFile

public class TextFile
extends Object

This class TextFile provides a easy way to get a Writer to a text file.

Author:
Vicky Wang

Constructor Summary
TextFile(File file)
          Construct from a file object and system encoding.
TextFile(File file, String enc)
          Construct from a file object and encoding.
TextFile(String filename, String enc)
          Construct from file name and encoding.
 
Method Summary
 Reader getReader()
          Get a reader to this text file.
 Writer getWriter(boolean append)
          Get the writer to this text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFile

public TextFile(String filename,
                String enc)
Construct from file name and encoding.

Parameters:
filename - the file name.
enc - the encoding

TextFile

public TextFile(File file)
Construct from a file object and system encoding.

Parameters:
file -

TextFile

public TextFile(File file,
                String enc)
Construct from a file object and encoding.

Parameters:
file - the file object
enc - the encoding
Method Detail

getWriter

public Writer getWriter(boolean append)
                 throws IOException
Get the writer to this text file. The caller should close the writer when writting completed.

Parameters:
append - true to append the file end.
Returns:
a writer to this text file.
Throws:
IOException

getReader

public Reader getReader()
                 throws IOException
Get a reader to this text file. The caller should close the reader when reading completed.

Returns:
the reader to the file.
Throws:
IOException - if I/O error occurs.

Jetif v1.8.0

Copyright © 2004,2005 Vicky Wang - All Rights Reserved.