Package io.github.astrapi69.file.write
Class WriteFileExtensions
java.lang.Object
io.github.astrapi69.file.write.WriteFileExtensions
The class
WriteFileExtensions
provides methods for writing in files.-
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendLines
(File file, String... lineToAppend) Deprecated.static void
readSourceFileAndWriteDestFile
(String srcfile, String destFile) Deprecated.UseCopyFileExtensions.copyFile(File, File)
instead.static void
string2File
(String string2write, String nameOfFile) Deprecated.UseStoreFileExtensions.toFile(File, String)
instead.static void
write
(InputStream inputStream, OutputStream outputStream) Deprecated.UseStreamExtensions.writeInputStreamToOutputStream(InputStream, OutputStream)
insteadstatic void
write2File
(Reader reader, Writer writer) Deprecated.UseStreamExtensions.writeReaderToWriter(Reader, Writer)
instead.static void
write2File
(String inputFile, Writer writer) Deprecated.UseStoreFileExtensions.toFile(File, String)
instead.static void
write2File
(String inputFile, String outputFile) Deprecated.UseCopyFileExtensions.copyFile(File, File)
instead.static void
write2FileWithBuffer
(String inputFile, String outputFile) Deprecated.UseStoreFileExtensions.toFile(File, String)
instead.static void
writeByteArrayToFile
(File file, byte[] byteArray) Deprecated.static void
writeByteArrayToFile
(String filename, byte[] byteArray) Deprecated.static void
writeLinesToFile
(File output, List<String> input, String encoding) Deprecated.static void
writeLinesToFile
(Collection<String> lines, File output) Deprecated.static void
writeLinesToFile
(Collection<String> lines, File output, String encoding) Deprecated.static void
writeProperties2File
(String filename, Properties properties) Deprecated.UsePropertiesExtensions.export(Properties, OutputStream)
-
Method Details
-
appendLines
Deprecated.UseLineAppender.appendLines(File, String...)
instead.Appends the given lines to the givenFile
object- Parameters:
file
- The source filelineToAppend
- The lines to append- Throws:
IOException
- Signals that an I/O exception has occurred.
-
readSourceFileAndWriteDestFile
@Deprecated public static void readSourceFileAndWriteDestFile(String srcfile, String destFile) throws IOException Deprecated.UseCopyFileExtensions.copyFile(File, File)
instead.Writes the source file with the best performance to the destination file.- Parameters:
srcfile
- The source file.destFile
- The destination file.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
string2File
@Deprecated public static void string2File(String string2write, String nameOfFile) throws IOException Deprecated.UseStoreFileExtensions.toFile(File, String)
instead.The Method string2File() writes a String to the file.- Parameters:
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.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
write
@Deprecated public static void write(InputStream inputStream, OutputStream outputStream) throws FileNotFoundException, IOException Deprecated.UseStreamExtensions.writeInputStreamToOutputStream(InputStream, OutputStream)
insteadWrites the given input stream to the output stream.- Parameters:
inputStream
- the input streamoutputStream
- the output stream- Throws:
FileNotFoundException
- is thrown if the given file is not foundIOException
- Signals that an I/O exception has occurred.
-
write2File
Deprecated.UseStreamExtensions.writeReaderToWriter(Reader, Writer)
instead.The Method write2File() reads from an opened Reader and writes it to the opened Writer.- Parameters:
reader
- The opened Reader.writer
- The opened Writer.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
write2File
Deprecated.UseCopyFileExtensions.copyFile(File, File)
instead.The Method write2File(String, String) copys a file from one filename to another.- Parameters:
inputFile
- The Name from the File to read and copy.outputFile
- The Name from the File to write into.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
write2File
@Deprecated public static void write2File(String inputFile, Writer writer) throws FileNotFoundException, IOException Deprecated.UseStoreFileExtensions.toFile(File, String)
instead.The Method write2File() writes the File into the PrintWriter.- Parameters:
inputFile
- The Name from the File to read and copy.writer
- The PrintWriter to write into.- Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failed.IOException
- Signals that an I/O exception has occurred.
-
write2FileWithBuffer
@Deprecated public static void write2FileWithBuffer(String inputFile, String outputFile) throws FileNotFoundException, IOException Deprecated.UseStoreFileExtensions.toFile(File, String)
instead.The Method write2FileWithBuffer() copy the content from one file to another. It use a buffer as the name says.- Parameters:
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.- Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failed.IOException
- Signals that an I/O exception has occurred.
-
writeByteArrayToFile
Deprecated.Writes the given byte array to the given file.- Parameters:
file
- The file.byteArray
- The byte array.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
writeByteArrayToFile
@Deprecated public static void writeByteArrayToFile(String filename, byte[] byteArray) throws IOException Deprecated.Writes the given byte array to a file.- Parameters:
filename
- The filename from the file.byteArray
- The byte array.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
writeLinesToFile
@Deprecated public static void writeLinesToFile(Collection<String> lines, File output) throws FileNotFoundException, IOException Deprecated.Writes the input from the lines into the file.- Parameters:
lines
- The lines to write to file.output
- The output-file.- Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failed.IOException
- Signals that an I/O exception has occurred.
-
writeLinesToFile
@Deprecated public static void writeLinesToFile(Collection<String> lines, File output, String encoding) throws FileNotFoundException, IOException Deprecated.Writes the input from the lines into the file.- Parameters:
lines
- The lines to write to file.output
- The output-file.encoding
- the encoding- Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failed.IOException
- Signals that an I/O exception has occurred.
-
writeLinesToFile
@Deprecated public static void writeLinesToFile(File output, List<String> input, String encoding) throws FileNotFoundException, IOException Deprecated.Writes the input from the collection into the file.- Parameters:
output
- The file to write the lines.input
- The list with the input data.encoding
- The encoding.- Throws:
FileNotFoundException
- is thrown if an attempt to open the file denoted by a specified pathname has failed.IOException
- Signals that an I/O exception has occurred.
-
writeProperties2File
@Deprecated public static void writeProperties2File(String filename, Properties properties) throws IOException Deprecated.UsePropertiesExtensions.export(Properties, OutputStream)
The Method writeProperties2File(String, Properties) writes the Properties to the file.- Parameters:
filename
- The filename from the file to write the properties.properties
- The properties.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
LineAppender.appendLines(File, String...)
instead.