Package org.esa.snap.core.util.io
Class IOUtils
java.lang.Object
org.esa.snap.core.util.io.IOUtils
A utility class for I/O related functionality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyBytes(InputStream is, OutputStream os) Reads bytes from the given input stream and writes them to the given output stream until the end of the input stream is reached.static voidcopyBytesAndClose(InputStream is, OutputStream os) CallscopyBytes(java.io.InputStream, java.io.OutputStream)and safely closes both streams.static booleanCreates the specified directory.
-
Constructor Details
-
IOUtils
public IOUtils()
-
-
Method Details
-
copyBytes
Reads bytes from the given input stream and writes them to the given output stream until the end of the input stream is reached.- Parameters:
is- the input streamos- the output stream- Throws:
IOException- if an I/O error occurs
-
copyBytesAndClose
CallscopyBytes(java.io.InputStream, java.io.OutputStream)and safely closes both streams.- Parameters:
is- the input streamos- the output stream- Throws:
IOException- if an I/O error occurs
-
createDir
Creates the specified directory. Does nothing if the directory already exists otherwise it is created. If creation fails, an I/O exception is thrown.- Parameters:
dir- the directory to be created- Returns:
trueif it has been created,falseif the directory already exists- Throws:
IOException- if the directory could not be created
-