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

java.lang.Objectorg.sourcejammer.server.source.TextLineIteratorOutput
org.sourcejammer.server.source.TextLineReader
- All Implemented Interfaces:
- java.io.Serializable, TextLineIterator
- public class TextLineReader
- extends TextLineIteratorOutput
- implements java.io.Serializable
- extends TextLineIteratorOutput
Title: $FileName: TextLineReader.java$
- Version:
- $VerNum: 3$
$KeyWordsOff: $
This class reads and outputs lines of text from a binary file passed to it as a byte array. It is not necessary to pass the end of line characters to this class. It can determine the end of a line whether the end of line is represented by line feed or carriage return / line feed.
Note: TextLineReader returns text lines without any end of line characters.
| Field Summary | |
private boolean |
expandKeywords
|
private java.io.InputStream |
inStr
|
private int |
miIndex
|
private int |
miSize
|
private java.util.Vector |
mvecLines
|
private org.sourcejammer.server.keywords.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(org.sourcejammer.server.keywords.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 |
mvecLines
private java.util.Vector mvecLines
miIndex
private int miIndex
miSize
private int miSize
inStr
private java.io.InputStream inStr
expandKeywords
private boolean expandKeywords
projectObjects
private org.sourcejammer.server.keywords.ProjectObjects projectObjects
WIN_EOL
private static final java.lang.String WIN_EOL
| Constructor Detail |
TextLineReader
public TextLineReader(byte[] buf)
throws java.io.IOException
- Constructs a TextLineReader from the passed-in byte array.
TextLineReader
public TextLineReader(java.util.Vector vec)
- 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.
TextLineReader
public TextLineReader(byte[] buf,
int offset,
int length)
throws java.io.IOException
- Constructs a TextLineReader from the specified bytes in the passed-in
byte array.
TextLineReader
public TextLineReader(java.io.BufferedInputStream st) throws java.io.IOException
- Constructs a TextLineReader to read the bytes from the passed in InputStream.
| Method Detail |
setExpandKeywords
public void setExpandKeywords(boolean b)
setProjectObjects
public void setProjectObjects(org.sourcejammer.server.keywords.ProjectObjects o)
initIgnoreKeywords
public void initIgnoreKeywords()
throws java.io.IOException
- 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.
init
public void init()
throws java.io.IOException,
org.sourcejammer.server.keywords.KeywordExpansionException
- 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. This init() method looks for keywords
to expand as it reads.
getNumLines
public int getNumLines()
- Returns the number of lines in the TextLineReader.
setIndex
public void setIndex(int index)
throws org.sourcejammer.server.make.EndOfSourceException
- 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.
- Specified by:
hasMoreLinesin interfaceTextLineIterator- Specified by:
hasMoreLinesin classTextLineIteratorOutput
skipLines
public void skipLines(int numLines)
throws org.sourcejammer.server.make.EndOfSourceException
- Moves the index ahead by the specified number of lines.
- Specified by:
skipLinesin interfaceTextLineIterator- Specified by:
skipLinesin classTextLineIteratorOutput
getNextLine
public java.lang.String getNextLine() throws org.sourcejammer.server.make.EndOfSourceException
- Returns the next line and advances the index.
- Specified by:
getNextLinein interfaceTextLineIterator- Specified by:
getNextLinein classTextLineIteratorOutput
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 org.sourcejammer.server.make.EndOfSourceException
- 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.
toStream
public void toStream(java.io.OutputStream stream, java.lang.String eol) throws java.io.IOException
toStream
public void toStream(java.io.OutputStream stream) throws java.io.IOException
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.
- Specified by:
toStringBufferin classTextLineIteratorOutput
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.
- Specified by:
toStringin classTextLineIteratorOutput
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.
- Specified by:
toStringin classTextLineIteratorOutput
toCharArray
public char[] toCharArray(java.lang.String eol)
- Specified by:
toCharArrayin classTextLineIteratorOutput
toCharArray
public char[] toCharArray()
- Specified by:
toCharArrayin classTextLineIteratorOutput
getUnderlyingVector
public java.util.Vector getUnderlyingVector()
main
public static void main(java.lang.String[] args)
|
|||||||||
| Home >> All >> org >> sourcejammer >> server >> [ source overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC