Table of Contents

Class StreamUtil

Namespace
iText.IO.Util
Assembly
itext.io.dll

This file is a helper class for internal usage only.

public sealed class StreamUtil
Inheritance
StreamUtil
Inherited Members

Remarks

This file is a helper class for internal usage only. Be aware that its API and functionality may be changed in future.

Methods

CopyBytes(IRandomAccessSource, long, long, Stream)

Copy bytes from the RandomAccessSource to OutputStream.

public static void CopyBytes(IRandomAccessSource source, long start, long length, Stream output)

Parameters

source IRandomAccessSource

the RandomAccessSource copy from.

start long

start position of source copy from.

length long

length copy to.

output Stream

the OutputStream copy to.

CreateBufferedEscapedString(byte[])

public static ByteBuffer CreateBufferedEscapedString(byte[] bytes)

Parameters

bytes byte[]

Returns

ByteBuffer

CreateBufferedHexedString(byte[])

public static ByteBuffer CreateBufferedHexedString(byte[] bytes)

Parameters

bytes byte[]

Returns

ByteBuffer

CreateEscapedString(byte[])

Escapes a byte array according to the PDF conventions.

public static byte[] CreateEscapedString(byte[] bytes)

Parameters

bytes byte[]

the byte array to escape

Returns

byte[]

an escaped byte array

InputStreamToArray(Stream)

Reads the full content of a stream and returns them in a byte array

public static byte[] InputStreamToArray(Stream stream)

Parameters

stream Stream

the stream to read

Returns

byte[]

a byte array containing all of the bytes from the stream

ReadFully(Stream, byte[], int, int)

Reads len bytes from an input stream.

public static void ReadFully(Stream input, byte[] b, int off, int len)

Parameters

input Stream
b byte[]

the buffer into which the data is read.

off int

an int specifying the offset into the data.

len int

an int specifying the number of bytes to read.

Skip(Stream, long)

This method is an alternative for the InputStream.skip() -method that doesn't seem to work properly for big values of size.

public static void Skip(Stream stream, long size)

Parameters

stream Stream

the InputStream

size long

the number of bytes to skip

TransferBytes(Stream, Stream)

public static void TransferBytes(Stream input, Stream output)

Parameters

input Stream
output Stream

TransferBytes(RandomAccessFileOrArray, Stream)

public static void TransferBytes(RandomAccessFileOrArray input, Stream output)

Parameters

input RandomAccessFileOrArray
output Stream

WriteEscapedString(Stream, byte[])

Escapes a byte array according to the PDF conventions.

public static void WriteEscapedString(Stream outputStream, byte[] bytes)

Parameters

outputStream Stream

the OutputStream an escaped byte array write to.

bytes byte[]

the byte array to escape.

WriteHexedString(Stream, byte[])

public static void WriteHexedString(Stream outputStream, byte[] bytes)

Parameters

outputStream Stream
bytes byte[]