Class DateTimeFormatterBuilder.OffsetIdPrinterParser

java.lang.Object
org.threeten.bp.format.DateTimeFormatterBuilder.OffsetIdPrinterParser
All Implemented Interfaces:
DateTimeFormatterBuilder.DateTimePrinterParser
Enclosing class:
DateTimeFormatterBuilder

static final class DateTimeFormatterBuilder.OffsetIdPrinterParser extends Object implements DateTimeFormatterBuilder.DateTimePrinterParser
Prints or parses an offset ID.
  • Field Details

  • Constructor Details

    • OffsetIdPrinterParser

      OffsetIdPrinterParser(String noOffsetText, String pattern)
      Constructor.
      Parameters:
      noOffsetText - the text to use for UTC, not null
      pattern - the pattern
  • Method Details

    • checkPattern

      private int checkPattern(String pattern)
    • print

      public boolean print(DateTimePrintContext context, StringBuilder buf)
      Description copied from interface: DateTimeFormatterBuilder.DateTimePrinterParser
      Prints the date-time object to the buffer.

      The context holds information to use during the print. It also contains the date-time information to be printed.

      The buffer must not be mutated beyond the content controlled by the implementation.

      Specified by:
      print in interface DateTimeFormatterBuilder.DateTimePrinterParser
      Parameters:
      context - the context to print using, not null
      buf - the buffer to append to, not null
      Returns:
      false if unable to query the value from the date-time, true otherwise
    • parse

      public int parse(DateTimeParseContext context, CharSequence text, int position)
      Description copied from interface: DateTimeFormatterBuilder.DateTimePrinterParser
      Parses text into date-time information.

      The context holds information to use during the parse. It is also used to store the parsed date-time information.

      Specified by:
      parse in interface DateTimeFormatterBuilder.DateTimePrinterParser
      Parameters:
      context - the context to use and parse into, not null
      text - the input text to parse, not null
      position - the position to start parsing at, from 0 to the text length
      Returns:
      the new parse position, where negative means an error with the error position encoded using the complement ~ operator
    • parseNumber

      private boolean parseNumber(int[] array, int arrayIndex, CharSequence parseText, boolean required)
      Parse a two digit zero-prefixed number.
      Parameters:
      array - the array of parsed data, 0=pos,1=hours,2=mins,3=secs, not null
      arrayIndex - the index to parse the value into
      parseText - the offset ID, not null
      required - whether this number is required
      Returns:
      true if an error occurred
    • toString

      public String toString()
      Overrides:
      toString in class Object