public final class BufferedCursorStream
extends org.mule.runtime.api.streaming.bytes.CursorStream
CursorStream which pulls its data from an InputStreamBuffer.
To reduce contention on the InputStreamBuffer, this class also uses a local intermediate
memory buffer which size must be configured
InputStreamBuffer| Modifier and Type | Field and Description |
|---|---|
protected long |
position |
| Constructor and Description |
|---|
BufferedCursorStream(InputStreamBuffer streamBuffer,
org.mule.runtime.api.streaming.bytes.CursorStreamProvider provider)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertNotDisposed() |
void |
close()
Closes this stream and invokes the closing callback received in the constructor.
|
protected int |
doRead()
Template method to support the
read() method. |
protected int |
doRead(byte[] b,
int off,
int len)
Template method to support the
read(byte[], int, int) method |
long |
getPosition() |
org.mule.runtime.api.streaming.bytes.CursorStreamProvider |
getProvider() |
boolean |
isReleased() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
release() |
void |
reset() |
void |
seek(long position) |
long |
skip(long n)
Equivalent to
this.seek(this.getPosition() + n) |
protected int |
unsigned(int value) |
available, readpublic BufferedCursorStream(InputStreamBuffer streamBuffer, org.mule.runtime.api.streaming.bytes.CursorStreamProvider provider)
streamBuffer - the buffer which provides dataprovider - the CursorStreamProvider for the cursors that will consume this bufferpublic void seek(long position)
throws IOException
seek in interface org.mule.runtime.api.streaming.CursorIOExceptionprotected int doRead()
throws IOException
read() method.-1 if no more elements are present in the streamIOExceptionprotected int doRead(byte[] b,
int off,
int len)
throws IOException
read(byte[], int, int) methodb - the buffer into which the data is read.off - the start offset in array b at which the data is written.len - the maximum number of bytes to read.-1 if there is no more data because the end of
the stream has been reached.IOExceptionpublic long getPosition()
public boolean isReleased()
public final void release()
public org.mule.runtime.api.streaming.bytes.CursorStreamProvider getProvider()
protected void assertNotDisposed()
throws IOException
IOExceptionpublic final void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface org.mule.runtime.api.streaming.Cursorclose in class InputStreamIOExceptionpublic final int read()
throws IOException
read in class InputStreamIllegalStateException - if this instance has been disposedIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic final long skip(long n)
throws IOException
this.seek(this.getPosition() + n)skip in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreamtrueprotected int unsigned(int value)
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.