| |
|
| java.lang.Object java.io.File org.apache.jorphan.io.TextFile
TextFile | public class TextFile extends File (Code) | | Utility class to handle text files as a single lump of text.
Note this is just as memory-inefficient as handling a text file can be. Use
with restraint.
author: Giles Cope (gilescope at users.sourceforge.net) author: Michael Stover (mstover1 at apache.org) author: Jordi Salvat i Alabart version: $Revision: 533867 $ updated on $Date: 2007-04-30 23:13:40 +0100 (Mon, 30 Apr 2007) $ |
Constructor Summary | |
public | TextFile(File filename, String encoding) Create a TextFile object to handle the named file with the given
encoding. | public | TextFile(File filename) Create a TextFile object to handle the named file with the platform
default encoding. | public | TextFile(String filename) Create a TextFile object to handle the named file with the platform
default encoding. | public | TextFile(String filename, String encoding) Create a TextFile object to handle the named file with the given
encoding. |
Method Summary | |
public String | getEncoding() | public String | getText() Read the whole file content and return it as a string. | public void | setEncoding(String string) | public void | setText(String body) Create the file with the given string as content -- or replace it's
content with the given string if the file already existed. |
TextFile | public TextFile(File filename, String encoding)(Code) | | Create a TextFile object to handle the named file with the given
encoding.
Parameters: filename - File to be read & written through this object. Parameters: encoding - Encoding to be used when reading & writing this file. |
TextFile | public TextFile(File filename)(Code) | | Create a TextFile object to handle the named file with the platform
default encoding.
Parameters: filename - File to be read & written through this object. |
TextFile | public TextFile(String filename)(Code) | | Create a TextFile object to handle the named file with the platform
default encoding.
Parameters: filename - Name of the file to be read & written through this object. |
TextFile | public TextFile(String filename, String encoding)(Code) | | Create a TextFile object to handle the named file with the given
encoding.
Parameters: filename - Name of the file to be read & written through this object. Parameters: encoding - Encoding to be used when reading & writing this file. |
getEncoding | public String getEncoding()(Code) | | Encoding being used to read & write this file. |
getText | public String getText()(Code) | | Read the whole file content and return it as a string.
the content of the file |
setEncoding | public void setEncoding(String string)(Code) | | Parameters: string - Encoding to be used to read & write this file. |
setText | public void setText(String body)(Code) | | Create the file with the given string as content -- or replace it's
content with the given string if the file already existed.
Parameters: body - New content for the file. |
|
|
|