Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


com.tangosol.io.pof
Class PofHelper

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.io.pof.PofHelper

All Implemented Interfaces:
PofConstants
Direct Known Subclasses:
ExternalizableLitePofSerializer, ExternalizablePofSerializer, LoggingPofHandler, PofBufferReader, PofBufferWriter, PofParser, PofPrincipal, PortableObjectSerializer, RawDate, RawDateTime, RawDayTimeInterval, RawTime, RawTimeInterval, RawYearMonthInterval, ValidatingPofHandler, WritingPofHandler, XmlSerializablePofSerializer

public abstract class PofHelper
extends Base
implements PofConstants

Collection of helper methods for POF streams.

Since:
Coherence 3.2
Author:
cp/jh 2006.07.17

Nested Class Summary
static class PofHelper.ReadableEntrySetMap
          Map implementation backed by a List of Map.Entry objects.
static class PofHelper.WriteableEntrySetMap
          Immutable Map implementation backed by a Set of Map.Entry objects.

 

Field Summary
static java.math.BigDecimal BIGDECIMAL_ZERO
          The default BigDecimal value.
static Binary BINARY_EMPTY
          An empty Binary value.
static boolean[] BOOLEAN_ARRAY_EMPTY
          An empty array of bytes.
static byte[] BYTE_ARRAY_EMPTY
          An empty array of bytes.
static char[] CHAR_ARRAY_EMPTY
          An empty array of chars.
static java.util.Collection COLLECTION_EMPTY
          An empty (and immutable) collection.
static double[] DOUBLE_ARRAY_EMPTY
          An empty array of doubles.
static float[] FLOAT_ARRAY_EMPTY
          An empty array of floats.
static int[] INT_ARRAY_EMPTY
          An empty array of ints.
static long[] LONG_ARRAY_EMPTY
          An empty array of longs.
static java.lang.Object[] OBJECT_ARRAY_EMPTY
          An empty array of objects.
static short[] SHORT_ARRAY_EMPTY
          An empty array of shorts.

 

Fields inherited from interface com.tangosol.io.pof.PofConstants
J_BIG_DECIMAL, J_BIG_INTEGER, J_BINARY, J_BOOLEAN, J_BOOLEAN_ARRAY, J_BYTE, J_BYTE_ARRAY, J_CHAR_ARRAY, J_CHARACTER, J_COLLECTION, J_DATE, J_DATETIME, J_DOUBLE, J_DOUBLE_ARRAY, J_FLOAT, J_FLOAT_ARRAY, J_INT_ARRAY, J_INTEGER, J_LONG, J_LONG_ARRAY, J_MAP, J_NULL, J_OBJECT_ARRAY, J_QUAD, J_RAW_DATE, J_RAW_DATETIME, J_RAW_DAY_TIME_INTERVAL, J_RAW_TIME, J_RAW_TIME_INTERVAL, J_RAW_YEAR_MONTH_INTERVAL, J_SHORT, J_SHORT_ARRAY, J_SPARSE_ARRAY, J_STRING, J_TIME, J_TIMESTAMP, J_USER_TYPE, MAX_DECIMAL128_SCALE, MAX_DECIMAL128_UNSCALED, MAX_DECIMAL32_SCALE, MAX_DECIMAL32_UNSCALED, MAX_DECIMAL64_SCALE, MAX_DECIMAL64_UNSCALED, MIN_DECIMAL128_SCALE, MIN_DECIMAL32_SCALE, MIN_DECIMAL64_SCALE, T_ARRAY, T_BOOLEAN, T_CHAR, T_CHAR_STRING, T_COLLECTION, T_DATE, T_DATETIME, T_DAY_TIME_INTERVAL, T_DECIMAL128, T_DECIMAL32, T_DECIMAL64, T_FLOAT128, T_FLOAT32, T_FLOAT64, T_IDENTITY, T_INT128, T_INT16, T_INT32, T_INT64, T_MAP, T_OCTET, T_OCTET_STRING, T_REFERENCE, T_SPARSE_ARRAY, T_TIME, T_TIME_INTERVAL, T_UNIFORM_ARRAY, T_UNIFORM_COLLECTION, T_UNIFORM_KEYS_MAP, T_UNIFORM_MAP, T_UNIFORM_SPARSE_ARRAY, T_YEAR_MONTH_INTERVAL, V_BOOLEAN_FALSE, V_BOOLEAN_TRUE, V_COLLECTION_EMPTY, V_FP_NAN, V_FP_NEG_INFINITY, V_FP_POS_INFINITY, V_INT_0, V_INT_1, V_INT_10, V_INT_11, V_INT_12, V_INT_13, V_INT_14, V_INT_15, V_INT_16, V_INT_17, V_INT_18, V_INT_19, V_INT_2, V_INT_20, V_INT_21, V_INT_22, V_INT_3, V_INT_4, V_INT_5, V_INT_6, V_INT_7, V_INT_8, V_INT_9, V_INT_NEG_1, V_REFERENCE_NULL, V_STRING_ZERO_LENGTH

 

Constructor Summary
PofHelper()
           

 

Method Summary
static int calcDecimalSize(java.math.BigDecimal dec)
          Determine the minimum size (in bytes) of the IEEE754 decimal type that would be capable of holding the passed value.
static void checkDate(int nYear, int nMonth, int nDay)
          Validate date information.
static void checkDayTimeInterval(int cDays, int cHours, int cMinutes, int cSeconds, int cNanos)
          Validate a day-time interval.
static void checkDecimalRange(java.math.BigDecimal dec, int cBytes)
          Verify that the specified decimal value will fit in the specified number of bits.
static void checkElementCount(int cElements)
          Verify that the number of elements is valid.
static void checkReferenceRange(int nId)
          Validate a reference identifier to make sure it is in a valid range.
static void checkTime(int nHour, int nMinute, int nSecond, int nNano)
          Validate time information.
static void checkTimeInterval(int cHours, int cMinutes, int cSeconds, int cNanos)
          Validate a time interval.
static void checkTimeZone(int nHourOffset, int nMinuteOffset)
          Check the specified timezone offset.
static void checkType(int nType)
          Validate a type identifier.
static void checkYearMonthInterval(int cYears, int cMonths)
          Validate a year-month interval.
static java.lang.Number convertNumber(java.lang.Number number, int nJavaTypeId)
          Convert the passed number to the specified type.
static java.util.Date convertToDate(java.lang.Object o)
          Convert a date, time or date/time value to a Java Date.
static int decodeTinyInt(int n)
          Decode an integer value from one of the reserved single-byte combined type and value indicators.
static int encodeTinyInt(int n)
          Encode an integer value into one of the reserved single-byte combined type and value indicators.
static java.lang.String formatDate(int nYear, int nMonth, int nDay)
          Format a date in the form YYYY-MM-DD.
static java.lang.String formatTime(int nHour, int nMinute, int nSecond, int nNano, boolean fUTC)
          Format a time using the simplest applicable of the following formats: HH:MM HH:MM:SS HH:MM:SS.MMM HH:MM:SS.NNNNNNNNN
static java.lang.String formatTime(int nHour, int nMinute, int nSecond, int nNano, int nHourOffset, int nMinuteOffset)
          Format a time using the simplest applicable of the following formats: HH:MM±HH:MM HH:MM:SS±HH:MM HH:MM:SS.MMM±HH:MM HH:MM:SS.NNNNNNNNN±HH:MM
static int getJavaTypeId(java.lang.Object o, PofContext ctx)
          Return an identifier that represents the Java type of the specified object.
static int getPofTypeId(java.lang.Class clz, PofContext ctx)
          Return an indentifier that represents the POF type of the specified class.
static java.math.BigDecimal readAsBigDecimal(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a BigDecimal.
static java.math.BigInteger readAsBigInteger(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a BigInteger.
static char readAsChar(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a char.
static double readAsDouble(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a double.
static float readAsFloat(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a float.
static int readAsInt(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to an integer.
static long readAsLong(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a long.
static RawQuad readAsQuad(ReadBuffer.BufferInput in, int nType)
          Read a value of the specified encoding from the POF stream and convert it to a quad.
static java.math.BigDecimal readBigDecimal(ReadBuffer.BufferInput in, int cBytes)
          Read an IEEE754 value from the passed DataInput and convert it to a Java BigDecimal.
static java.math.BigInteger readBigInteger(java.io.DataInput in)
          Read a BigInteger value from the passed DataInput.
static char readChar(java.io.DataInput in)
          Read a "char" value from the passed DataInput.
static RawQuad readQuad(ReadBuffer.BufferInput in)
          Read a quad (a 128-bit base-2 IEEE754 value) from the passed DataInput and convert it to a RawQuad.
static RawDate readRawDate(ReadBuffer.BufferInput in)
          Read a RawDate value from a POF stream.
static RawTime readRawTime(ReadBuffer.BufferInput in)
          Read a RawTime value from a POF stream.
static java.lang.Object[] resizeArray(java.lang.Object[] aoOld, int cNew)
          Expand the passed array to contain the specified number of elements, along the lines of the Collection.toArray method.
static void skipPackedInts(ReadBuffer.BufferInput in, int c)
          Skip the specified number of packed integers in the passed POF stream.
static void skipUniformValue(ReadBuffer.BufferInput in, int nType)
          Within the POF stream, skip the next POF value of the specified type.
static void skipValue(ReadBuffer.BufferInput in)
          Within the POF stream, skip the next POF value.
static void writeBigDecimal(WriteBuffer.BufferOutput out, java.math.BigDecimal dec, int cBytes)
          Write a BigDecimal to the passed DataOutput stream as a decimal value.
static void writeBigInteger(WriteBuffer.BufferOutput out, java.math.BigInteger n)
          Write a BigInteger as a packed int.
static void writeDate(WriteBuffer.BufferOutput out, int nYear, int nMonth, int nDay)
          Write a date value to a BufferOutput object.
static void writeTime(WriteBuffer.BufferOutput out, int nHour, int nMinute, int nSecond, int nNano, int nTimeZoneType, int nHourOffset, int nMinuteOffset)
          Write a time value to a BufferOutput object.

 

Field Detail

BIGDECIMAL_ZERO

public static final java.math.BigDecimal BIGDECIMAL_ZERO
The default BigDecimal value.

BOOLEAN_ARRAY_EMPTY

public static final boolean[] BOOLEAN_ARRAY_EMPTY
An empty array of bytes.

BYTE_ARRAY_EMPTY

public static final byte[] BYTE_ARRAY_EMPTY
An empty array of bytes.

CHAR_ARRAY_EMPTY

public static final char[] CHAR_ARRAY_EMPTY
An empty array of chars.

SHORT_ARRAY_EMPTY

public static final short[] SHORT_ARRAY_EMPTY
An empty array of shorts.

INT_ARRAY_EMPTY

public static final int[] INT_ARRAY_EMPTY
An empty array of ints.

LONG_ARRAY_EMPTY

public static final long[] LONG_ARRAY_EMPTY
An empty array of longs.

FLOAT_ARRAY_EMPTY

public static final float[] FLOAT_ARRAY_EMPTY
An empty array of floats.

DOUBLE_ARRAY_EMPTY

public static final double[] DOUBLE_ARRAY_EMPTY
An empty array of doubles.

OBJECT_ARRAY_EMPTY

public static final java.lang.Object[] OBJECT_ARRAY_EMPTY
An empty array of objects.

COLLECTION_EMPTY

public static final java.util.Collection COLLECTION_EMPTY
An empty (and immutable) collection.

BINARY_EMPTY

public static final Binary BINARY_EMPTY
An empty Binary value.

Constructor Detail

PofHelper

public PofHelper()

Method Detail

getJavaTypeId

public static int getJavaTypeId(java.lang.Object o,
                                PofContext ctx)
Return an identifier that represents the Java type of the specified object.
Parameters:
o - an object to determine the type of
ctx - the PofContext used to determine if the object is an instance of a valid user type; must not be null
Returns:
one of the PofConstants class J_* constants

getPofTypeId

public static int getPofTypeId(java.lang.Class clz,
                               PofContext ctx)
Return an indentifier that represents the POF type of the specified class.
Parameters:
clz - the class; must not be null
ctx - the PofContext used to determine the type identifier of a user type; must not be null
Returns:
one of the PofConstants class T_* constants
Throws:
java.lang.IllegalArgumentException - if the user type associated with the given object is unknown to the specified PofContext

convertNumber

public static java.lang.Number convertNumber(java.lang.Number number,
                                             int nJavaTypeId)
Convert the passed number to the specified type.
Parameters:
number - the number to convert
nJavaTypeId - the Java type ID to convert to, one of the J_* enumerated values
Returns:
the number converted to the specified type

convertToDate

public static java.util.Date convertToDate(java.lang.Object o)
Convert a date, time or date/time value to a Java Date.
Parameters:
o - an Object of type Date, RawDate, RawTime or RawDateTime
Returns:
a Java Date Object

resizeArray

public static java.lang.Object[] resizeArray(java.lang.Object[] aoOld,
                                             int cNew)
Expand the passed array to contain the specified number of elements, along the lines of the Collection.toArray method.
Parameters:
aoOld - the "template" array or null
cNew - the number of desired elements in the new array
Returns:
the old array, if it was big enough, or a new array of the same type

decodeTinyInt

public static int decodeTinyInt(int n)
Decode an integer value from one of the reserved single-byte combined type and value indicators.
Parameters:
n - the integer value that the integer is encoded as
Returns:
an integer between -1 and 22 inclusive

readChar

public static char readChar(java.io.DataInput in)
                     throws java.io.IOException
Read a "char" value from the passed DataInput.
Parameters:
in - the DataInput object to read from
Returns:
a char value
Throws:
java.io.IOException

readBigInteger

public static java.math.BigInteger readBigInteger(java.io.DataInput in)
                                           throws java.io.IOException
Read a BigInteger value from the passed DataInput.
Parameters:
in - the DataInput object to read from
Returns:
the BigInteger value
Throws:
java.io.IOException

readQuad

public static RawQuad readQuad(ReadBuffer.BufferInput in)
                        throws java.io.IOException
Read a quad (a 128-bit base-2 IEEE754 value) from the passed DataInput and convert it to a RawQuad.
Parameters:
in - the DataInput object to read from
Returns:
the quad value as a RawQuad
Throws:
java.io.IOException

readBigDecimal

public static java.math.BigDecimal readBigDecimal(ReadBuffer.BufferInput in,
                                                  int cBytes)
                                           throws java.io.IOException
Read an IEEE754 value from the passed DataInput and convert it to a Java BigDecimal.
Parameters:
in - the DataInput object to read from
cBytes - the number of bytes for the IEEE754 value: 4, 8 or 16
Returns:
the BigDecimal value
Throws:
java.io.IOException

readRawDate

public static RawDate readRawDate(ReadBuffer.BufferInput in)
                           throws java.io.IOException
Read a RawDate value from a POF stream.
Parameters:
in - the stream containing the POF date value
Returns:
a RawDate object
Throws:
java.io.IOException

readRawTime

public static RawTime readRawTime(ReadBuffer.BufferInput in)
                           throws java.io.IOException
Read a RawTime value from a POF stream.
Parameters:
in - the stream containing the POF time value
Returns:
a RawTime object
Throws:
java.io.IOException

readAsChar

public static char readAsChar(ReadBuffer.BufferInput in,
                              int nType)
                       throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a char.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as an char
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a char value

readAsInt

public static int readAsInt(ReadBuffer.BufferInput in,
                            int nType)
                     throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to an integer.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as an integer
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to an integer value

readAsLong

public static long readAsLong(ReadBuffer.BufferInput in,
                              int nType)
                       throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a long.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as a long
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a long value

readAsFloat

public static float readAsFloat(ReadBuffer.BufferInput in,
                                int nType)
                         throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a float.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as a float
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a float value

readAsDouble

public static double readAsDouble(ReadBuffer.BufferInput in,
                                  int nType)
                           throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a double.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as a double
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a double value

readAsQuad

public static RawQuad readAsQuad(ReadBuffer.BufferInput in,
                                 int nType)
                          throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a quad.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as a RawQuad
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a double value

readAsBigInteger

public static java.math.BigInteger readAsBigInteger(ReadBuffer.BufferInput in,
                                                    int nType)
                                             throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a BigInteger.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as a BigInteger
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a BigInteger value

readAsBigDecimal

public static java.math.BigDecimal readAsBigDecimal(ReadBuffer.BufferInput in,
                                                    int nType)
                                             throws java.io.IOException
Read a value of the specified encoding from the POF stream and convert it to a BigDecimal.
Parameters:
in - the POF stream containing the value
nType - the POF type of the value
Returns:
the POF value as a BigDecimal
Throws:
java.io.IOException - if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a BigDecimal value

skipValue

public static void skipValue(ReadBuffer.BufferInput in)
                      throws java.io.IOException
Within the POF stream, skip the next POF value.
Parameters:
in - the BufferInput containing the POF stream
Throws:
java.io.IOException

skipUniformValue

public static void skipUniformValue(ReadBuffer.BufferInput in,
                                    int nType)
                             throws java.io.IOException
Within the POF stream, skip the next POF value of the specified type.
Parameters:
in - the BufferInput containing the POF stream
nType - the type of the value to skip
Throws:
java.io.IOException

skipPackedInts

public static void skipPackedInts(ReadBuffer.BufferInput in,
                                  int c)
                           throws java.io.IOException
Skip the specified number of packed integers in the passed POF stream.
Parameters:
in - the BufferInput containing the POF stream
c - the number of packed integers to skip over
Throws:
java.io.IOException

writeBigInteger

public static void writeBigInteger(WriteBuffer.BufferOutput out,
                                   java.math.BigInteger n)
                            throws java.io.IOException
Write a BigInteger as a packed int.
Parameters:
out - the DataOutput to write to
n - the BigInteger value
Throws:
java.io.IOException

writeBigDecimal

public static void writeBigDecimal(WriteBuffer.BufferOutput out,
                                   java.math.BigDecimal dec,
                                   int cBytes)
                            throws java.io.IOException
Write a BigDecimal to the passed DataOutput stream as a decimal value.
Parameters:
out - the DataOutput to write to
dec - the BigDecimal value
cBytes - the number of bytes for the IEEE754 value: 4, 8 or 16
Throws:
java.io.IOException

encodeTinyInt

public static int encodeTinyInt(int n)
Encode an integer value into one of the reserved single-byte combined type and value indicators.
Parameters:
n - an integer between -1 and 22 inclusive
Returns:
the integer value that the integer is encoded as

writeDate

public static void writeDate(WriteBuffer.BufferOutput out,
                             int nYear,
                             int nMonth,
                             int nDay)
                      throws java.io.IOException
Write a date value to a BufferOutput object.
Parameters:
out - the BufferOutput to write to
nYear - the year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900
nMonth - the month number between 1 and 12 inclusive as defined by ISO8601; note the difference from the Java Date class, whose month value is 0-based (0-11)
nDay - the day number between 1 and 31 inclusive as defined by ISO8601
Throws:
java.io.IOException - thrown if the passed BufferOutput object throws an IOException while the value is being written to it

writeTime

public static void writeTime(WriteBuffer.BufferOutput out,
                             int nHour,
                             int nMinute,
                             int nSecond,
                             int nNano,
                             int nTimeZoneType,
                             int nHourOffset,
                             int nMinuteOffset)
                      throws java.io.IOException
Write a time value to a BufferOutput object.
Parameters:
out - the BufferOutput to write to
nHour - the hour between 0 and 23 inclusive
nMinute - the minute value between 0 and 59 inclusive
nSecond - the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)
nNano - the nanosecond value between 0 and 999999999 inclusive
nTimeZoneType - 0 if the time value does not have an explicit time zone, 1 if the time value is UTC and 2 if the time zone has an explicit hour and minute offset
nHourOffset - the timezone offset in hours from UTC, for example 0 for BST, -5 for EST and 1 for CET
nMinuteOffset - the timezone offset in minutes, for example 0 (in most cases) or 30
Throws:
java.io.IOException - thrown if the passed BufferOutput object throws an IOException while the value is being written to it

checkType

public static void checkType(int nType)
Validate a type identifier.
Parameters:
nType - the type identifier

checkElementCount

public static void checkElementCount(int cElements)
Verify that the number of elements is valid.
Parameters:
cElements - the number of elements in a complex data structure

checkReferenceRange

public static void checkReferenceRange(int nId)
Validate a reference identifier to make sure it is in a valid range.
Parameters:
nId - the reference identity

checkDecimalRange

public static void checkDecimalRange(java.math.BigDecimal dec,
                                     int cBytes)
Verify that the specified decimal value will fit in the specified number of bits.
Parameters:
dec - the decimal value
cBytes - the number of bytes (4, 8 or 16)

calcDecimalSize

public static int calcDecimalSize(java.math.BigDecimal dec)
Determine the minimum size (in bytes) of the IEEE754 decimal type that would be capable of holding the passed value.
Parameters:
dec - the decimal value
Returns:
the number of bytes (4, 8 or 16)

checkDate

public static void checkDate(int nYear,
                             int nMonth,
                             int nDay)
Validate date information.
Parameters:
nYear - the year number
nMonth - the month number
nDay - the day number

checkTime

public static void checkTime(int nHour,
                             int nMinute,
                             int nSecond,
                             int nNano)
Validate time information.
Parameters:
nHour - the hour number
nMinute - the minute number
nSecond - the second number
nNano - the nanosecond number

checkTimeZone

public static void checkTimeZone(int nHourOffset,
                                 int nMinuteOffset)
Check the specified timezone offset.
Parameters:
nHourOffset - the hour offset
nMinuteOffset - the minute offset

checkYearMonthInterval

public static void checkYearMonthInterval(int cYears,
                                          int cMonths)
Validate a year-month interval.
Parameters:
cYears - the number of years
cMonths - the number of months

checkTimeInterval

public static void checkTimeInterval(int cHours,
                                     int cMinutes,
                                     int cSeconds,
                                     int cNanos)
Validate a time interval.
Parameters:
cHours - the number of hours
cMinutes - the number of minutes
cSeconds - the number of seconds
cNanos - the number of nanoseconds

checkDayTimeInterval

public static void checkDayTimeInterval(int cDays,
                                        int cHours,
                                        int cMinutes,
                                        int cSeconds,
                                        int cNanos)
Validate a day-time interval. <p/> See http://www.builderau.com.au/architect/database/soa/SQL_basics_Datetime_and_interval_data_types/0,39024547,20269031,00.htm
Parameters:
cDays - the number of days
cHours - the number of hours
cMinutes - the number of minutes
cSeconds - the number of seconds
cNanos - the number of nanoseconds

formatDate

public static java.lang.String formatDate(int nYear,
                                          int nMonth,
                                          int nDay)
Format a date in the form YYYY-MM-DD.
Parameters:
nYear - the year number
nMonth - the month number
nDay - the day number

formatTime

public static java.lang.String formatTime(int nHour,
                                          int nMinute,
                                          int nSecond,
                                          int nNano,
                                          boolean fUTC)
Format a time using the simplest applicable of the following formats:
  1. HH:MM
  2. HH:MM:SS
  3. HH:MM:SS.MMM
  4. HH:MM:SS.NNNNNNNNN
Parameters:
nHour - the hour number
nMinute - the minute number
nSecond - the second number
nNano - the nanosecond number
fUTC - true for UTC, false for no time zone
Returns:
a time String

formatTime

public static java.lang.String formatTime(int nHour,
                                          int nMinute,
                                          int nSecond,
                                          int nNano,
                                          int nHourOffset,
                                          int nMinuteOffset)
Format a time using the simplest applicable of the following formats:
  1. HH:MM±HH:MM
  2. HH:MM:SS±HH:MM
  3. HH:MM:SS.MMM±HH:MM
  4. HH:MM:SS.NNNNNNNNN±HH:MM
Parameters:
nHour - the hour number
nMinute - the minute number
nSecond - the second number
nNano - the nanosecond number
nHourOffset - the timezone offset in hours
nMinuteOffset - the timezone offset in minutes
Returns:
a time String

Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


Copyright © 2000, 2009, Oracle. All rights reserved.