01: /*
02: * @(#)CollectionLineHandler.java 1.2 04/12/06
03: *
04: * Copyright (c) 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.nio;
10:
11: import pnuts.lang.*;
12: import org.pnuts.text.*;
13: import java.util.*;
14: import java.nio.*;
15:
16: class CollectionLineHandler implements LineHandler {
17:
18: Collection col;
19:
20: public CollectionLineHandler(Collection col) {
21: this .col = col;
22: }
23:
24: public void process(char[] cb, int offset, int length) {
25: col.add(CharBuffer.wrap(cb, offset, length));
26: }
27:
28: public void process(byte[] bb, int offset, int length) {
29: col.add(ByteBuffer.wrap(bb, offset, length));
30: }
31: }
|