Class CsvInstantParser

java.lang.Object
io.deephaven.importers.csv.parsers.CsvObjectParserBase<Instant,Instant[]>
io.deephaven.importers.csv.parsers.CsvInstantParser
All Implemented Interfaces:
io.deephaven.csv.parsers.Parser<Instant[]>

public class CsvInstantParser extends CsvObjectParserBase<Instant,Instant[]>
Parser for Instant type object that supports error count tracking.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.deephaven.csv.parsers.Parser

    io.deephaven.csv.parsers.Parser.GlobalContext, io.deephaven.csv.parsers.Parser.ParserContext<TARRAY extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final boolean
     
     
     
    protected static final int
     
    protected final CsvParserContext
     
    protected char[]
     

    Fields inherited from class io.deephaven.importers.csv.parsers.CsvObjectParserBase

    holder

    Fields inherited from interface io.deephaven.csv.parsers.Parser

    CHUNK_SIZE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    CsvInstantParser(@NotNull AppendableColumnSink<Instant,Instant[]> columnSink, @NotNull CsvParserContext parserContext, @Nullable Instant defaultValue, boolean failDefault, boolean hasDefault)
    Base Array Parser class that supports error count tracking.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Instant
    getCurrentValue(@NotNull String bufferValue)
    Returns the parsed value of the current byte slice that has been passed in as a String value.
    protected int
    getLength(Instant @NotNull [] values)
    Convenience method that returns the length of the parameter values which is the array returned for Parser.ParserContext.valueChunk()
    protected char @NotNull []
    getTransformData(@NotNull io.deephaven.importers.csv.parsers.ColumnDataIteratorHolder ih)
    Method to update reusable transform buffer
    @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]>
    makeParserContext(@NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, int chunkSize)
     
    protected boolean
    suppressErrorAndUpdateWithDefault(long rowNum, boolean isNull, Instant[] values, int chunkIndex)
    On null or error conditions verifies if allowed error count is exhausted by considering strict and failDefault attributes.
    long
    tryParse(@NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]> pctx, @Nullable io.deephaven.csv.parsers.IteratorHolder ih, long begin, long end, boolean appending)
    Redirects to invoke tryParse with a ColumnDataIteratorHolder Implementation.
    protected boolean
    tryUpdateWithDefault(Instant @NotNull [] values, int chunkIndex)
    Implementations should update with default value at the current position.
    protected void
    updateCurrentValue(Instant @NotNull [] values, @Nullable Instant currentValue, int chunkIndex)
    Convenience method that updates the values parameter which is an array with the given current value at the given chunkIndex.

    Methods inherited from class io.deephaven.importers.csv.parsers.CsvObjectParserBase

    tryParse

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CsvInstantParser

      protected CsvInstantParser(@NotNull @NotNull AppendableColumnSink<Instant,Instant[]> columnSink, @NotNull @NotNull CsvParserContext parserContext, @Nullable @Nullable Instant defaultValue, boolean failDefault, boolean hasDefault)
      Base Array Parser class that supports error count tracking.
      Parameters:
      columnSink - Appendable column sink for which the parser is used
      parserContext - The context object that holds common attributes passed down
      defaultValue - A default value that may be used if the source is empty or parsing fails
      failDefault - Whether (true) to use the default value (onEmpty) if parsing/conversion of the source value fails
      hasDefault - Whether default value is present
  • Method Details

    • makeParserContext

      @NotNull public @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]> makeParserContext(@NotNull @NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, int chunkSize)
    • getCurrentValue

      protected Instant getCurrentValue(@NotNull @NotNull String bufferValue) throws InputMismatchException, NumberFormatException
      Description copied from class: CsvObjectParserBase
      Returns the parsed value of the current byte slice that has been passed in as a String value.
      Specified by:
      getCurrentValue in class CsvObjectParserBase<Instant,Instant[]>
      Parameters:
      bufferValue - The current String value of the current byte slice
      Returns:
      the parsed value of the current byte slice that has been passed in as a String value.
      Throws:
      InputMismatchException - thrown while retrieving the value
      NumberFormatException - thrown in case of Number data types when parsing fails due to number format errors.
    • updateCurrentValue

      protected void updateCurrentValue(Instant @NotNull [] values, @Nullable @Nullable Instant currentValue, int chunkIndex)
      Description copied from class: CsvObjectParserBase
      Convenience method that updates the values parameter which is an array with the given current value at the given chunkIndex.
      Specified by:
      updateCurrentValue in class CsvObjectParserBase<Instant,Instant[]>
      Parameters:
      values - the values array retrieved using Parser.ParserContext.valueChunk()
      currentValue - the value that should be updated in the values array at the given index
      chunkIndex - the index where the currentValue needs to be updated
    • tryUpdateWithDefault

      protected boolean tryUpdateWithDefault(Instant @NotNull [] values, int chunkIndex)
      Implementations should update with default value at the current position.
      Parameters:
      values - The current values buffer
      chunkIndex - The current position to update on values buffer
      Returns:
      true if successfully updated with supplied default value
    • getLength

      protected int getLength(Instant @NotNull [] values)
      Description copied from class: CsvObjectParserBase
      Convenience method that returns the length of the parameter values which is the array returned for Parser.ParserContext.valueChunk()
      Specified by:
      getLength in class CsvObjectParserBase<Instant,Instant[]>
      Parameters:
      values - the values array retrieved using Parser.ParserContext.valueChunk()
      Returns:
      the length of the array
    • getTransformData

      protected char @NotNull [] getTransformData(@NotNull @NotNull io.deephaven.importers.csv.parsers.ColumnDataIteratorHolder ih)
      Method to update reusable transform buffer
    • suppressErrorAndUpdateWithDefault

      protected boolean suppressErrorAndUpdateWithDefault(long rowNum, boolean isNull, @NotNull Instant[] values, int chunkIndex) throws io.deephaven.csv.util.CsvReaderException
      On null or error conditions verifies if allowed error count is exhausted by considering strict and failDefault attributes. Updates with default value if applicable.
      Parameters:
      rowNum - The current row for entire import
      isNull - Indicates if this was invoked for a null value cell
      values - The current values buffer
      chunkIndex - The current position to update on values buffer
      Returns:
      true if successfully updated with supplied default value
      Throws:
      io.deephaven.csv.util.CsvReaderException - when exceeds max error count.
    • tryParse

      public long tryParse(@NotNull @NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, @NotNull @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]> pctx, @Nullable @Nullable io.deephaven.csv.parsers.IteratorHolder ih, long begin, long end, boolean appending) throws io.deephaven.csv.util.CsvReaderException
      Redirects to invoke tryParse with a ColumnDataIteratorHolder Implementation. See Parser.tryParse(GlobalContext, ParserContext, IteratorHolder, long, long, boolean)
      Specified by:
      tryParse in interface io.deephaven.csv.parsers.Parser<TYPE>
      Throws:
      io.deephaven.csv.util.CsvReaderException