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 voidCloses the Closeable objects and ignore anyIOExceptionor null pointers.static voidcloseQuietly(Closeable closeable) Closes the givenCloseablequietly by ignoring IOException.static voidreadFully(InputStream in, byte[] buf, int off, int len) Does the readFully based on the Input read.static voidDoes 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 anyIOExceptionor null pointers. Must only be used for cleanup in exception handlers.- Parameters:
closeables- the objects to close.
-
closeQuietly
-
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.
-