|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.util.TextBuffer
Utility class managing a text, made of lines, in a buffer. It can be loaded from a file. Lines can be added with a 'add' method. Lines can be returned by line number.
Field Summary | |
(package private) java.lang.StringBuffer |
buff
|
(package private) java.util.ArrayList |
lineBegin
|
(package private) java.util.ArrayList |
lineEnd
|
(package private) int |
nbline
|
Constructor Summary | |
TextBuffer()
Constructor. |
|
TextBuffer(java.io.File in)
Constructor from a file object |
Method Summary | |
TextBuffer |
addFile(java.io.File f)
Add the content of a file to the TextBuffer |
TextBuffer |
addLine(java.lang.String s)
Add a line. |
TextBuffer |
clear()
Clear the TextBuffer object, so it can be reused without recreation |
java.lang.String |
getLine(int num)
Get a line from its position in the text |
int |
getSize()
Get the number of lines in the TextBuffer |
static void |
main(java.lang.String[] args)
|
java.lang.String |
toString()
Return the buffer as a String |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
java.lang.StringBuffer buff
int nbline
java.util.ArrayList lineBegin
java.util.ArrayList lineEnd
Constructor Detail |
public TextBuffer()
public TextBuffer(java.io.File in) throws java.io.FileNotFoundException, java.io.IOException
in
- File to load in the textBuffer
java.io.FileNotFoundException
- if the file is not found
java.io.IOException
- if an IO Error occursMethod Detail |
public TextBuffer addFile(java.io.File f) throws java.io.FileNotFoundException, java.io.IOException
f
- File to add
java.io.FileNotFoundException
- if the file is not found
java.io.IOException
- if an IO Error occurspublic TextBuffer addLine(java.lang.String s)
s
- new line to add to the TextBuffer
public java.lang.String getLine(int num)
num
- number of the line
public int getSize()
public TextBuffer clear()
public java.lang.String toString()
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |