Class FileLinesByteArrayCollection

java.lang.Object
java.util.AbstractCollection<byte[]>
it.unimi.dsi.big.io.FileLinesByteArrayCollection
All Implemented Interfaces:
Size64, Iterable<byte[]>, Collection<byte[]>

public class FileLinesByteArrayCollection
extends AbstractCollection<byte[]>
implements Size64
A wrapper exhibiting the lines of a file as a Collection of byte arrays.

An instance of this class allows to access the lines of a file as a Collection of byte arrays. Reading is performed using FastBufferedInputStream.readLine(byte[], EnumSet), and follows the rules defined therein. No decoding is performed.

Using direct access is strongly discouraged (it will require a full scan of the file), but the iterator() can be fruitfully used to scan the file, and can be called any number of times, as it opens an independent input stream at each call. For the same reason, the returned iterator type (FileLinesCollection.FileLinesIterator) is Closeable, and should be closed after usage.

Using a suitable constructor, it is possible to specify that the file is compressed in gzip format (in this case, it will be opened using a GZIPInputStream).

Note that the first call to size64() will require a full file scan.

Since:
2.2.8
Author:
Sebastiano Vigna