Package org.apache.commons.crypto.utils
Class IoUtils
java.lang.Object
org.apache.commons.crypto.utils.IoUtils
General utility methods for working with IO.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Closes the Closeable objects and ignore anyIOException
or null pointers.static void
closeQuietly
(Closeable closeable) Closes the givenCloseable
quietly by ignoring IOException.static void
readFully
(InputStream in, byte[] buf, int off, int len) Does the readFully based on the Input read.static void
Does the readFully based on Input's positioned read.
-
Constructor Details
-
IoUtils
private IoUtils()The private constructor ofIoUtils
.
-
-
Method Details
-
cleanup
Closes the Closeable objects and ignore anyIOException
or null pointers. Must only be used for cleanup in exception handlers.- Parameters:
closeables
- the objects to close.
-
closeQuietly
Closes the givenCloseable
quietly by ignoring IOException.- Parameters:
closeable
- The resource to close.- Since:
- 1.1.0
-
readFully
public static void readFully(Input in, long position, byte[] buffer, int offset, int length) throws IOException Does the readFully based on Input's positioned read. This does not change the current offset of the stream and is thread-safe.- Parameters:
in
- the input source.position
- the given position.buffer
- the buffer to be read.offset
- the start offset in array buffer.length
- the maximum number of bytes to read.- Throws:
IOException
- if an I/O error occurs.
-
readFully
Does the readFully based on the Input read.- Parameters:
in
- the input stream of bytes.buf
- the buffer to be read.off
- the start offset in array buffer.len
- the maximum number of bytes to read.- Throws:
IOException
- if an I/O error occurs.
-