public final class StreamUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
copyBytes(IRandomAccessSource source, long start, long length, OutputStream output)
Copy bytes from the RandomAccessSource to OutputStream.
|
static ByteBuffer |
createBufferedEscapedString(byte[] bytes) |
static ByteBuffer |
createBufferedHexedString(byte[] bytes) |
static byte[] |
createEscapedString(byte[] bytes)
Escapes a byte array according to the PDF conventions.
|
static byte[] |
inputStreamToArray(InputStream stream)
Reads the full content of a stream and returns them in a byte array
|
static void |
readFully(InputStream input, byte[] b, int off, int len)
Reads len bytes from an input stream.
|
static void |
skip(InputStream stream, long size)
This method is an alternative for the InputStream.skip() -method that doesn't seem to work properly for big values of size .
|
static void |
transferBytes(InputStream input, OutputStream output) |
static void |
transferBytes(RandomAccessFileOrArray input, OutputStream output) |
static void |
writeEscapedString(OutputStream outputStream, byte[] bytes)
Escapes a byte array according to the PDF conventions.
|
static void |
writeHexedString(OutputStream outputStream, byte[] bytes) |
public static void skip(InputStream stream, long size) throws IOException
InputStream.skip() -method that doesn't seem to work properly for big values of size .
stream - the InputStream
size - the number of bytes to skip
IOException
public static byte[] createEscapedString(byte[] bytes)
byte array according to the PDF conventions.
bytes - the byte array to escape
byte array
public static void writeEscapedString(OutputStream outputStream, byte[] bytes)
byte array according to the PDF conventions.
outputStream - the OutputStream an escaped byte array write to.
bytes - the byte> array to escape.
public static void writeHexedString(OutputStream outputStream, byte[] bytes)
public static ByteBuffer createBufferedEscapedString(byte[] bytes)
public static ByteBuffer createBufferedHexedString(byte[] bytes)
public static void transferBytes(InputStream input, OutputStream output) throws IOException
IOException
public static void transferBytes(RandomAccessFileOrArray input, OutputStream output) throws IOException
IOException
public static byte[] inputStreamToArray(InputStream stream) throws IOException
stream - the stream to read
IOException - if there is a problem reading from the input stream
public static void copyBytes(IRandomAccessSource source, long start, long length, OutputStream output) throws IOException
RandomAccessSource to OutputStream.
source - the RandomAccessSource copy from.
start - start position of source copy from.
length - length copy to.
output - the OutputStream copy to.
IOException - on error.
public static void readFully(InputStream input, byte[] b, int off, int len) throws IOException
len bytes from an input stream.
b - the buffer into which the data is read.
off - an int specifying the offset into the data.
len - an int specifying the number of bytes to read.
EOFException - if this stream reaches the end before reading all the bytes.
IOException - if an I/O error occurs.
Copyright © 1998–2017 iText Group NV. All rights reserved.