View Javadoc

    1   /* $Id: ANVLRecords.java 4440 2006-08-05 01:15:47Z stack-sf $
    2    *
    3    * Created Aug 2, 2006
    4    *
    5    * Copyright (C) 2006 Internet Archive.
    6    *
    7    * This file is part of the Heritrix web crawler (crawler.archive.org).
    8    *
    9    * 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 UTF8Bytes {
    38  	private static final long serialVersionUID = 5361551920550106113L;
    39
    40  	public ANVLRecords() {
    41  	    super();
    42  	}
    43
    44  	public ANVLRecords(int initialCapacity) {
    45  		super(initialCapacity);
    46  	}
    47
    48  	public ANVLRecords(Collection<ANVLRecord> c) {
    49  		super(c);
    50  	}
    51
    52  	public byte[] getUTF8Bytes() throws UnsupportedEncodingException {
    53  		return toString().getBytes(UTF8);
    54  	}
    55
    56  	@Override
    57  	public String toString() {
    58  		StringBuilder sb = new StringBuilder();
    59  		for (final Iterator i = iterator(); i.hasNext();) {
    60  			sb.append(i.next().toString());
    61  		}
    62  		return super.toString();
    63  	}
    64  }