public class LoopingAlphabetReader
extends java.io.Reader
Modifier and Type | Field and Description |
---|---|
private CharAlphabet |
alphabet
The alphabet to draw letters from.
|
private char[] |
buffer
Internal buffer of characters.
|
private boolean |
closed
Tell if the reader is closed or not.
|
private long |
length
Number of characters in the reader.
|
private static int |
MAX_BUF_SIZE
Maximum size of buffer.
|
private long |
remainingBlanks
Remaining blanks.
|
private long |
remainingNonBlanks
Remaining non-blank characters.
|
private static int |
SPACE
The character used for blanks (SPACE).
|
private int |
trailingBlanks
Number of blanks at the end of stream.
|
Constructor and Description |
---|
LoopingAlphabetReader(long length)
Create a looping modern latin alphabet reader of the specified length.
|
LoopingAlphabetReader(long length,
CharAlphabet alphabet)
Create a looping alphabet of the specified type and length.
|
LoopingAlphabetReader(long length,
CharAlphabet alphabet,
int trailingBlanks)
Create a looping alphabet of the specified type and length, with
the specified number of trailing blanks.
|
LoopingAlphabetReader(long length,
int trailingBlanks)
Create a looping modern latin alphabet of the specified length, with
the specified number of trailing blanks.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Return remaining characters in the stream.
|
void |
close()
Close the reader.
|
private void |
ensureOpen()
Ensure reader is open.
|
private int |
fillBlanks(char[] buf,
int off,
int length)
Fill array with blanks (SPACE).
|
private void |
fillBuffer(int bufSize)
Fill internal buffer of character sequence.
|
int |
read() |
int |
read(char[] buf,
int off,
int length) |
void |
reset()
Reset the stream.
|
private static final int MAX_BUF_SIZE
private static final int SPACE
private final long length
private final int trailingBlanks
private long remainingNonBlanks
private long remainingBlanks
private char[] buffer
private final CharAlphabet alphabet
private boolean closed
public LoopingAlphabetReader(long length)
length
- the number of characterspublic LoopingAlphabetReader(long length, int trailingBlanks)
length - trailingBlanks
.length
- total number of characterstrailingBlanks
- number of blank characters at the endpublic LoopingAlphabetReader(long length, CharAlphabet alphabet)
length
- the number of chars in the readeralphabet
- the alphabet to loop overpublic LoopingAlphabetReader(long length, CharAlphabet alphabet, int trailingBlanks)
length - trailingBlanks
.length
- total number of charactersalphabet
- the alphabet to draw characters fromtrailingBlanks
- number of blank characters at the endpublic int read() throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public int read(char[] buf, int off, int length) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.Reader
java.io.IOException
public int available()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Reader
private void fillBuffer(int bufSize)
bufSize
- the wanted size, might be ignored if too bigprivate int fillBlanks(char[] buf, int off, int length)
buf
- array to filloff
- starting offsetlength
- maximum number of blanks to fill inprivate final void ensureOpen() throws java.io.IOException
java.io.IOException
- if reader is closedApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.