Top Fields Constructors Methods
org.apache.derby.iapi.services.io

public Class ArrayOutputStream

extends OutputStream
implements Limit
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.Limit
Imports
java.io.IOException, .EOFException, .OutputStream

Field Summary

Modifier and TypeField and Description
private int
private byte[]
private int
private int

Constructor Summary

AccessConstructor and Description
public
public
ArrayOutputStream(byte[] data)

Method Summary

Modifier and TypeMethod and Description
public int
clearLimit()

Implements org.apache.derby.iapi.services.io.Limit.clearLimit.

Clear any limit set by setLimit.
public int
public void
setData(byte[] data)

public void
setLimit(int
The length to set
length
)

Implements org.apache.derby.iapi.services.io.Limit.setLimit.

Set the limit of the data that can be read or written.
public void
setPosition(int
The new postion to set
newPosition
)

Set the position of the stream pointer.

public void
write(int
the byte.
b
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.
public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
Inherited from java.io.OutputStream:
closeflushnullOutputStreamwrite

Field Detail

endback to summary
private int end
pageDataback to summary
private byte[] pageData
positionback to summary
private int position
startback to summary
private int start

Constructor Detail

ArrayOutputStreamback to summary
public ArrayOutputStream()
ArrayOutputStreamback to summary
public ArrayOutputStream(byte[] data)

Method Detail

clearLimitback to summary
public int clearLimit()

Implements org.apache.derby.iapi.services.io.Limit.clearLimit.

Doc from org.apache.derby.iapi.services.io.Limit.clearLimit.

Clear any limit set by setLimit. After this call no limit checking will be made on any read until a setLimit()) call is made.

Returns:int

the number of bytes within the limit that have not been read or written.

getPositionback to summary
public int getPosition()
setDataback to summary
public void setData(byte[] data)
setLimitback to summary
public void setLimit(int length) throws IOException

Implements org.apache.derby.iapi.services.io.Limit.setLimit.

Doc from org.apache.derby.iapi.services.io.Limit.setLimit.

Set the limit of the data that can be read or written. After this call up to and including length bytes can be read from or skipped in the stream.

On input classes (e.g. InputStreams) any attempt to read or skip beyond the limit will result in an end of file indication (e.g. read() methods returning -1 or throwing EOFException).

On output classes (e.g. OutputStream) any attempt to write more beyond the limit will result in an EOFException

Parameters
length:int

The length to set

Exceptions
IOException:
IOException from some underlying stream
setPositionback to summary
public void setPosition(int newPosition) throws IOException

Set the position of the stream pointer.

Parameters
newPosition:int

The new postion to set

Exceptions
IOException:
on error
writeback to summary
public void write(int b) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
b:int

the byte.

Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.