org.apache.jorphan.io
Class TextFile
File
org.apache.jorphan.io.TextFile
public class TextFile
extends File
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.
TextFile(File filename) - Create a TextFile object to handle the named file with the platform
default encoding.
|
TextFile(File filename, String encoding) - Create a TextFile object to handle the named file with the given
encoding.
|
TextFile(String filename) - Create a TextFile object to handle the named file with the platform
default encoding.
|
TextFile(String filename, String encoding) - Create a TextFile object to handle the named file with the given
encoding.
|
String | getEncoding()
|
String | getText() - Read the whole file content and return it as a string.
|
void | setEncoding(String string)
|
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)
Create a TextFile object to handle the named file with the platform
default encoding.
filename
- File to be read & written through this object.
TextFile
public TextFile(File filename,
String encoding)
Create a TextFile object to handle the named file with the given
encoding.
filename
- File to be read & written through this object.encoding
- Encoding to be used when reading & writing this file.
TextFile
public TextFile(String filename)
Create a TextFile object to handle the named file with the platform
default encoding.
filename
- Name of the file to be read & written through this object.
TextFile
public TextFile(String filename,
String encoding)
Create a TextFile object to handle the named file with the given
encoding.
filename
- Name of the file to be read & written through this object.encoding
- Encoding to be used when reading & writing this file.
getEncoding
public String getEncoding()
- Encoding being used to read & write this file.
getText
public String getText()
Read the whole file content and return it as a string.
setEncoding
public void setEncoding(String string)
string
- Encoding to be used to read & write this file.
setText
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.
body
- New content for the file.
Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.