|
|||||||||
| Home >> All >> org >> sourcejammer >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.sourcejammer.util
Class TextLineReader2

java.lang.Objectorg.sourcejammer.util.TextLineReader2
- public class TextLineReader2
- extends java.lang.Object
- Version:
- $VerNum: 2$
$KeyWordsOff: $
Mostly copied from org.sourcejammer.server.source.TextLineReader. This bad form, but it was easier to do that refactoring that class to extend this one, which is what i will do eventually.
| Field Summary | |
private boolean |
expandKeywords
|
private java.io.InputStream |
inStr
|
private int |
miIndex
|
private int |
miSize
|
private java.util.Vector |
mvecLines
|
| Constructor Summary | |
TextLineReader2(byte[] buf)
Constructs a TextLineReader from the passed-in byte array. |
|
TextLineReader2(byte[] buf,
int offset,
int length)
Constructs a TextLineReader from the specified bytes in the passed-in byte array. |
|
TextLineReader2(java.util.Collection col)
Constructs a new NextLineReader explicitly setting the underlying Vector to a Vector of Strings. |
|
TextLineReader2(java.io.InputStream st)
Constructs a TextLineReader to read the bytes from the passed in InputStream. |
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
Returns true if the the object is a TextLineReader and the current line of the object is equal to the current line of this TextLineReader. |
java.lang.String |
getCurrentLine()
Returns the current line without adavancing the iterator. |
int |
getIndex()
|
java.lang.String |
getLine(int index)
Returns the line with the specified index. |
java.lang.String |
getNextLine()
Returns the next line and advances the index. |
int |
getNumLines()
Returns the number of lines in the TextLineReader. |
java.util.Vector |
getUnderlyingVector()
|
boolean |
hasMoreLines()
Returns true if the TextLineReader contains additional lines after the current index. |
void |
init()
Initializes the TextLineReader. |
boolean |
next()
Advances the iterator to the next line. |
void |
setIndex(int index)
Sets the index to the specified line number. |
int |
size()
Returns the total number of characters in all the lines in this TextLineReader. |
void |
skipLines(int numLines)
Moves the index ahead by the specified number of lines. |
char[] |
toCharArray()
|
char[] |
toCharArray(java.lang.String eol)
|
java.lang.String |
toString()
Returns contents of this TextLineReader (the entire text file) as a String, the default end of line chars (from AppConfig) as the end of line String. |
java.lang.String |
toString(java.lang.String eol)
Returns contents of this TextLineReader (the entire text file) as a String, using the passed in eol as the end of line String. |
java.lang.StringBuffer |
toStringBuffer(java.lang.String eol)
Returns contents of this TextLineReader (the entire text file) as a StringBuffer, using the passed in eol as the end of line String. |
java.util.Vector |
toVector()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
mvecLines
private java.util.Vector mvecLines
miIndex
private int miIndex
miSize
private int miSize
inStr
private java.io.InputStream inStr
expandKeywords
private boolean expandKeywords
| Constructor Detail |
TextLineReader2
public TextLineReader2(byte[] buf)
throws java.io.IOException
- Constructs a TextLineReader from the passed-in byte array.
TextLineReader2
public TextLineReader2(java.util.Collection col)
- Constructs a new NextLineReader explicitly setting the underlying Vector
to a Vector of Strings. Used for storing the contents of a TextLineReader
object without explicitly serializing this object. Vector is serialized instead.
TextLineReader2
public TextLineReader2(byte[] buf,
int offset,
int length)
throws java.io.IOException
- Constructs a TextLineReader from the specified bytes in the passed-in
byte array.
TextLineReader2
public TextLineReader2(java.io.InputStream st) throws java.io.IOException
- Constructs a TextLineReader to read the bytes from the passed in InputStream.
| Method Detail |
init
public void init()
throws java.io.IOException
- Initializes the TextLineReader. Reads all of the bytes from the InputStream
and converts them to lines of text stored in a Vector. No need call if this class
was constructed with Vector constructor.
getNumLines
public int getNumLines()
- Returns the number of lines in the TextLineReader.
setIndex
public void setIndex(int index)
throws TextLineReaderException
- Sets the index to the specified line number.
getLine
public java.lang.String getLine(int index)
- Returns the line with the specified index.
hasMoreLines
public boolean hasMoreLines()
- Returns true if the TextLineReader contains additional lines after the
current index.
skipLines
public void skipLines(int numLines)
throws TextLineReaderException
- Moves the index ahead by the specified number of lines.
getNextLine
public java.lang.String getNextLine() throws TextLineReaderException
- Returns the next line and advances the index.
size
public int size()
- Returns the total number of characters in all the lines in this
TextLineReader.
getIndex
public int getIndex()
next
public boolean next()
- Advances the iterator to the next line. Returns true if this was
successful. Returns false when end of file is reached.
getCurrentLine
public java.lang.String getCurrentLine() throws TextLineReaderException
- Returns the current line without adavancing the iterator.
equals
public boolean equals(java.lang.Object o)
- Returns true if the the object is a TextLineReader and the current
line of the object is equal to the current line of this TextLineReader.
toStringBuffer
public java.lang.StringBuffer toStringBuffer(java.lang.String eol)
- Returns contents of this TextLineReader (the entire text file) as a
StringBuffer, using the passed in eol as the end of line String.
toString
public java.lang.String toString(java.lang.String eol)
- Returns contents of this TextLineReader (the entire text file) as a
String, using the passed in eol as the end of line String.
toString
public java.lang.String toString()
- Returns contents of this TextLineReader (the entire text file) as a
String, the default end of line chars (from AppConfig) as the end of line
String.
toCharArray
public char[] toCharArray(java.lang.String eol)
toCharArray
public char[] toCharArray()
getUnderlyingVector
public java.util.Vector getUnderlyingVector()
toVector
public java.util.Vector toVector()
|
|||||||||
| Home >> All >> org >> sourcejammer >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.sourcejammer.util.TextLineReader2