Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.client.am
Class DateTime  view DateTime download DateTime.java

java.lang.Object
  extended byorg.apache.derby.client.am.DateTime

public class DateTime
extends java.lang.Object

High performance converters from date/time byte encodings to JDBC Date, Time and Timestamp objects.

Using this class for direct date/time conversions from bytes offers superior performance over the alternative method of first constructing a Java String from the encoded bytes, and then using java.sql.Date.valueOf() 55 , java.sql.Time.valueOf() 55 or java.sql.Timestamp.valueOf() 55 .


Field Summary
private static int dateRepresentationLength
           
private static int timeRepresentationLength
           
private static int timestampRepresentationLength
           
 
Constructor Summary
private DateTime()
           
 
Method Summary
static java.sql.Date dateBytesToDate(byte[] buffer, int offset, java.sql.Date recyclableDate)
          Expected character representation is DERBY string representation of a date, which is in one of the following format.
static java.sql.Timestamp dateBytesToTimestamp(byte[] buffer, int offset, java.sql.Timestamp recyclableTimestamp)
          Expected character representation is DERBY string representation of a date, which is in one of the following format.
static int dateToDateBytes(byte[] buffer, int offset, java.sql.Date date)
          The returned character representation is in JDBC date format: yyyy-mm-dd date format in DERBY string representation of a date.
static int dateToTimestampBytes(byte[] buffer, int offset, java.sql.Date date)
          The returned character representation is in DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.
static java.sql.Time timeBytesToTime(byte[] buffer, int offset, java.sql.Time recyclableTime)
          Expected character representation is DERBY string representation of a time, which is in one of the following format: hh.mm.ss.
static java.sql.Timestamp timeBytesToTimestamp(byte[] buffer, int offset, java.sql.Timestamp recyclableTimestamp)
          Expected character representation is DERBY string representation of a time, which is in one of the following format.
static java.sql.Date timestampBytesToDate(byte[] buffer, int offset, java.sql.Date recyclableDate)
          Expected character representation is DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.
static java.sql.Time timestampBytesToTime(byte[] buffer, int offset, java.sql.Time recyclableTime)
          Expected character representation is DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.
static java.sql.Timestamp timestampBytesToTimestamp(byte[] buffer, int offset, java.sql.Timestamp recyclableTimestamp)
          Expected character representation is DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.
static int timestampToDateBytes(byte[] buffer, int offset, java.sql.Timestamp timestamp)
          The returned character representation is in JDBC date escape format: yyyy-mm-dd, which is the same as JIS date format in DERBY string representation of a date.
static int timestampToTimeBytes(byte[] buffer, int offset, java.sql.Timestamp timestamp)
          The returned character representation is in JDBC time escape format: hh:mm:ss, which is the same as JIS time format in DERBY string representation of a time.
static int timestampToTimestampBytes(byte[] buffer, int offset, java.sql.Timestamp timestamp)
          The returned character representation is in DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.
static int timeToTimeBytes(byte[] buffer, int offset, java.sql.Time time)
          The returned character representation is in JDBC time escape format: hh:mm:ss, which is the same as JIS time format in DERBY string representation of a time.
static int timeToTimestampBytes(byte[] buffer, int offset, java.sql.Time time)
          The returned character representation is in DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateRepresentationLength

private static final int dateRepresentationLength
See Also:
Constant Field Values

timeRepresentationLength

private static final int timeRepresentationLength
See Also:
Constant Field Values

timestampRepresentationLength

private static final int timestampRepresentationLength
See Also:
Constant Field Values
Constructor Detail

DateTime

private DateTime()
Method Detail

dateBytesToDate

public static final java.sql.Date dateBytesToDate(byte[] buffer,
                                                  int offset,
                                                  java.sql.Date recyclableDate)
Expected character representation is DERBY string representation of a date, which is in one of the following format.


timeBytesToTime

public static final java.sql.Time timeBytesToTime(byte[] buffer,
                                                  int offset,
                                                  java.sql.Time recyclableTime)
Expected character representation is DERBY string representation of a time, which is in one of the following format: hh.mm.ss.


timestampBytesToTimestamp

public static final java.sql.Timestamp timestampBytesToTimestamp(byte[] buffer,
                                                                 int offset,
                                                                 java.sql.Timestamp recyclableTimestamp)
Expected character representation is DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.


dateToDateBytes

public static final int dateToDateBytes(byte[] buffer,
                                        int offset,
                                        java.sql.Date date)
                                 throws ConversionException
The returned character representation is in JDBC date format: yyyy-mm-dd date format in DERBY string representation of a date.


timeToTimeBytes

public static final int timeToTimeBytes(byte[] buffer,
                                        int offset,
                                        java.sql.Time time)
The returned character representation is in JDBC time escape format: hh:mm:ss, which is the same as JIS time format in DERBY string representation of a time.


timestampToTimestampBytes

public static final int timestampToTimestampBytes(byte[] buffer,
                                                  int offset,
                                                  java.sql.Timestamp timestamp)
                                           throws ConversionException
The returned character representation is in DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.


dateBytesToTimestamp

public static final java.sql.Timestamp dateBytesToTimestamp(byte[] buffer,
                                                            int offset,
                                                            java.sql.Timestamp recyclableTimestamp)
Expected character representation is DERBY string representation of a date, which is in one of the following format.


timeBytesToTimestamp

public static final java.sql.Timestamp timeBytesToTimestamp(byte[] buffer,
                                                            int offset,
                                                            java.sql.Timestamp recyclableTimestamp)
Expected character representation is DERBY string representation of a time, which is in one of the following format.


timestampBytesToDate

public static final java.sql.Date timestampBytesToDate(byte[] buffer,
                                                       int offset,
                                                       java.sql.Date recyclableDate)
Expected character representation is DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.


timestampBytesToTime

public static final java.sql.Time timestampBytesToTime(byte[] buffer,
                                                       int offset,
                                                       java.sql.Time recyclableTime)
Expected character representation is DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.


timestampToDateBytes

public static final int timestampToDateBytes(byte[] buffer,
                                             int offset,
                                             java.sql.Timestamp timestamp)
                                      throws ConversionException
The returned character representation is in JDBC date escape format: yyyy-mm-dd, which is the same as JIS date format in DERBY string representation of a date.


timestampToTimeBytes

public static final int timestampToTimeBytes(byte[] buffer,
                                             int offset,
                                             java.sql.Timestamp timestamp)
The returned character representation is in JDBC time escape format: hh:mm:ss, which is the same as JIS time format in DERBY string representation of a time.


dateToTimestampBytes

public static final int dateToTimestampBytes(byte[] buffer,
                                             int offset,
                                             java.sql.Date date)
                                      throws ConversionException
The returned character representation is in DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.


timeToTimestampBytes

public static final int timeToTimestampBytes(byte[] buffer,
                                             int offset,
                                             java.sql.Time time)
The returned character representation is in DERBY string representation of a timestamp: yyyy-mm-dd-hh.mm.ss.ffffff.