public final class WriteFileExtensions
extends java.lang.Object
WriteFileExtensions provides methods for writing in files.| Modifier and Type | Method and Description |
|---|---|
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 boolean |
string2File(java.io.File file,
java.lang.String string2write,
java.lang.String encoding)
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 |
write(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Writes the given input stream to the output stream.
|
static void |
write2File(java.io.Reader reader,
java.io.Writer writer)
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)
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.util.Collection<java.lang.String> collection,
java.io.File output,
java.lang.String encoding)
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.
|
public static void readSourceFileAndWriteDestFile(java.lang.String srcfile,
java.lang.String destFile)
throws java.io.IOException
srcfile - The source file.destFile - The destination file.java.io.IOException - Signals that an I/O exception has occurred.public static void storeByteArrayToFile(byte[] data,
java.io.File file)
throws java.io.IOException
data - The byte array to be saved.file - The file to save the byte array.java.io.IOException - Signals that an I/O exception has occurred.public static boolean string2File(java.io.File file,
java.lang.String string2write)
throws java.io.FileNotFoundException,
java.io.IOException
file - The File to write the String.string2write - The String to write into the File.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.public static boolean string2File(java.io.File file,
java.lang.String string2write,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
file - The File to write the String.string2write - The String to write into the File.encoding - the encodingjava.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.public static void string2File(java.lang.String string2write,
java.lang.String nameOfFile)
throws java.io.IOException
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.java.io.IOException - Signals that an I/O exception has occurred.public static void write(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
throws java.io.FileNotFoundException,
java.io.IOException
inputStream - the input streamoutputStream - the output streamjava.io.FileNotFoundException - the file not found exceptionjava.io.IOException - Signals that an I/O exception has occurred.public static void write2File(java.io.Reader reader,
java.io.Writer writer)
throws java.io.IOException
reader - The opened Reader.writer - The opened Writer.java.io.IOException - Signals that an I/O exception has occurred.public static void write2File(java.lang.String inputFile,
java.lang.String outputFile)
throws java.io.FileNotFoundException,
java.io.IOException
inputFile - The Name from the File to read and copy.outputFile - The Name from the File to write into.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.public static void write2File(java.lang.String inputFile,
java.io.Writer writer)
throws java.io.FileNotFoundException,
java.io.IOException
inputFile - The Name from the File to read and copy.writer - The PrintWriter to write into.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.public static void write2FileWithBuffer(java.lang.String inputFile,
java.lang.String outputFile)
throws java.io.FileNotFoundException,
java.io.IOException
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.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.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)
throws java.io.FileNotFoundException,
java.io.IOException
collection - The collection to write to file.output - The output-file.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.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,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
collection - The collection to write to file.output - The output-file.encoding - the encodingjava.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.public static void writeLinesToFile(java.io.File output,
java.util.List<java.lang.String> input,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
output - The file to write the lines.input - The list with the input data.encoding - The encoding.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.public static void writeProperties2File(java.lang.String filename,
java.util.Properties properties)
throws java.io.IOException
filename - The filename from the file to write the properties.properties - The properties.java.io.IOException - Signals that an I/O exception has occurred.public static boolean writeStringToFile(java.io.File file,
java.lang.String string2write,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
file - The File to write the String.string2write - The String to write into the File.encoding - The encoding from the file.java.io.FileNotFoundException - is thrown if an attempt to open the file denoted by a specified pathname has
failed.java.io.IOException - Signals that an I/O exception has occurred.