java.lang.Object
com.adobe.internal.pdftoolkit.core.types.ASObject
com.adobe.internal.pdftoolkit.core.types.ASDate
All Implemented Interfaces:
Comparable

public class ASDate extends ASObject implements Comparable
Represents a date which is a specific point in time. It provides for input and output of that date in ASN.1 format that is used by PDF.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an ASDate that references this moment in time.
    ASDate(ASString dateString)
    Create an ASDate that point to the moment in time given by the String representation using the format given in the PDF 1.6 spec on page 133.
    ASDate(String dateString)
    Create an ASDate that point to the moment in time given by the String representation using the format given in the PDF 1.6 spec on page 133.
    ASDate(String dateString, TimeZone zone)
     
    ASDate(Date date)
    Create an ASDate that points to the moment in time given by the Date.
    ASDate(Date date, TimeZone zone)
    Create an ASDate that points to the moment in time given by the Date.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    after(ASDate otherDate)
    Tests if this date is after the specified date.
    Generates a String for output to the serialized PDF.
    boolean
    before(ASDate otherDate)
    Tests if this date is before the specified date.
    int
    compareTo(ASDate otherASDate)
    Compares two Dates for ordering.
    int
    Compares two Dates for ordering.
    boolean
     
    Return the TimeZone represented by this ASDate if the internal representation is valid.
    int
     
    boolean
    Returns if timezone is set explicitly set for this date
    boolean
    If the ASDate object was instantiated with a string then it may be invalid and not represent a correct date as per the PDF spec.
    Return the Date represented by this ASDate if the internal representation is valid.
    Generates a String for debugging, messages, etc.
     
    void
    write(OutputByteStream outputByteStream)
    Writes the ADate to the given OutputByteStream in the format expected by the PDF Spec.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ASDate

      public ASDate()
      Create an ASDate that references this moment in time.
    • ASDate

      public ASDate(Date date)
      Create an ASDate that points to the moment in time given by the Date.
    • ASDate

      public ASDate(Date date, TimeZone zone)
      Create an ASDate that points to the moment in time given by the Date.
    • ASDate

      public ASDate(String dateString) throws PDFParseException
      Create an ASDate that point to the moment in time given by the String representation using the format given in the PDF 1.6 spec on page 133.
      Throws:
      PDFParseException
    • ASDate

      public ASDate(ASString dateString) throws PDFParseException
      Create an ASDate that point to the moment in time given by the String representation using the format given in the PDF 1.6 spec on page 133.
      Throws:
      PDFParseException
    • ASDate

      public ASDate(String dateString, TimeZone zone) throws PDFParseException
      Throws:
      PDFParseException
  • Method Details

    • isDateValid

      public boolean isDateValid()
      If the ASDate object was instantiated with a string then it may be invalid and not represent a correct date as per the PDF spec. If the date is not valid then there is no way to convert the internal representation to a real date or timezone.
      Returns:
      true if the date is valid; false otherwise
    • compareTo

      public int compareTo(Object obj)
      Compares two Dates for ordering.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      obj - the ASDate to be compared.
      Returns:
      the value 0 if the argument ASDate is equal to this ASDate; a value less than 0 if this ASDate is before the ASDate argument; and a value greater than 0 if this ASDate is after the ASDate argument.
    • compareTo

      public int compareTo(ASDate otherASDate)
      Compares two Dates for ordering.
      Parameters:
      otherASDate - the ASDate to be compared.
      Returns:
      the value 0 if the argument ASDate is equal to this ASDate; a value less than 0 if this ASDate is before the ASDate argument; and a value greater than 0 if this ASDate is after the ASDate argument. Invalid dates are considered to be before other dates.
    • before

      public boolean before(ASDate otherDate)
      Tests if this date is before the specified date.
      Parameters:
      otherDate - an ASDate
      Returns:
      true if and only if the instant represented by this ASDate is strictly earlier than the instant represented by otherDate; false otherwise
    • after

      public boolean after(ASDate otherDate)
      Tests if this date is after the specified date.
      Parameters:
      otherDate - an ASDate
      Returns:
      true if and only if the instant represented by this ASDate is strictly later than the instant represented by otherDate; false otherwise
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • asString

      public String asString()
      Generates a String for output to the serialized PDF.
    • toString

      public String toString()
      Generates a String for debugging, messages, etc.
      Overrides:
      toString in class Object
    • toStringTimezoneUnaware

      public String toStringTimezoneUnaware()
    • toDate

      public Date toDate()
      Return the Date represented by this ASDate if the internal representation is valid.
      Returns:
      the date of the this object
    • hasTimeZone

      public boolean hasTimeZone()
      Returns if timezone is set explicitly set for this date
      Returns:
      the timezone of this object
    • getTimeZone

      public TimeZone getTimeZone()
      Return the TimeZone represented by this ASDate if the internal representation is valid.
      Returns:
      the timezone of this object
    • write

      public void write(OutputByteStream outputByteStream) throws PDFIOException
      Writes the ADate to the given OutputByteStream in the format expected by the PDF Spec.
      Specified by:
      write in class ASObject
      Parameters:
      outputByteStream - OutputByteStream to write to.
      Throws:
      PDFIOException
      See Also: