public interface TextBuffer
Modifier and Type | Method and Description |
---|---|
void |
addLine(java.lang.String text)
Adds a line of text to the end of the buffer.
|
void |
clear()
Clears the buffer.
|
java.lang.String |
getLine(int line)
Gets a specific line from the buffer.
|
int |
getSize()
Returns the number of lines in the buffer.
|
void |
insertLine(int line,
java.lang.String text)
Inserts a new line at the specified position.
|
void |
load(java.lang.String path)
Loads a text file into the buffer.
|
TextBuffer |
newInstance()
Returns a new instance of the buffer.
|
void |
removeLine(int line)
Removes the specified line.
|
void |
save()
Saves the buffer back to disk again.
|
void |
saveAs(java.lang.String path)
Saves the buffer to another file.
|
void |
setLine(int line,
java.lang.String text)
Replaces a specific line in the buffer.
|
void |
setReadOnly(boolean readOnly)
If true makes the buffer read only.
|
void load(java.lang.String path) throws java.io.IOException
path
- The path to the file to load.java.io.IOException
void save() throws java.io.IOException
java.io.IOException
void saveAs(java.lang.String path) throws java.io.IOException
path
- The path to the file to save to.java.io.IOException
void clear()
int getSize()
java.lang.String getLine(int line)
line
- The line to get.void setLine(int line, java.lang.String text)
line
- The line to replace.text
- The new text for the line.void removeLine(int line)
line
- The line to remove.void insertLine(int line, java.lang.String text)
line
- the poistion to insert at.text
- The text to insert.void addLine(java.lang.String text)
text
- The text to add.TextBuffer newInstance()
Some editor operations work by creating a new buffer. This method allows those operations to create a buffer of the same type.
Please note however that any saved reference to the loaded file must be copied to the new instance before it is returned.
void setReadOnly(boolean readOnly)
readOnly
- Set to true to make buffer read only. Defaults to false.Copyright © 2009-2012. All Rights Reserved.