gnu.javax.swing.text.html.parser.support.low

Class Buffer


public class Buffer
extends Object

A string buffer that additionally holds line and absolute postion information.

Field Summary

static int
INITIAL_SIZE
boolean
n_seen
True if the \n symbol has been seen.
boolean
r_seen
True if the \r symbol has been seen.

Constructor Summary

Buffer()
Buffer(String content)

Method Summary

void
append(char c, int pos)
Add the character.
char
charAt(int i)
Return char at the given positon.
void
delete(int from, int to)
Delete the range
void
expand()
Double the buffer size.
void
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Get the characters into array.
String
getEndOfLineSequence()
Return the sequence, used to separate lines in the document.
Location
getLocation(int from, int to)
Get location information for the given region.
int
length()
Return length of the occupied part of the buffer.
void
reset()
Prepare for parsing the new document.
void
setLength(int n)
Truncate.
String
toString()

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

INITIAL_SIZE

public static int INITIAL_SIZE

n_seen

public boolean n_seen
True if the \n symbol has been seen.

r_seen

public boolean r_seen
True if the \r symbol has been seen.

Constructor Details

Buffer

public Buffer()

Buffer

public Buffer(String content)

Method Details

append

public void append(char c,
                   int pos)
Add the character.
Parameters:
c - The character.
pos - The character position in the stream (the line number is handled internally in the buffer).

charAt

public char charAt(int i)
Return char at the given positon.

delete

public void delete(int from,
                   int to)
Delete the range
Parameters:
from - Start position, inclusive.
to - End position, exclusive.

expand

public void expand()
Double the buffer size.

getChars

public void getChars(int srcBegin,
                     int srcEnd,
                     char[] dst,
                     int dstBegin)
Get the characters into array.
Parameters:
srcBegin - From, inclusive
srcEnd - To, exclusive.
dst - Into
dstBegin - Offset.

getEndOfLineSequence

public String getEndOfLineSequence()
Return the sequence, used to separate lines in the document.
Returns:
one of \n, \r or \r\n.

getLocation

public Location getLocation(int from,
                            int to)
Get location information for the given region.
Parameters:
from - Region start, inclusive.
to - Region end, exclusive.
Returns:
The location, covering the region.

length

public int length()
Return length of the occupied part of the buffer.

reset

public void reset()
Prepare for parsing the new document.

setLength

public void setLength(int n)
Truncate.
Parameters:
n - The length to truncate till.

toString

public String toString()
Overrides:
toString in interface Object

Buffer.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.