Class ASDate
java.lang.Object
com.adobe.internal.pdftoolkit.core.types.ASObject
com.adobe.internal.pdftoolkit.core.types.ASDate
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionASDate()Create an ASDate that references this moment in time.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.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.Create an ASDate that points to the moment in time given by theDate.Create an ASDate that points to the moment in time given by theDate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this date is after the specified date.asString()Generates a String for output to the serialized PDF.booleanTests if this date is before the specified date.intCompares two Dates for ordering.intCompares two Dates for ordering.booleanReturn theTimeZonerepresented by this ASDate if the internal representation is valid.inthashCode()booleanReturns if timezone is set explicitly set for this datebooleanIf theASDateobject was instantiated with a string then it may be invalid and not represent a correct date as per the PDF spec.toDate()Return theDaterepresented by this ASDate if the internal representation is valid.toString()Generates a String for debugging, messages, etc.voidwrite(OutputByteStream outputByteStream) Writes the ADate to the given OutputByteStream in the format expected by the PDF Spec.
-
Constructor Details
-
ASDate
public ASDate()Create an ASDate that references this moment in time. -
ASDate
Create an ASDate that points to the moment in time given by theDate. -
ASDate
Create an ASDate that points to the moment in time given by theDate. -
ASDate
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
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
- Throws:
PDFParseException
-
-
Method Details
-
isDateValid
public boolean isDateValid()If theASDateobject 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:
trueif the date is valid;falseotherwise
-
compareTo
Compares two Dates for ordering.- Specified by:
compareToin interfaceComparable- Parameters:
obj- theASDateto be compared.- Returns:
- the value
0if the argument ASDate is equal to this ASDate; a value less than0if this ASDate is before the ASDate argument; and a value greater than0if this ASDate is after the ASDate argument.
-
compareTo
Compares two Dates for ordering.- Parameters:
otherASDate- theASDateto be compared.- Returns:
- the value
0if the argument ASDate is equal to this ASDate; a value less than0if this ASDate is before the ASDate argument; and a value greater than0if this ASDate is after the ASDate argument. Invalid dates are considered to be before other dates.
-
before
Tests if this date is before the specified date.- Parameters:
otherDate- an ASDate- Returns:
trueif and only if the instant represented by thisASDateis strictly earlier than the instant represented byotherDate;falseotherwise
-
after
Tests if this date is after the specified date.- Parameters:
otherDate- an ASDate- Returns:
trueif and only if the instant represented by thisASDateis strictly later than the instant represented byotherDate;falseotherwise
-
equals
-
hashCode
public int hashCode() -
asString
Generates a String for output to the serialized PDF. -
toString
Generates a String for debugging, messages, etc. -
toStringTimezoneUnaware
-
toDate
Return theDaterepresented 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
Return theTimeZonerepresented by this ASDate if the internal representation is valid.- Returns:
- the timezone of this object
-
write
Writes the ADate to the given OutputByteStream in the format expected by the PDF Spec.- Specified by:
writein classASObject- Parameters:
outputByteStream- OutputByteStream to write to.- Throws:
PDFIOException- See Also:
-