01: /*
02: * TokenBuffer.java February 2006
03: *
04: * Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General
16: * Public License along with this library; if not, write to the
17: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18: * Boston, MA 02111-1307 USA
19: */
20:
21: package simple.page.translate;
22:
23: import simple.util.parse.ParseBuffer;
24:
25: /**
26: * The <code>TokenBuffer</code> represents an object used to collect
27: * characters from an implementation of a <code>Token</code>. The
28: * primary goal with the token buffer is to allow fast a collection
29: * of characters and a simple conversion of those characters to a
30: * string object.
31: *
32: * @author Niall Gallagher
33: *
34: * @see simple.page.translate.Token
35: */
36: class TokenBuffer extends ParseBuffer {
37:
38: /**
39: * This will convert the accumulated characters to a string that
40: * represents a token. If no characters were collected by this
41: * instance then a zero length string is returned from this.
42: *
43: * @return this returns a string representing the token
44: */
45: public String text() {
46: return new String(buf, 0, count);
47: }
48: }
|