public class LoopingAlphabetStream
extends java.io.InputStream
implements org.apache.derby.iapi.types.Resetable
Modifier and Type | Field and Description |
---|---|
private ByteAlphabet |
alphabet |
private byte[] |
buffer |
private long |
length
Length of the stream.
|
private static int |
MAX_BUF_SIZE
Maximum size of buffer.
|
private long |
remainingBlanks
Remaining bytes in the stream.
|
private long |
remainingNonBlanks |
private static byte |
SPACE |
private int |
trailingBlanks |
Constructor and Description |
---|
LoopingAlphabetStream(long length)
Create a looping modern latin alphabet stream of the specified length.
|
LoopingAlphabetStream(long length,
ByteAlphabet alphabet)
Create a looping alphabet of the specified type and length.
|
LoopingAlphabetStream(long length,
ByteAlphabet alphabet,
int trailingBlanks) |
LoopingAlphabetStream(long length,
int trailingBlanks)
Creates a looping alphabet stream with the specified length, in which the
last characters are blanks.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Return remaining bytes in the stream.
|
void |
closeStream() |
private int |
fillBlanks(byte[] buf,
int off,
int length) |
private void |
fillBuffer(int bufSize)
Fill internal buffer of bytes (from character sequence).
|
void |
initStream() |
int |
read() |
int |
read(byte[] buf,
int off,
int length) |
void |
reset()
Reset the stream.
|
void |
resetStream() |
private static final int MAX_BUF_SIZE
private static final byte SPACE
private final long length
private final int trailingBlanks
private long remainingBlanks
private long remainingNonBlanks
private byte[] buffer
private final ByteAlphabet alphabet
public LoopingAlphabetStream(long length)
length
- the number of characters (and also the number of bytes)public LoopingAlphabetStream(long length, int trailingBlanks)
length
- total length of the streamtrailingBlanks
- number of trailing blankspublic LoopingAlphabetStream(long length, ByteAlphabet alphabet)
length
- the number of bytes in the streamalphabet
- the alphabet to loop overpublic LoopingAlphabetStream(long length, ByteAlphabet alphabet, int trailingBlanks)
public int read()
read
in class java.io.InputStream
public int read(byte[] buf, int off, int length)
read
in class java.io.InputStream
public void reset()
reset
in class java.io.InputStream
public int available()
available
in class java.io.InputStream
private void fillBuffer(int bufSize)
bufSize
- the wanted size, might be ignored if too bigprivate int fillBlanks(byte[] buf, int off, int length)
public void resetStream()
resetStream
in interface org.apache.derby.iapi.types.Resetable
public void initStream()
initStream
in interface org.apache.derby.iapi.types.Resetable
public void closeStream()
closeStream
in interface org.apache.derby.iapi.types.Resetable
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.