public abstract class ByteChunkStream
extends stream.io.AbstractStream
This class implements a fast byte-oriented stream of byte chunks. The chunks are found by checking for a start-signature (i.e. byte array). The stream returns a sequence of data items, each holding a chunk of bytes.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
static byte[] |
GIF_SIGNATURE |
static byte[] |
JPG_SIGNATURE |
| Constructor and Description |
|---|
ByteChunkStream(InputStream in,
byte[] signature) |
ByteChunkStream(stream.io.SourceURL url,
byte[] signature) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getBufferSize() |
protected int |
indexOf(byte[] sig,
int from) |
void |
init() |
protected boolean |
isSignatureAt(int pos,
byte[] sig) |
stream.Data |
readNext() |
void |
setBufferSize(stream.util.ByteSize bufferSize) |
public static final byte[] GIF_SIGNATURE
public static final byte[] JPG_SIGNATURE
public static final int DEFAULT_BUFFER_SIZE
public ByteChunkStream(stream.io.SourceURL url,
byte[] signature)
throws Exception
Exceptionpublic ByteChunkStream(InputStream in, byte[] signature) throws Exception
Exceptionpublic void init()
throws Exception
init in interface stream.io.Sourceinit in class stream.io.AbstractStreamExceptionstream.io.AbstractDataStream#init()public void close()
throws Exception
close in interface stream.io.Sourceclose in class stream.io.AbstractStreamExceptionstream.io.DataStream#close()public int getBufferSize()
@Parameter(description="The internal buffer size of this stream.") public void setBufferSize(stream.util.ByteSize bufferSize)
bufferSize - the bufferSize to setprotected int indexOf(byte[] sig,
int from)
sig - from - protected boolean isSignatureAt(int pos,
byte[] sig)
pos - sig - Copyright © 2015. All rights reserved.