APIdia Launch Partner
Top Description Constructors Methods
sun.security.util

public Class IOUtils

extends Object
Class Inheritance
Imports
java.io.EOFException, .IOException, .InputStream

IOUtils: A collection of IO-related public static methods.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

bytes read
readExactlyNBytes
(InputStream
input stream, must not be null
is
,
int
number of bytes to read
length
)

Read exactly length of bytes from in.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

IOUtilsback to summary
public IOUtils()

Method Detail

readExactlyNBytesback to summary
public static byte[] readExactlyNBytes(InputStream is, int length) throws IOException

Read exactly length of bytes from in.

Note that this method is safe to be called with unknown large length argument. The memory used is proportional to the actual bytes available. An exception is thrown if there are not enough bytes in the stream.

Parameters
is:InputStream

input stream, must not be null

length:int

number of bytes to read

Returns:byte[]

bytes read

Exceptions
IOException:
if an I/O error occurs or length is negative
EOFException:
if there are not enough bytes in the stream
OutOfMemoryError:
if an array of the required size cannot be allocated.