Package com.itextpdf.text.io
Class StreamUtil
- java.lang.Object
-
- com.itextpdf.text.io.StreamUtil
-
public final class StreamUtil extends java.lang.ObjectUtility class with commonly used stream operations- Since:
- 5.3.5
-
-
Constructor Summary
Constructors Modifier Constructor Description privateStreamUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidCopyBytes(RandomAccessSource source, long start, long length, java.io.OutputStream outs)static java.io.InputStreamgetResourceStream(java.lang.String key)Gets the resource's inputstream.static java.io.InputStreamgetResourceStream(java.lang.String key, java.lang.ClassLoader loader)Gets the resource's inputstream .static byte[]inputStreamToArray(java.io.InputStream is)Reads the full content of a stream and returns them in a byte array
-
-
-
Method Detail
-
inputStreamToArray
public static byte[] inputStreamToArray(java.io.InputStream is) throws java.io.IOExceptionReads the full content of a stream and returns them in a byte array- Parameters:
is- the stream to read- Returns:
- a byte array containing all of the bytes from the stream
- Throws:
java.io.IOException- if there is a problem reading from the input stream
-
CopyBytes
public static void CopyBytes(RandomAccessSource source, long start, long length, java.io.OutputStream outs) throws java.io.IOException
- Throws:
java.io.IOException
-
getResourceStream
public static java.io.InputStream getResourceStream(java.lang.String key)
Gets the resource's inputstream.- Parameters:
key- the full name of the resource- Returns:
- the
InputStreamto get the resource ornullif not found
-
getResourceStream
public static java.io.InputStream getResourceStream(java.lang.String key, java.lang.ClassLoader loader)Gets the resource's inputstream .- Parameters:
key- the full name of the resourceloader- the ClassLoader to load the resource or null to try the ones available- Returns:
- the
InputStreamto get the resource ornullif not found
-
-