Package org.forgerock.util
Class Streams
java.lang.Object
org.forgerock.util.Streams
Utility methods for operating on IO streams.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
readAtMost
(InputStream in, int maximumSize) Reads at most the given number of bytes from the input stream.
-
Method Details
-
readAtMost
Reads at most the given number of bytes from the input stream. The input stream is not closed after this operation, allowing the caller to determine if more bytes are still available. This method takes care not to allocate more storage than is necessary if the input stream may be significantly smaller than the maximum size.- Parameters:
in
- the input stream to read from.maximumSize
- the maximum number of bytes to read from the input stream.- Returns:
- the bytes read from the input stream.
- Throws:
IOException
- if an error occurs while reading the stream.
-