Package net.targetr.wtm3.io
Class StreamUtil
java.lang.Object
net.targetr.wtm3.io.StreamUtil
Useful utilities for working with streams.
- Author:
- Dr Michael Gardiner
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The maximum number of bytes to read before automatically aborting. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
readFully
(InputStream in) Reads until end of stream into a byte array.static byte[]
readFully
(InputStream in, int limit) Reads until end of stream or limit into a byte array.
-
Field Details
-
MAX_DATA_LENGTH
public static final int MAX_DATA_LENGTHThe maximum number of bytes to read before automatically aborting.- See Also:
-
-
Constructor Details
-
StreamUtil
public StreamUtil()
-
-
Method Details
-
readFully
Reads until end of stream into a byte array.- Parameters:
in
- stream to read.- Returns:
- filled byte array.
- Throws:
IOException
- An exception occurred while reading.
-
readFully
Reads until end of stream or limit into a byte array.- Parameters:
in
- stream to read.limit
- maximum number of bytes to read.- Returns:
- filled byte array.
- Throws:
IOException
- An exception occurred while reading.
-