public final class ReadFileExtensions extends Object
ReadFileExtensions helps you reading files.| Constructor and Description |
|---|
ReadFileExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static Byte[] |
getFilecontentAsByteObjectArray(File tmpFile)
Get a Byte array from the given file.
|
static String |
inputStream2String(InputStream inputStream)
The Method inputStream2String() reads the data from the InputStream into a String.
|
static String |
inputStream2String(InputStream inputStream,
Charset encoding)
The Method inputStream2String() reads the data from the InputStream into a String.
|
static Reader |
openFileReader(String fileName)
The Method openFileReader() opens a BufferedReader from the given file.
|
static String |
reader2String(Reader reader)
The Method reader2String() reads the data from the Reader into a String.
|
static byte[] |
readFileToBytearray(File file)
Get a byte array from the given file.
|
static String |
readFromFile(File file)
The Method readFromFile() reads the filecontent to a String.
|
static String |
readFromFile(File file,
Charset encoding)
Read from file.
|
static String |
readHeadLine(String inputFile)
The Method readHeadLine() opens the File and reads the first line from the file.
|
static List<String> |
readLinesInList(File input)
Reads every line from the File and puts them to the List.
|
static List<String> |
readLinesInList(File input,
boolean trim)
Reads every line from the File and puts them to the List.
|
static List<String> |
readLinesInList(File input,
Charset encoding)
Reads every line from the File and puts them to the List.
|
static List<String> |
readLinesInList(File input,
Charset encoding,
boolean trim)
Reads every line from the File and puts them to the List.
|
static List<String> |
readLinesInList(InputStream input)
Reads every line from the given InputStream and puts them to the List.
|
static List<String> |
readLinesInList(InputStream input,
boolean trim)
Reads every line from the given InputStream and puts them to the List.
|
static List<String> |
readLinesInList(InputStream input,
Charset encoding,
boolean trim)
Reads every line from the given InputStream and puts them to the List.
|
static Properties |
readPropertiesFromFile(String filename)
The Method readFromFile(String) reads from the properties-file all Properties and saves them
into a Properties-Object.
|
static byte[] |
toByteArray(File tmpFile)
Get a byte array from the given file.
|
static byte[] |
toByteArray(InputStream input)
Get a byte array from the given
InputStream. |
public static Byte[] getFilecontentAsByteObjectArray(File tmpFile) throws IOException
tmpFile - the tmp fileIOException - Signals that an I/O exception has occurred.public static String inputStream2String(InputStream inputStream) throws IOException
inputStream - The InputStream from where we read.IOException - Signals that an I/O exception has occurred.public static String inputStream2String(InputStream inputStream, Charset encoding) throws IOException
inputStream - The InputStream from where we read.encoding - the encodingIOException - Signals that an I/O exception has occurred.public static Reader openFileReader(String fileName) throws IOException
fileName - The file from where to read.IOException - Signals that an I/O exception has occurred.public static String reader2String(Reader reader) throws IOException
reader - The Reader from where we read.IOException - Signals that an I/O exception has occurred.public static byte[] readFileToBytearray(File file) throws IOException
file - The file.IOException - Signals that an I/O exception has occurred.public static String readFromFile(File file) throws IOException
file - The File to read to a String.IOException - Signals that an I/O exception has occurred.public static String readFromFile(File file, Charset encoding) throws IOException
file - the fileencoding - the encodingIOException - Signals that an I/O exception has occurred.public static String readHeadLine(String inputFile) throws FileNotFoundException, IOException
inputFile - The Path to the File and name from the file from where we read.FileNotFoundException - the file not found exceptionIOException - Signals that an I/O exception has occurred.public static List<String> readLinesInList(File input) throws FileNotFoundException, IOException
input - The File from where the input comes.FileNotFoundException - is thrown if the given file is not found.IOException - Signals that an I/O exception has occurred.public static List<String> readLinesInList(File input, boolean trim) throws FileNotFoundException, IOException
input - The File from where the input comes.trim - the flag trim if the lines shell be trimed.FileNotFoundException - is thrown if the given file is not found.IOException - Signals that an I/O exception has occurred.public static List<String> readLinesInList(File input, Charset encoding) throws FileNotFoundException, IOException
input - The File from where the input comes.encoding - the encodingFileNotFoundException - is thrown if the given file is not found.IOException - When a io-problem occurs.public static List<String> readLinesInList(File input, Charset encoding, boolean trim) throws FileNotFoundException, IOException
input - The File from where the input comes.encoding - the charset for readtrim - the flag trim if the lines shell be trimed.FileNotFoundException - is thrown if the given file is not found.IOException - When a io-problem occurs.public static List<String> readLinesInList(InputStream input) throws IOException
input - The InputStream from where the input comes.IOException - When a io-problem occurs.public static List<String> readLinesInList(InputStream input, boolean trim) throws IOException
input - The InputStream from where the input comes.trim - the flag trim if the lines shell be trimed.IOException - When a io-problem occurs.public static List<String> readLinesInList(InputStream input, Charset encoding, boolean trim) throws IOException
input - The InputStream from where the input comes.encoding - the charset for readtrim - the flag trim if the lines shell be trimed.IOException - When a io-problem occurs.public static Properties readPropertiesFromFile(String filename) throws IOException
filename - The Filename from the Properties-file.IOException - Signals that an I/O exception has occurred.public static byte[] toByteArray(File tmpFile) throws IOException
tmpFile - The file.IOException - Signals that an I/O exception has occurred.public static byte[] toByteArray(InputStream input) throws IOException
InputStream.input - The InputStream.IOException - Signals that an I/O exception has occurred.NullPointerException - if the input is nullCopyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.