|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
org.abstracthorizon.mercury.maildir.file.SharedInputStreamImpl
public class SharedInputStreamImpl
SharedInputStream implementation
| Field Summary | |
|---|---|
protected byte[] |
buffer
Stream's buffer |
static int |
BUFFER_SIZE
Stream's buffer size |
protected int |
buflen
Stream's buffer content len |
protected long |
bufptr
Stream's buffer start pointer |
protected long |
end
Stream end offset |
protected FileProvider |
fileProvider
File provider reference |
protected long |
fileSize
Cached value of file's size |
protected int |
id
Unique Id - needed for debug purposes only |
protected long |
lastAccessed
Timestamp this stream's file is accessed last time |
protected long |
mark
Mark |
protected static int |
num
Next Unique Id - needed for debug purposes only |
protected SharedInputStreamPool |
parent
Pool that created this object |
protected long |
ptr
Stream's pointer |
protected RandomAccessFile |
raf
Random access file reference |
protected long |
start
Stream start offset |
| Constructor Summary | |
|---|---|
SharedInputStreamImpl(SharedInputStreamPool parent,
FileProvider fileProvider,
long start,
long end)
Constructor. |
|
| Method Summary | |
|---|---|
int |
available()
Returns number of available bytes in stream (to end of stream). |
protected void |
checkOpened()
Checks if underlaying file is opened. |
void |
close()
Closes the stream and releases allocated resources. |
void |
closeImpl()
This method actually releases the resources ( random access file) |
protected long |
getFileSize()
Returns file's size. |
long |
getPosition()
Returns current pointer in stream |
void |
mark(int readlimit)
Sets mark. |
boolean |
markSupported()
Returns true |
InputStream |
newStream(long pos,
long end)
Creates new stream from this stream. |
int |
read()
Reads one byte or returns -1 if EOF is reached (end of stream really). |
int |
read(byte[] buf)
Reads whole buffer. |
int |
read(byte[] buf,
int off,
int len)
Reads bytes from the underlaying file. |
boolean |
ready()
Returns true |
void |
reset()
Resets stream to the mark |
long |
skip(long n)
Skips number of bytes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static int num
protected int id
protected long start
protected long end
protected long ptr
protected long mark
public static final int BUFFER_SIZE
protected byte[] buffer
protected long bufptr
protected int buflen
protected long fileSize
protected FileProvider fileProvider
protected RandomAccessFile raf
protected SharedInputStreamPool parent
protected long lastAccessed
| Constructor Detail |
|---|
public SharedInputStreamImpl(SharedInputStreamPool parent,
FileProvider fileProvider,
long start,
long end)
parent - pool that is creating this streamfileProvider - file providerstart - stream startend - stream end| Method Detail |
|---|
public int read(byte[] buf,
int off,
int len)
throws IOException
read in class InputStreambuf - buffer to be read intooff - offset in bufferlen - length to be read
IOException
public int read(byte[] buf)
throws IOException
read in class InputStreambuf - buffer to be read into
IOException
public int read()
throws IOException
read in class InputStreamIOException
public int available()
throws IOException
available in class InputStreamIOException
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException
public void closeImpl()
throws IOException
random access file)
IOExceptionpublic boolean markSupported()
true
markSupported in class InputStreamtruepublic void mark(int readlimit)
mark in class InputStreamreadlimit - ignored
public void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean ready()
true
true
public long skip(long n)
throws IOException
skip in class InputStreamn - number of bytes to be skipped
IOExceptionpublic long getPosition()
getPosition in interface javax.mail.internet.SharedInputStream
public InputStream newStream(long pos,
long end)
newStream in interface javax.mail.internet.SharedInputStreampos - new relative start positionend - new relative end position
protected void checkOpened()
throws IOException
FileProvider
to obtain file.
IOExceptionprotected long getFileSize()
FileProvider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||