01: /* $Id: ANVLRecords.java 4440 2006-08-05 01:15:47Z stack-sf $
02: *
03: * Created Aug 2, 2006
04: *
05: * Copyright (C) 2006 Internet Archive.
06: *
07: * This file is part of the Heritrix web crawler (crawler.archive.org).
08: *
09: * Heritrix is free software; you can redistribute it and/or modify
10: * it under the terms of the GNU Lesser Public License as published by
11: * the Free Software Foundation; either version 2.1 of the License, or
12: * any later version.
13: *
14: * Heritrix is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: * GNU Lesser Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser Public License
20: * along with Heritrix; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: */
23: package org.archive.util.anvl;
24:
25: import java.io.UnsupportedEncodingException;
26: import java.util.ArrayList;
27: import java.util.Collection;
28: import java.util.Iterator;
29:
30: import org.archive.io.UTF8Bytes;
31:
32: /**
33: * List of {@link ANVLRecord}s.
34: * @author stack
35: * @version $Date: 2006-08-05 01:15:47 +0000 (Sat, 05 Aug 2006) $ $Version$
36: */
37: public class ANVLRecords extends ArrayList<ANVLRecord> implements
38: UTF8Bytes {
39: private static final long serialVersionUID = 5361551920550106113L;
40:
41: public ANVLRecords() {
42: super ();
43: }
44:
45: public ANVLRecords(int initialCapacity) {
46: super (initialCapacity);
47: }
48:
49: public ANVLRecords(Collection<ANVLRecord> c) {
50: super (c);
51: }
52:
53: public byte[] getUTF8Bytes() throws UnsupportedEncodingException {
54: return toString().getBytes(UTF8);
55: }
56:
57: @Override
58: public String toString() {
59: StringBuilder sb = new StringBuilder();
60: for (final Iterator i = iterator(); i.hasNext();) {
61: sb.append(i.next().toString());
62: }
63: return super.toString();
64: }
65: }
|