org.apache.avro.reflect

## Class DateAsLongEncoding

- java.lang.Object
- - org.apache.avro.reflect.CustomEncoding<Date>
  - - org.apache.avro.reflect.DateAsLongEncoding

-     public class DateAsLongEncoding
      extends CustomEncoding<Date>

  This encoder/decoder writes a java.util.Date object as a long to avro and reads a Date object from long. The long stores the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the Date object.

- - ### Field Summary

    - ### Fields inherited from class org.apache.avro.reflect.CustomEncoding

      `schema`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DateAsLongEncoding()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Date` | `read(Object reuse, Decoder in)`
    `protected void` | `write(Object datum, Encoder out)`

    - ### Methods inherited from class org.apache.avro.reflect.CustomEncoding

      `getSchema`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DateAsLongEncoding

          public DateAsLongEncoding()

  - ### Method Detail

    - #### write

          protected final void write(Object datum,
                                     Encoder out)
                              throws IOException

      Specified by:
        `write` in class `CustomEncoding<Date>`
      Throws:
        `IOException`

    - #### read

          protected final Date read(Object reuse,
                                    Decoder in)
                             throws IOException

      Specified by:
        `read` in class `CustomEncoding<Date>`
      Throws:
        `IOException`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.