public final class IOHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IOHelper.OutputReadThread
This class reads the output of the process.
|
Modifier and Type | Method and Description |
---|---|
static void |
closeResource(Closeable resource)
Closes the provided resource.
|
static byte[] |
convertStringToBinary(String text,
String encoding)
This function converts the provided string to binary data.
|
static Reader |
createReader(InputStream inputStream,
String encoding)
This function creates and returns a new reader for the provided input stream.
|
static Writer |
createWriter(OutputStream outputStream,
String encoding)
This function creates and returns a new writer for the provided output stream.
|
static String |
getDefaultEncoding()
This function returns the system default encoding.
|
static File |
getFax4jInternalTemporaryDirectory()
This function returns the fax4j library internal temporary directory.
|
static File |
getFileFromNativePath(String fileNameWithNoPath)
This function returns the file object of the first location in which the requested file is found.
|
static File |
getFileFromPathList(String fileNameWithNoPath,
String[] pathList)
This function returns the file object of the first location in which the requested file is found.
|
static void |
readAndWriteStreams(InputStream inputStream,
OutputStream outputStream)
Reads the data from the input stream and writes to the output stream.
|
static byte[] |
readFile(File file)
Reads the data from the file.
|
static byte[] |
readStream(InputStream inputStream)
Reads the data from the stream.
|
static String |
readTextFile(File file)
Reads the text from the file.
|
static String |
readTextStream(Reader reader)
Reads the text from the stream.
|
static void |
writeFile(byte[] content,
File file)
Writes the content to the file.
|
static void |
writeTextFile(String text,
File file)
Writes the text to the file.
|
public static String getDefaultEncoding()
public static File getFax4jInternalTemporaryDirectory()
public static byte[] convertStringToBinary(String text, String encoding)
text
- The text to convertencoding
- The text encodingpublic static void closeResource(Closeable resource)
resource
- The resource to closepublic static Reader createReader(InputStream inputStream, String encoding)
inputStream
- The input streamencoding
- The encoding used by the reader (null for default system encoding)public static Writer createWriter(OutputStream outputStream, String encoding)
outputStream
- The output streamencoding
- The encoding used by the writer (null for default system encoding)public static String readTextStream(Reader reader) throws IOException
reader
- The reader to the textIOException
- Any IO exceptionpublic static String readTextFile(File file) throws IOException
file
- The text fileIOException
- Any IO exceptionpublic static void writeTextFile(String text, File file) throws IOException
text
- The text to write to the provided filefile
- The text fileIOException
- Any IO exceptionpublic static void readAndWriteStreams(InputStream inputStream, OutputStream outputStream) throws IOException
inputStream
- The inputStream to read fromoutputStream
- The output stream to write toIOException
- Any IO exceptionpublic static byte[] readStream(InputStream inputStream) throws IOException
inputStream
- The inputStreamIOException
- Any IO exceptionpublic static byte[] readFile(File file) throws IOException
file
- The fileIOException
- Any IO exceptionpublic static void writeFile(byte[] content, File file) throws IOException
content
- The content to write to the provided filefile
- The target fileIOException
- Any IO exceptionpublic static File getFileFromPathList(String fileNameWithNoPath, String[] pathList)
fileNameWithNoPath
- The file name (with no directory path)pathList
- The path listpublic static File getFileFromNativePath(String fileNameWithNoPath)
fileNameWithNoPath
- The file name (with no directory path)Copyright © 2009–2020 fax4j. All rights reserved.