Record Class CsvIndex
java.lang.Object
java.lang.Record
de.siegmar.fastcsv.reader.CsvIndex
- Record Components:
bomHeaderLength- The length of an optional BOM header.fileSize- The CSV file size this index was built for.fieldSeparator- The field separator used when building this index.quoteCharacter- The quote character used when building this index.commentStrategy- The comment strategy used when building this index.commentCharacter- The comment character used when building this index.pageSize- The page size the pages of this index were partitioned with.recordCount- The total number of records the CSV file contains this index was built for.pages- The pages this index is partitioned.
- All Implemented Interfaces:
Serializable
public record CsvIndex(int bomHeaderLength, long fileSize, byte fieldSeparator, byte quoteCharacter, CommentStrategy commentStrategy, byte commentCharacter, int pageSize, long recordCount, List<CsvIndex.CsvPage> pages)
extends Record
implements Serializable
Index built by IndexedCsvReader to access large CSV data files.
Instances of this class are immutable and safe for use by multiple threads.
The index holds one CsvIndex.CsvPage per pageSize() records, so its memory footprint grows with the record
count, not with the file size.
This class implements Serializable, so an index can be persisted and reloaded
to avoid re-indexing the same file. A previously built index can be passed to
IndexedCsvReader.IndexedCsvReaderBuilder.index(CsvIndex) for reuse – which requires all settings,
including the pageSize(), to match the ones the index was built with.
Even if the constructor is public (mandatory for record classes), this class is not intended to be instantiated directly!
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a page of the CSV file. -
Constructor Summary
ConstructorsConstructorDescriptionCsvIndex(int bomHeaderLength, long fileSize, byte fieldSeparator, byte quoteCharacter, CommentStrategy commentStrategy, byte commentCharacter, int pageSize, long recordCount, List<CsvIndex.CsvPage> pages) Constructor for theCsvIndexclass. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebomHeaderLengthrecord component.byteReturns the value of thecommentCharacterrecord component.Returns the value of thecommentStrategyrecord component.final booleanIndicates whether some other object is "equal to" this one.byteReturns the value of thefieldSeparatorrecord component.longfileSize()Returns the value of thefileSizerecord component.final inthashCode()Returns a hash code value for this object.pages()Returns the value of thepagesrecord component.intpageSize()Returns the value of thepageSizerecord component.byteReturns the value of thequoteCharacterrecord component.longReturns the value of therecordCountrecord component.toString()Returns string representation of this index without the pages themselves.
-
Constructor Details
-
CsvIndex
public CsvIndex(int bomHeaderLength, long fileSize, byte fieldSeparator, byte quoteCharacter, CommentStrategy commentStrategy, byte commentCharacter, int pageSize, long recordCount, List<CsvIndex.CsvPage> pages) Constructor for theCsvIndexclass.- Throws:
NullPointerException- if thecommentStrategyorpagesisnull
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
bomHeaderLength
public int bomHeaderLength()Returns the value of thebomHeaderLengthrecord component.- Returns:
- the value of the
bomHeaderLengthrecord component
-
fileSize
-
fieldSeparator
public byte fieldSeparator()Returns the value of thefieldSeparatorrecord component.- Returns:
- the value of the
fieldSeparatorrecord component
-
quoteCharacter
public byte quoteCharacter()Returns the value of thequoteCharacterrecord component.- Returns:
- the value of the
quoteCharacterrecord component
-
commentStrategy
Returns the value of thecommentStrategyrecord component.- Returns:
- the value of the
commentStrategyrecord component
-
commentCharacter
public byte commentCharacter()Returns the value of thecommentCharacterrecord component.- Returns:
- the value of the
commentCharacterrecord component
-
pageSize
-
recordCount
public long recordCount()Returns the value of therecordCountrecord component.- Returns:
- the value of the
recordCountrecord component
-
pages
-