|
Ujorm release 1.22 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujorm.core.RingBuffer
public final class RingBuffer
A 'ring buffer' implementation whith a required length of the buffer. See a sample use case of finding some substrings:
String text = "xxx ${abc} ${def} xyz";
Reader reader = RingBuffer.createReader(text);
String word_1 = RingBuffer.findWord(reader, "${", "}");
assert "abc".equals(word_1)
String word_2 = RingBuffer.findWord(reader, "${", "}");
assert "def".equals(word_2)
Sample of use.| Field Summary | |
|---|---|
int |
length
Length |
static java.nio.charset.Charset |
UTF8
The UTF-8 Charset |
| Constructor Summary | |
|---|---|
RingBuffer(int length)
Creates new RingBuffer |
|
| Method Summary | |
|---|---|
void |
add(char c)
|
static java.io.Reader |
createReader(java.io.File file)
Create Reader from the UTF-8 encode source |
static java.io.Reader |
createReader(java.io.File file,
java.nio.charset.Charset charset)
Create Reader |
static java.io.Reader |
createReader(java.lang.String text)
Create Reader |
static java.io.Reader |
createReader(java.net.URL url)
Create Reader from the UTF-8 encode source |
static java.io.Reader |
createReader(java.net.URL url,
java.nio.charset.Charset charset)
Create Reader |
boolean |
equals(char[] s)
The equals test |
boolean |
equals(java.lang.String s)
The equals test |
static java.lang.String |
findWord(java.io.Reader reader,
java.lang.String beg,
java.lang.String end)
Find a word betveen beg and end text from current cursor and TRIM the result. |
static java.lang.String |
findWord(java.lang.String source,
java.lang.String beg,
java.lang.String end)
Find a word betveen beg and end text from the source start and trim the result. |
static java.lang.String |
findWordNoTrim(java.io.Reader reader,
java.lang.String beg,
java.lang.String end)
Find a word betveen beg and end text from current cursor. |
static java.lang.String |
findWordNoTrim(java.lang.String source,
java.lang.String beg,
java.lang.String end)
Find a word betveen beg and end text from the source start. |
char |
charAt(int i)
Returns a character from position 'i' |
int |
length()
Length of the String |
java.lang.CharSequence |
subSequence(int start,
int end)
Get a sub-sequence |
java.lang.String |
substring(int begIndex,
int endIndex)
Export to the String |
java.lang.String |
toString()
Export to the String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.nio.charset.Charset UTF8
public final int length
| Constructor Detail |
|---|
public RingBuffer(int length)
| Method Detail |
|---|
public final void add(char c)
public boolean equals(java.lang.String s)
public boolean equals(char[] s)
public char charAt(int i)
charAt in interface java.lang.CharSequencepublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Object
public java.lang.String substring(int begIndex,
int endIndex)
public final int length()
length in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequence
public static java.lang.String findWord(java.io.Reader reader,
java.lang.String beg,
java.lang.String end)
throws java.io.IOException
String text = "xxx ${abc} def";
String word = RingBuffer.findWord(text, "${", "}");
assert "abc".equals(word)
reader - A data sourcebeg - Start tag (text) where the empty value means find end from the current cursor.end - End tag (text) must not be empty.
java.io.IOException
public static java.lang.String findWord(java.lang.String source,
java.lang.String beg,
java.lang.String end)
throws java.io.IOException
source - a Data sourcebeg - Start tag (text) where the empty value means find end from the current cursor.end - End tag (text) must not be empty.
java.io.IOException
public static java.lang.String findWordNoTrim(java.lang.String source,
java.lang.String beg,
java.lang.String end)
throws java.io.IOException
String text = "xxx ${abc} def";
String word = RingBuffer.findWord(text, "${", "}");
assert "abc".equals(word)
reader - A data sourcebeg - Start tag (text) where the empty value means find end from the current cursor.end - End tag (text) must not be empty.
java.io.IOException
public static java.lang.String findWordNoTrim(java.io.Reader reader,
java.lang.String beg,
java.lang.String end)
throws java.io.IOException
reader - A data sourcebeg - Start tag (text) where the empty value means find end from the current cursor.end - End tag (text) must not be empty.
java.io.IOException
public static java.io.Reader createReader(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundException
public static java.io.Reader createReader(java.io.File file,
java.nio.charset.Charset charset)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static java.io.Reader createReader(java.lang.String text)
public static java.io.Reader createReader(java.net.URL url)
throws java.io.IOException
java.io.IOException
public static java.io.Reader createReader(java.net.URL url,
java.nio.charset.Charset charset)
throws java.io.IOException
java.io.IOException
|
Ujorm release 1.22 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||