Skip to content

Commit

Permalink
spotless and missing comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kosak committed Nov 4, 2024
1 parent 9b7b53f commit 80a5fa2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/main/java/io/deephaven/csv/reading/CsvReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ private CsvReader() {}
* the CsvReader determines what the column type is, it will use the {@link SinkFactory} to create an
* appropriate Sink<T> for the type. Note that the CsvReader might guess wrong, so it might create a
* Sink, partially populate it, and then abandon it. The final set of fully-populated Sinks will be returned
* in the CsvReader.Result. Thread safety: The {@link SinkFactory} may be invoked concurrently, therefore
* it must be thread safe.
* in the CsvReader.Result. Thread safety: The {@link SinkFactory} may be invoked concurrently, therefore it
* must be thread safe.
* @return A CsvReader.Result containing the column names, the number of columns, and the final set of
* fully-populated Sinks.
*/
Expand Down Expand Up @@ -99,8 +99,8 @@ private static Result delimitedReadLogic(


private static Result commonReadLogic(final CsvSpecs specs, CellGrabber grabber, byte[][] optionalFirstDataRow,
int numInputCols, int numOutputCols,
String[] headersToUse, final SinkFactory sinkFactory)
int numInputCols, int numOutputCols,
String[] headersToUse, final SinkFactory sinkFactory)
throws CsvReaderException {
final String[][] nullValueLiteralsToUse = new String[numOutputCols][];
for (int ii = 0; ii < numOutputCols; ++ii) {
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/io/deephaven/csv/reading/ReaderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ public static void trimWhitespace(final ByteSlice cs) {
cs.reset(data, begin, end);
}

/**
* Get the expected length of a UTF-8 sequence, given its first byte, and its
* corresponding length in the specified units (UTF-16 or UTF-32).
* @param firstByte The first byte of the UTF-8 sequence.
* @param numBytes The number of remaining bytes in the input field (including firstByte). If the UTF-8
* sequence specifies a number of bytes larger than the number of remaining bytes, an
* exception is thrown.
* @param useUtf32CountingConvention Whether 'charCountResult' should be in units of UTF-32 or UTF-16.
* @param charCountResult The number of UTF-32 or UTF-16 units specified by the UTF-8 character.
* @return The length of the UTF-8 sequence.
*/
public static int getUtf8LengthAndCharLength(
byte firstByte, int numBytes,
boolean useUtf32CountingConvention, MutableInt charCountResult) {
Expand All @@ -47,6 +58,7 @@ public static int getUtf8LengthAndCharLength(

/**
* Calculate the expected length of a UTF-8 sequence, given its first byte.
*
* @param firstByte The first byte of the sequence.
* @return The length of the sequence, in the range 1..4 inclusive.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/deephaven/csv/reading/cells/CellGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ void grabNext(final ByteSlice dest, final MutableBoolean lastInRow,
final MutableBoolean endOfInput) throws CsvReaderException;

/**
* Returns the "physical" row number, that is the row number of the input file. This differs from the "logical"
* row number, which is the row number of the CSV data being processed. The difference arises when, due to
* quotation marks, a single CSV row can span multiple lines of input.
* Returns the "physical" row number, that is the row number of the input file. This differs from the "logical" row
* number, which is the row number of the CSV data being processed. The difference arises when, due to quotation
* marks, a single CSV row can span multiple lines of input.
*/
int physicalRowNum();
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public DelimitedCellGrabber(

@Override
public void grabNext(final ByteSlice dest, final MutableBoolean lastInRow,
final MutableBoolean endOfInput) throws CsvReaderException {
final MutableBoolean endOfInput) throws CsvReaderException {
spillBuffer.clear();
startOffset = offset;

Expand Down Expand Up @@ -103,7 +103,7 @@ public void grabNext(final ByteSlice dest, final MutableBoolean lastInRow,
* the row, otherwise the contents will be set to false.
*/
private void processQuotedMode(final ByteSlice dest, final MutableBoolean lastInRow,
final MutableBoolean endOfInput) throws CsvReaderException {
final MutableBoolean endOfInput) throws CsvReaderException {
startOffset = offset;
boolean prevCharWasCarriageReturn = false;
while (true) {
Expand Down Expand Up @@ -172,7 +172,7 @@ private void processQuotedMode(final ByteSlice dest, final MutableBoolean lastIn
* Process characters in "unquoted mode". This is easy: eat characters until the next field or line delimiter.
*/
private void processUnquotedMode(final ByteSlice dest, final MutableBoolean lastInRow,
final MutableBoolean endOfInput) throws CsvReaderException {
final MutableBoolean endOfInput) throws CsvReaderException {
startOffset = offset;
finishField(dest, lastInRow, endOfInput);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ private void skipWhitespace() throws CsvReaderException {
* Otherwise, its contents are set to false.
*/
private void finishField(final ByteSlice dest, final MutableBoolean lastInRow,
final MutableBoolean endOfInput)
final MutableBoolean endOfInput)
throws CsvReaderException {
while (true) {
if (!tryEnsureMore()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class DelimitedHeaderFinder {
* overrides.
*/
public static String[] determineHeadersToUse(final CsvSpecs specs,
final CellGrabber grabber, final MutableObject<byte[][]> firstDataRowHolder)
final CellGrabber grabber, final MutableObject<byte[][]> firstDataRowHolder)
throws CsvReaderException {
String[] headersToUse = null;
if (specs.hasHeaderRow()) {
Expand Down

0 comments on commit 80a5fa2

Please sign in to comment.