|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.io.FileManager
public class FileManager
This class is for handling File
s. The most important methods of this
class are for writing a StringBuffer
to or reading it from a
File
. This is useful for all objects that implement
Storable
and should be saved in or loaded from a
File
.
Storable
,
File
Method Summary | |
---|---|
static void |
copy(String from,
String to)
This method copies a File in a faster manner. |
static void |
copy(String from,
String to,
byte[] buffer)
This method copies a File in a faster manner using a specified
buffer. |
static int |
copyDiff(File source,
File target,
Date date,
boolean recursive,
FileFilter filter)
This method copies all File s and directories, if selected, from a
source File , i.e. directory, to a
target File , i.e. directory, that have been modified
after a predefined date . |
static StringBuffer |
read(Reader reader)
This method reads a StringBuffer from a given Reader . |
static StringBuffer |
readFile(File file)
This method reads a StringBuffer from a given File . |
static StringBuffer |
readInputStream(InputStream inputStream)
This method reads a StringBuffer from a given InputStream . |
static void |
writeFile(File outputFile,
StringBuffer buffer)
This method saves a StringBuffer to a given File . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int copyDiff(File source, File target, Date date, boolean recursive, FileFilter filter) throws IllegalArgumentException, IOException
File
s and directories, if selected, from a
source
File
, i.e. directory, to a
target
File
, i.e. directory, that have been modified
after a predefined date
.
source
- the source directory denoted as File
target
- the target directory denoted as File
date
- the Date
recursive
- indicates if this method should be used recursively in the
subdirectoriesfilter
- a FileFilter
for the File
s that enables the
user to copy only specific File
s
File
s
IllegalArgumentException
- if source
and target
are not
directories
IOException
- if something went wrong while copying the File
s and
directoriesFile
,
Date
,
FileFilter
public static void copy(String from, String to) throws IOException
File
in a faster manner.
from
- the File
name of the original fileto
- the File
name of the copied file
IOException
- if something went wrongcopy(String, String, byte[])
public static void copy(String from, String to, byte[] buffer) throws IOException
File
in a faster manner using a specified
buffer.
from
- the File
name of the original fileto
- the File
name of the copied filebuffer
- an array for reading the content of the original File
,
the size of the array determines how many byte
s
are read at once
IOException
- if something went wrongpublic static StringBuffer readFile(File file) throws IOException
StringBuffer
from a given File
.
file
- the File
to be read
StringBuffer
with the content of the File
IOException
- if something went wrong with the File
writeFile(File, StringBuffer)
,
read(Reader)
,
FileReader
public static StringBuffer readInputStream(InputStream inputStream) throws IOException
StringBuffer
from a given InputStream
.
inputStream
- the InputStream
to be read
StringBuffer
with the content of the InputStream
IOException
- if something went wrong with the InputStream
writeFile(File, StringBuffer)
,
read(Reader)
,
InputStreamReader
public static StringBuffer read(Reader reader) throws IOException
StringBuffer
from a given Reader
.
reader
- the Reader
to be read
StringBuffer
with the content of the Reader
IOException
- if something went wrong with the Reader
writeFile(File, StringBuffer)
,
BufferedReader
public static void writeFile(File outputFile, StringBuffer buffer) throws IOException
StringBuffer
to a given File
.
outputFile
- the File
into which the output should be writtenbuffer
- the buffer to be written in the File
IOException
- if something went wrong with the File
readFile(File)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |