|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jaulp.file.write.WriteFileUtils
public class WriteFileUtils
The Class WriteFileUtils provides methods for writing in files.
| Constructor Summary | |
|---|---|
WriteFileUtils()
|
|
| Method Summary | |
|---|---|
static java.io.OutputStream |
getOutputStream(java.io.File file)
Gets the output stream from a File object. |
static java.io.OutputStream |
getOutputStream(java.io.File file,
boolean createFile)
Gets the output stream from a File object. |
static java.io.Writer |
getWriter(java.io.File file)
Gets a Writer from the given file object. |
static java.io.Writer |
getWriter(java.io.File file,
java.lang.String encoding,
boolean createFile)
Gets a Writer from the given file object. |
static void |
readSourceFileAndWriteDestFile(java.lang.String srcfile,
java.lang.String destFile)
Writes the source file with the best performance to the destination file. |
static void |
storeByteArrayToFile(byte[] data,
java.io.File file)
Saves a byte array to the given file. |
static boolean |
string2File(java.io.File file,
java.lang.String string2write)
The Method string2File(File, String) writes the String to the File. |
static void |
string2File(java.lang.String string2write,
java.lang.String nameOfFile)
The Method string2File() writes a String to the file. |
static void |
write2File(java.io.Reader reader,
java.io.Writer writer,
boolean closeStream)
The Method write2File() reads from an opened Reader and writes it to the opened Writer. |
static void |
write2File(java.lang.String inputFile,
java.lang.String outputFile)
The Method write2File(String, String) copys a file from one filename to another. |
static void |
write2File(java.lang.String inputFile,
java.io.Writer writer,
boolean closeWriter)
The Method write2File() writes the File into the PrintWriter. |
static void |
write2FileWithBuffer(java.lang.String inputFile,
java.lang.String outputFile)
The Method write2FileWithBuffer() copy the content from one file to another. |
static void |
writeByteArrayToFile(java.io.File file,
byte[] byteArray)
Writes the given byte array to the given file. |
static void |
writeByteArrayToFile(java.lang.String filename,
byte[] byteArray)
Writes the given byte array to a file. |
static void |
writeLinesToFile(java.util.Collection<java.lang.String> collection,
java.io.File output)
Writes the input from the collection into the file. |
static void |
writeLinesToFile(java.io.File output,
java.util.List<java.lang.String> input,
java.lang.String encoding)
Writes the input from the collection into the file. |
static void |
writeProperties2File(java.lang.String filename,
java.util.Properties properties)
The Method writeProperties2File(String, Properties) writes the Properties to the file. |
static boolean |
writeStringToFile(java.io.File file,
java.lang.String string2write,
java.lang.String encoding)
The Method writeStringToFile(File, String, String) writes the String to the File. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WriteFileUtils()
| Method Detail |
|---|
public static java.io.OutputStream getOutputStream(java.io.File file)
throws java.io.IOException
file - the file.
java.io.IOException - Signals that an I/O exception has occurred.
public static java.io.OutputStream getOutputStream(java.io.File file,
boolean createFile)
throws java.io.IOException
file - the filecreateFile - If true and the file does not exist it will be create a new
file.
FileDoesNotExistException - the file does not exist exception
java.io.IOException - Signals that an I/O exception has occurred.
public static java.io.Writer getWriter(java.io.File file)
throws java.io.IOException
file - the file.
java.io.IOException - Signals that an I/O exception has occurred.
public static java.io.Writer getWriter(java.io.File file,
java.lang.String encoding,
boolean createFile)
throws java.io.IOException
file - the fileencoding - The encoding from the file.createFile - the create file
java.io.IOException - Signals that an I/O exception has occurred.
public static void readSourceFileAndWriteDestFile(java.lang.String srcfile,
java.lang.String destFile)
srcfile - The source file.destFile - The destination file.
public static void storeByteArrayToFile(byte[] data,
java.io.File file)
data - The byte array to be saved.file - The file to save the byte array.
public static boolean string2File(java.io.File file,
java.lang.String string2write)
file - The File to write the String.string2write - The String to write into the File.
public static void string2File(java.lang.String string2write,
java.lang.String nameOfFile)
string2write - The String to write into the file.nameOfFile - The path to the file and name from the file from where we want
to write the String.
public static void write2File(java.io.Reader reader,
java.io.Writer writer,
boolean closeStream)
reader - The opened Reader.writer - The opened Writer.closeStream - If true then close the outputStream otherwise keep open.
public static void write2File(java.lang.String inputFile,
java.lang.String outputFile)
inputFile - The Name from the File to read and copy.outputFile - The Name from the File to write into.
public static void write2File(java.lang.String inputFile,
java.io.Writer writer,
boolean closeWriter)
inputFile - The Name from the File to read and copy.writer - The PrintWriter to write into.closeWriter - If true then close the outputStream otherwise keep open.
public static void write2FileWithBuffer(java.lang.String inputFile,
java.lang.String outputFile)
inputFile - The Path to the File and name from the file from where we
read.outputFile - The Path to the File and name from the file from where we want
to write.
public static void writeByteArrayToFile(java.io.File file,
byte[] byteArray)
throws java.io.IOException
file - The file.byteArray - The byte array.
java.io.IOException - Signals that an I/O exception has occurred.
public static void writeByteArrayToFile(java.lang.String filename,
byte[] byteArray)
throws java.io.IOException
filename - The filename from the file.byteArray - The byte array.
java.io.IOException - Signals that an I/O exception has occurred.
public static void writeLinesToFile(java.util.Collection<java.lang.String> collection,
java.io.File output)
collection - The collection to write to file.output - The output-file.
public static void writeLinesToFile(java.io.File output,
java.util.List<java.lang.String> input,
java.lang.String encoding)
output - The file to write the lines.input - The list with the input data.encoding - The encoding.
public static void writeProperties2File(java.lang.String filename,
java.util.Properties properties)
filename - The filename from the file to write the properties.properties - The properties.
public static boolean writeStringToFile(java.io.File file,
java.lang.String string2write,
java.lang.String encoding)
file - The File to write the String.string2write - The String to write into the File.encoding - The encoding from the file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||