|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.diasparsoftware.gsbase.StreamUtil
Provides some utility methods for working with streams.
Constructor Summary | |
StreamUtil()
|
Method Summary | |
static byte[] |
flattenByteSegments(java.util.List byteSegments,
int eachSegmentButLastLength,
int lastSegmentLength)
Turns a List of equally-sized byte segments (buffers) into a single buffer by concatenating them one by one. |
static byte[] |
getContentAsBytes(java.io.InputStream byteStream)
Reads the content coming from the specified input stream and presents it as an array of bytes. |
static java.lang.String |
getContentAsString(java.io.InputStream characterStream)
Reads the content coming from the specified input stream and presents it as a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StreamUtil()
Method Detail |
public static java.lang.String getContentAsString(java.io.InputStream characterStream) throws java.io.IOException
java.io.IOException
- Thrown by the underlying I/O operationspublic static byte[] getContentAsBytes(java.io.InputStream byteStream) throws java.io.IOException
java.io.IOException
- Thrown by the underlying I/O operationspublic static byte[] flattenByteSegments(java.util.List byteSegments, int eachSegmentButLastLength, int lastSegmentLength)
byteSegments
- The buffers to "flatten"eachSegmentButLastLength
- The length of each buffer
but the last -- they are assumed all to be the same sizelastSegmentLength
- The length of the last buffer,
since it is likely not the same length as the others
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |