|
intarsys runtime library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.intarsys.tools.randomaccess.AbstractRandomAccess
de.intarsys.tools.randomaccess.RandomAccessFilter
de.intarsys.tools.randomaccess.RandomAccessViewport
public class RandomAccessViewport
A viewport in an existing IRandomAccess.
| Constructor Summary | |
|---|---|
RandomAccessViewport(IRandomAccess ra,
long offset,
long length)
Create a viewport to the existing IRandomAccess ra. |
|
| Method Summary | |
|---|---|
long |
getLength()
Returns the length of this data container. |
long |
getOffset()
Returns the current offset in this data container. |
boolean |
isReadOnly()
true if this is a read only data container. |
int |
read()
Reads a byte of data from this data container. |
int |
read(byte[] buffer)
Reads up to buffer.length bytes of data from this data
container into an array of bytes. |
int |
read(byte[] buffer,
int start,
int numBytes)
Reads up to len bytes of data from this data container
into an array of bytes. |
void |
seek(long offset)
Sets the offset, measured from the beginning of the data container at which the next read or write occurs. |
void |
seekBy(long delta)
Sets the offset, measured from the current offset at which the next read or write occurs. |
void |
setLength(long newLength)
Assign the length. |
void |
write(byte[] buffer)
Writes b.length bytes from the specified byte array,
starting at the current offset. |
void |
write(byte[] buffer,
int start,
int numBytes)
Writes len bytes from the specified byte array starting at
start. |
void |
write(int b)
Writes the specified byte . |
| Methods inherited from class de.intarsys.tools.randomaccess.RandomAccessFilter |
|---|
close, flush |
| Methods inherited from class de.intarsys.tools.randomaccess.AbstractRandomAccess |
|---|
asInputStream, asOutputStream, mark, reset |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RandomAccessViewport(IRandomAccess ra,
long offset,
long length)
throws IOException
IRandomAccess ra.
ATTENTION: This will not seek to offset in ra.
This means after creation before initial use you have to position the
IRandomAccess yourself using seek.
ra - offset - length -
IOException| Method Detail |
|---|
public long getLength()
throws IOException
IRandomAccess
getLength in interface IRandomAccessgetLength in class RandomAccessFilterIOException - if an I/O error occurs.
public long getOffset()
throws IOException
IRandomAccess
getOffset in interface IRandomAccessgetOffset in class RandomAccessFilterIOException - if an I/O error occurs.public boolean isReadOnly()
IRandomAccesstrue if this is a read only data container.
isReadOnly in interface IRandomAccessisReadOnly in class RandomAccessFiltertrue if this is a read only data container.
public int read()
throws IOException
IRandomAccess0x00-0x0ff). This method
blocks if no input is yet available.
This method behaves in exactly the same way as the
InputStream.read() method of InputStream.
read in interface IRandomAccessread in class RandomAccessFilter-1 if the end of the
data container has been reached.
IOException - if an I/O error occurs. Not thrown if the end of the data
container has been reached.
public int read(byte[] buffer)
throws IOException
IRandomAccessbuffer.length bytes of data from this data
container into an array of bytes. This method blocks until at least one
byte of input is available.
This method behaves in the exactly the same way as the
InputStream.read(byte[]) method of InputStream.
read in interface IRandomAccessread in class RandomAccessFilterbuffer - the buffer into which the data is read.
-1 if there is no more data because the end of
this data container has been reached.
IOException - if an I/O error occurs.
public int read(byte[] buffer,
int start,
int numBytes)
throws IOException
IRandomAccesslen bytes of data from this data container
into an array of bytes. This method blocks until at least one byte of
input is available.
read in interface IRandomAccessread in class RandomAccessFilter-1 if there is no more data because the end of the
file has been reached.
IOException - if an I/O error occurs.
public void seek(long offset)
throws IOException
IRandomAccess
seek in interface IRandomAccessseek in class RandomAccessFilteroffset - the offset position, measured in bytes from the beginning of
the data container
IOException - if offset is less than 0 or
if an I/O error occurs.
public void seekBy(long delta)
throws IOException
IRandomAccess
seekBy in interface IRandomAccessseekBy in class RandomAccessFilterdelta - the amount of bytes by which to change the current offset
position
IOException - if the resulting offset is less than
0 or if an I/O error occurs.
public void setLength(long newLength)
throws IOException
IRandomAccess
setLength in interface IRandomAccesssetLength in class RandomAccessFilterIOException
public void write(byte[] buffer)
throws IOException
IRandomAccessb.length bytes from the specified byte array,
starting at the current offset.
write in interface IRandomAccesswrite in class RandomAccessFilterIOException - if an I/O error occurs.
public void write(byte[] buffer,
int start,
int numBytes)
throws IOException
IRandomAccesslen bytes from the specified byte array starting at
start.
write in interface IRandomAccesswrite in class RandomAccessFilterbuffer - the data.start - the start offset in the data.numBytes - the number of bytes to write.
IOException - if an I/O error occurs.
public void write(int b)
throws IOException
IRandomAccess
write in interface IRandomAccesswrite in class RandomAccessFilterb - the byte to be written.
IOException - if an I/O error occurs.
|
intarsys runtime library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||