|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sourcejammer.server.source.TextLineIteratorOutput | +--org.sourcejammer.server.source.TextLineReader
Title: $FileName: TextLineReader.java$
Field Summary | |
private boolean |
expandKeywords
|
private java.io.InputStream |
inStr
|
private int |
miIndex
|
private int |
miSize
|
private java.util.Vector |
mvecLines
|
private ProjectObjects |
projectObjects
|
private static java.lang.String |
WIN_EOL
|
Constructor Summary | |
TextLineReader(java.io.BufferedInputStream st)
Constructs a TextLineReader to read the bytes from the passed in InputStream. |
|
TextLineReader(byte[] buf)
Constructs a TextLineReader from the passed-in byte array. |
|
TextLineReader(byte[] buf,
int offset,
int length)
Constructs a TextLineReader from the specified bytes in the passed-in byte array. |
|
TextLineReader(java.util.Vector vec)
Constructs a new NextLineReader explicitly setting the underlying Vector to a Vector of Strings. |
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. |
void |
initIgnoreKeywords()
This init method never looks for keywords, so it's a little faster than the other init() if you know you don't need to expand, such as when you're reading a file to return to the user. |
static void |
main(java.lang.String[] args)
|
boolean |
next()
Advances the iterator to the next line. |
void |
setExpandKeywords(boolean b)
|
void |
setIndex(int index)
Sets the index to the specified line number. |
void |
setProjectObjects(ProjectObjects o)
|
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)
|
void |
toStream(java.io.OutputStream stream)
|
void |
toStream(java.io.OutputStream stream,
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. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.util.Vector mvecLines
private int miIndex
private int miSize
private java.io.InputStream inStr
private boolean expandKeywords
private ProjectObjects projectObjects
private static final java.lang.String WIN_EOL
Constructor Detail |
public TextLineReader(byte[] buf) throws java.io.IOException
buf
- -- a byte array that is a binary representation of a text file.public TextLineReader(java.util.Vector vec)
public TextLineReader(byte[] buf, int offset, int length) throws java.io.IOException
buf
- -- a byte array that is a binary representation of a text file.offset
- -- byte in the buf at which read should begin.length
- -- number of bytes in buf to read.public TextLineReader(java.io.BufferedInputStream st) throws java.io.IOException
st
- -- an InputStream for streaming in bytes which are a binary
representation of a text file.Method Detail |
public void setExpandKeywords(boolean b)
public void setProjectObjects(ProjectObjects o)
public void initIgnoreKeywords() throws java.io.IOException
java.io.IOException
public void init() throws java.io.IOException, KeywordExpansionException
java.io.IOException
KeywordExpansionException
public int getNumLines()
public void setIndex(int index) throws EndOfSourceException
index
- -- the line number to set the index to.
EndOfSourceException
- -- if the TextLineReader does not
contain a line with the specified index.public java.lang.String getLine(int index)
index
- -- a line number.
public boolean hasMoreLines()
hasMoreLines
in interface TextLineIterator
hasMoreLines
in class TextLineIteratorOutput
public void skipLines(int numLines) throws EndOfSourceException
skipLines
in interface TextLineIterator
skipLines
in class TextLineIteratorOutput
numLines
- -- number of lines to skip.
EndOfSourceException
- -- if skipping requested number of lines
would point index past end of source file.public java.lang.String getNextLine() throws EndOfSourceException
getNextLine
in interface TextLineIterator
getNextLine
in class TextLineIteratorOutput
EndOfSourceException
- if there is no next line.public int size()
public int getIndex()
public boolean next()
public java.lang.String getCurrentLine() throws EndOfSourceException
EndOfSourceException
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void toStream(java.io.OutputStream stream, java.lang.String eol) throws java.io.IOException
java.io.IOException
public void toStream(java.io.OutputStream stream) throws java.io.IOException
java.io.IOException
public java.lang.StringBuffer toStringBuffer(java.lang.String eol)
toStringBuffer
in class TextLineIteratorOutput
public java.lang.String toString(java.lang.String eol)
toString
in class TextLineIteratorOutput
public java.lang.String toString()
toString
in class TextLineIteratorOutput
public char[] toCharArray(java.lang.String eol)
toCharArray
in class TextLineIteratorOutput
public char[] toCharArray()
toCharArray
in class TextLineIteratorOutput
public java.util.Vector getUnderlyingVector()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |