Class FileLinesByteArrayCollection
- All Implemented Interfaces:
Size64
,Iterable<byte[]>
,Collection<byte[]>
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Deprecated.Please useFileLinesByteArrayIterable.iterator(java.io.InputStream, Class, EnumSet)
; thezipped
option of this class can be simulated by passing aGZIPInputStream
as decompressor. -
Constructor Summary
ConstructorDescriptionFileLinesByteArrayCollection
(CharSequence filename) Deprecated.Creates a byte-array file-lines collection for the specified filename, using both CR and LF as line terminators.FileLinesByteArrayCollection
(CharSequence filename, boolean zipped) Deprecated.Creates a byte-array file-lines collection for the specified filename, optionally assuming that the file is compressed usinggzip
format, using both CR and LF as line terminators.FileLinesByteArrayCollection
(CharSequence filename, boolean zipped, EnumSet<FastBufferedInputStream.LineTerminator> terminators) Deprecated.Creates a byte-array file-lines collection for the specified filename, optionally assuming that the file is compressed usinggzip
format, using the specified line terminators. -
Method Summary
Modifier and TypeMethodDescriptionObjectBigList<byte[]>
allLines()
Deprecated.Returns all lines of the file wrapped by this file-lines collection.iterator()
Deprecated.int
size()
Deprecated.Please usesize64()
instead.long
size64()
Deprecated.Object[]
toArray()
Deprecated.<T> T[]
toArray
(T[] a) Deprecated.toString()
Deprecated.Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
FileLinesByteArrayCollection
Deprecated.Creates a byte-array file-lines collection for the specified filename, using both CR and LF as line terminators.- Parameters:
filename
- a filename.
-
FileLinesByteArrayCollection
Deprecated.Creates a byte-array file-lines collection for the specified filename, optionally assuming that the file is compressed usinggzip
format, using both CR and LF as line terminators.- Parameters:
filename
- a filename.zipped
- whetherfilename
is zipped.
-
FileLinesByteArrayCollection
public FileLinesByteArrayCollection(CharSequence filename, boolean zipped, EnumSet<FastBufferedInputStream.LineTerminator> terminators) Deprecated.Creates a byte-array file-lines collection for the specified filename, optionally assuming that the file is compressed usinggzip
format, using the specified line terminators.- Parameters:
filename
- a filename.zipped
- whetherfilename
is zipped.terminators
- line terminators for the underlyingFastBufferedInputStream
.
-
-
Method Details
-
iterator
Deprecated.- Specified by:
iterator
in interfaceCollection<byte[]>
- Specified by:
iterator
in interfaceIterable<byte[]>
- Specified by:
iterator
in classAbstractCollection<byte[]>
-
size
Deprecated.Please usesize64()
instead.- Specified by:
size
in interfaceCollection<byte[]>
- Specified by:
size
in interfaceSize64
- Specified by:
size
in classAbstractCollection<byte[]>
-
size64
public long size64()Deprecated. -
allLines
Deprecated.Returns all lines of the file wrapped by this file-lines collection.- Returns:
- all lines of the file wrapped by this file-lines collection.
-
toArray
Deprecated.- Specified by:
toArray
in interfaceCollection<byte[]>
- Overrides:
toArray
in classAbstractCollection<byte[]>
-
toArray
Deprecated.- Specified by:
toArray
in interfaceCollection<byte[]>
- Overrides:
toArray
in classAbstractCollection<byte[]>
-
toString
Deprecated.- Overrides:
toString
in classAbstractCollection<byte[]>
-
FileLinesByteArrayIterable
instead; thezipped
option of this class can be simulated by passing aGZIPInputStream
as decompressor.