|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.util.Errorable
ewe.io.BasicStreamObject
ewe.io.StreamObject
ewe.io.RandomStreamObject
ewe.io.RandomStreamAdapter
This provides a full RandomAccessStream implementation from either a BasicRandomAccessStream implementation or from a RandomStream object.
| Field Summary | |
protected RandomStream |
rs
|
protected BasicRandomAccessStream |
stream
|
| Fields inherited from class ewe.io.StreamObject |
napIterations, napTime, READWRITE_CLOSED, READWRITE_ERROR, READWRITE_WOULDBLOCK |
| Fields inherited from class ewe.io.BasicStreamObject |
closed |
| Fields inherited from class ewe.util.Errorable |
error |
| Fields inherited from interface ewe.io.StreamCanPause |
PAUSE_UNTIL_CAN_READ, PAUSE_UNTIL_CAN_WRITE, PAUSE_UNTIL_CLOSED, PAUSE_UNTIL_FLUSHED |
| Constructor Summary | |
protected |
RandomStreamAdapter()
|
|
RandomStreamAdapter(BasicRandomAccessStream basicStream)
|
|
RandomStreamAdapter(RandomStream rs)
|
| Method Summary | |
boolean |
canWrite()
Tests if the RandomAccessStream was opened in read-write mode as opposed to read-ony mode. |
boolean |
closeStream()
This is non-blocking. |
boolean |
flushStream()
This is non-blocking. |
long |
getStreamLength()
Gets the length of the open stream. |
boolean |
isOpen()
Returns if the stream is open or not. |
int |
nonBlockingRead(byte[] buff,
int start,
int count)
This calls the nonBlockingRead() of the client BasicStream. |
int |
nonBlockingRead(long location,
byte[] dest,
int offset,
int length)
Non-blocking read at a particular location. |
int |
nonBlockingWrite(byte[] buff,
int start,
int count)
This calls the nonBlockingWrite() of the client BasicStream. |
int |
nonBlockingWrite(long location,
byte[] src,
int offset,
int length)
Non-blocking write at a particular location. |
int |
pauseUntilReady(int pauseFor,
int value)
|
boolean |
pushback(byte[] bytes,
int start,
int count)
Push back some bytes into the input stream. |
boolean |
seekPosition(long where)
Tell the Stream to move to the specific position. |
boolean |
setStreamLength(long length)
Set the length of the RandomAccessStream if possible. |
long |
tellPosition()
Retrieve the file position. |
| Methods inherited from class ewe.io.RandomStreamObject |
getFilePosition, getLength, length, seek, seek, setLength, tell, toRandomStream |
| Methods inherited from class ewe.io.StreamObject |
close, doRead, doWrite, flush, nap, nap, read, readAByte, readBytes, readBytes, write, writeAByte, writeBytes, writeBytes |
| Methods inherited from class ewe.io.BasicStreamObject |
getException, getName, read, read, throwIOException, toInputStream, toOutputStream, toStream, write, write |
| Methods inherited from class ewe.util.Errorable |
returnError, returnError, returnError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Methods inherited from interface ewe.io.Stream |
flush, read, read, read, readBytes, readBytes, toInputStream, toOutputStream, write, write, write, writeBytes, writeBytes |
| Methods inherited from interface ewe.io.BasicStream |
close |
| Field Detail |
protected RandomStream rs
protected BasicRandomAccessStream stream
| Constructor Detail |
protected RandomStreamAdapter()
public RandomStreamAdapter(BasicRandomAccessStream basicStream)
public RandomStreamAdapter(RandomStream rs)
| Method Detail |
public int pauseUntilReady(int pauseFor,
int value)
pauseUntilReady in interface StreamCanPause
public boolean pushback(byte[] bytes,
int start,
int count)
pushback in interface BufferedStreampublic boolean canWrite()
BasicRandomAccessStream
canWrite in interface BasicRandomAccessStreampublic boolean isOpen()
BasicStream
isOpen in interface BasicStreamisOpen in class StreamObject
public int nonBlockingRead(byte[] buff,
int start,
int count)
nonBlockingRead in interface BasicStreamnonBlockingRead in class StreamObjectbuff - Destination byte array to hold incoming data.start - Starting index in buff for incoming data.count - Maximum number of bytes to read - should never be zero.
public int nonBlockingWrite(byte[] buff,
int start,
int count)
nonBlockingWrite in interface BasicStreamnonBlockingWrite in class StreamObjectbuff - Source byte array holding data to be written.start - Starting index in buff for data to be written.count - Number of bytes to write - should never be zero.
public boolean flushStream()
throws IOException
BasicStream
flushStream in interface BasicStreamIOException
public boolean closeStream()
throws IOException
BasicStream
closeStream in interface BasicStreamcloseStream in class StreamObjectIOException
public boolean setStreamLength(long length)
throws IOException
BasicRandomAccessStreamMake no assumptions about the success of this method. Not all RAS objects will support setStreamLength() or setLength() - not even all Files on all systems will support this. For example, PersonalJava/Java 1.1 does not support this feature and will throw an IOException.
What happens to the file position pointer after this method is called is unpredictable, especially if you are truncating the file. You should ALWAYS reset the file position pointer after calling this method to be where you wish it to be.
setStreamLength in interface BasicRandomAccessStreamsetStreamLength in class RandomStreamObjectIOException
public long getStreamLength()
throws IOException
RandomStreamObject
getStreamLength in interface BasicRandomAccessStreamgetStreamLength in class RandomStreamObjectIOException - if an error occured while getting the length.
public long tellPosition()
throws IOException
RandomStreamObject
tellPosition in interface BasicRandomAccessStreamtellPosition in class RandomStreamObjectIOException - if an error occured while getting the position.
public boolean seekPosition(long where)
throws IOException
RandomStreamObject
seekPosition in interface BasicRandomAccessStreamseekPosition in class RandomStreamObjectwhere - The position to seek to.
IOException - if an error occured during the seek.
public int nonBlockingRead(long location,
byte[] dest,
int offset,
int length)
throws IOException
BasicRandomAccessStream
nonBlockingRead in interface BasicRandomAccessStreamnonBlockingRead in class RandomStreamObjectIOException
public int nonBlockingWrite(long location,
byte[] src,
int offset,
int length)
throws IOException
BasicRandomAccessStream
nonBlockingWrite in interface BasicRandomAccessStreamnonBlockingWrite in class RandomStreamObjectIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||