Top Fields Constructors Methods
org.eclipse.swt.internal.image

pack-priv final Class LEDataInputStream

extends InputStream
Class Inheritance
Imports
java.io.*

Field Summary

Modifier and TypeField and Description
protected byte[]
buf

The byte array containing the bytes to read.

pack-priv InputStream
protected int
pos

The current position within the byte array buf.

pack-priv int

Constructor Summary

AccessConstructor and Description
public
public
LEDataInputStream(InputStream input, int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.InputStream.available.

Answers how many bytes are available for reading without blocking
public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.
public int
getPosition()

Answer how many bytes were read.

public int
read()

Implements abstract java.io.InputStream.read.

Answer the next byte of the input stream.
public int
read(byte[]
the buffer into which the data is read.
b
,
int
the start offset in array b at which the data is written.
off
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.InputStream.read.

Don't imitate the JDK behaviour of reading a random number of bytes when you can actually read them all.
private int

Returns:

int the number of bytes actually read or -1 if end of stream.
readData
(byte[]
the byte array in which to store the read bytes.
buffer
,
int
the offset in buffer to store the read bytes.
offset
,
int
the maximum number of bytes to store in buffer.
length
)

Reads at most length bytes from this LEDataInputStream and stores them in byte array buffer starting at offset.

public int
readInt()

Answer an integer comprised of the next four bytes of the input stream.

public short
readShort()

Answer a short comprised of the next two bytes of the input stream.

public void
unread(byte[]
the byte array containing bytes to push back into the stream
b
)

Push back the entire content of the given buffer b.

Inherited from java.io.InputStream:
markmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

bufback to summary
protected byte[] buf

The byte array containing the bytes to read.

inback to summary
pack-priv InputStream in
posback to summary
protected int pos

The current position within the byte array buf. A value equal to buf.length indicates no bytes available. A value of 0 indicates the buffer is full.

positionback to summary
pack-priv int position

Constructor Detail

LEDataInputStreamback to summary
public LEDataInputStream(InputStream input)
LEDataInputStreamback to summary
public LEDataInputStream(InputStream input, int bufferSize)

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.InputStream.available.

Answers how many bytes are available for reading without blocking

Returns:int

Doc from java.io.InputStream.available.

an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking or 0 when it reaches the end of the input stream.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.InputStream.available.

if an I/O error occurs.

closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.InputStream.close.

Closes this input stream and releases any system resources associated with the stream.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getPositionback to summary
public int getPosition()

Answer how many bytes were read.

readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Answer the next byte of the input stream.

Returns:int

Doc from java.io.InputStream.read.

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.InputStream.read.

if an I/O error occurs.

readback to summary
public int read(byte[] b, int off, int len) throws IOException

Overrides java.io.InputStream.read.

Don't imitate the JDK behaviour of reading a random number of bytes when you can actually read them all.

Parameters
b:byte[]

Doc from java.io.InputStream.read.

the buffer into which the data is read.

off:int

Doc from java.io.InputStream.read.

the start offset in array b at which the data is written.

len:int

Doc from java.io.InputStream.read.

the maximum number of bytes to read.

Returns:int

Doc from java.io.InputStream.read.

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.InputStream.read.

If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.

readDataback to summary
private int readData(byte[] buffer, int offset, int length) throws IOException

Reads at most length bytes from this LEDataInputStream and stores them in byte array buffer starting at offset.

Answer the number of bytes actually read or -1 if no bytes were read and end of stream was encountered. This implementation reads bytes from the pushback buffer first, then the target stream if more bytes are required to satisfy count.

Parameters
buffer:byte[]

the byte array in which to store the read bytes.

offset:int

the offset in buffer to store the read bytes.

length:int

the maximum number of bytes to store in buffer.

Returns:int

int the number of bytes actually read or -1 if end of stream.

Exceptions
IOException:
if an IOException occurs.
readIntback to summary
public int readInt() throws IOException

Answer an integer comprised of the next four bytes of the input stream.

readShortback to summary
public short readShort() throws IOException

Answer a short comprised of the next two bytes of the input stream.

unreadback to summary
public void unread(byte[] b) throws IOException

Push back the entire content of the given buffer b.

The bytes are pushed so that they would be read back b[0], b[1], etc. If the push back buffer cannot handle the bytes copied from b, an IOException will be thrown and no byte will be pushed back.

Parameters
b:byte[]

the byte array containing bytes to push back into the stream

Exceptions
IOException:
if the pushback buffer is too small