01: /*
02: * This is free software, licensed under the Gnu Public License (GPL)
03: * get a copy from <http://www.gnu.org/licenses/gpl.html>
04: *
05: * author: Henner Zeller <H.Zeller@acm.org>
06: */
07: package henplus.importparser;
08:
09: /**
10: * A parser for a specific type. Different implementations
11: */
12: public final class StringParser extends TypeParser {
13: private final int _field;
14:
15: public StringParser(int field) {
16: _field = field;
17: }
18:
19: /**
20: * parse the value from the character buffer starting from the given
21: * offset and with the given length. Store the result in the
22: * ValueRecipient.
23: */
24: public void parse(char[] buffer, int offset, int len,
25: ValueRecipient recipient) throws Exception {
26: recipient.setString(_field, new String(buffer, offset, len));
27: }
28: }
|