|
Oracle® Coherence Java API Reference Release 3.7.0.0 E18683-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.io.pof.PofHelper
public abstract class PofHelper
Collection of helper methods for POF streams.
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 java.math.BigInteger |
BIGINTEGER_MAX_LONG The BigInteger representation of Long.MAX_VALUE. |
static java.math.BigInteger |
BIGINTEGER_MIN_LONG The BigInteger representation of Long.MIN_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. |
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 boolean |
isIntrinsicPofType(java.lang.Class clz) Determine if the given class can be represented as an intrinsic POF type. |
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. |
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 |
---|
public static final java.math.BigInteger BIGINTEGER_MAX_LONG
public static final java.math.BigInteger BIGINTEGER_MIN_LONG
public static final java.math.BigDecimal BIGDECIMAL_ZERO
public static final boolean[] BOOLEAN_ARRAY_EMPTY
public static final byte[] BYTE_ARRAY_EMPTY
public static final char[] CHAR_ARRAY_EMPTY
public static final short[] SHORT_ARRAY_EMPTY
public static final int[] INT_ARRAY_EMPTY
public static final long[] LONG_ARRAY_EMPTY
public static final float[] FLOAT_ARRAY_EMPTY
public static final double[] DOUBLE_ARRAY_EMPTY
public static final java.lang.Object[] OBJECT_ARRAY_EMPTY
public static final java.util.Collection COLLECTION_EMPTY
public static final Binary BINARY_EMPTY
Constructor Detail |
---|
public PofHelper()
Method Detail |
---|
public static int getJavaTypeId(java.lang.Object o, PofContext ctx)
o
- an object to determine the type ofctx
- the PofContext used to determine if the object is an instance of a valid user type; must not be nullPofConstants
class J_* constantspublic static int getPofTypeId(java.lang.Class clz, PofContext ctx)
clz
- the class; must not be nullctx
- the PofContext used to determine the type identifier of a user type; must not be nullPofConstants
class T_* constantsjava.lang.IllegalArgumentException
- if the user type associated with the given object is unknown to the specified PofContextpublic static boolean isIntrinsicPofType(java.lang.Class clz)
clz
- the class; must not be nullpublic static java.lang.Number convertNumber(java.lang.Number number, int nJavaTypeId)
number
- the number to convertnJavaTypeId
- the Java type ID to convert to, one of the J_* enumerated valuespublic static java.util.Date convertToDate(java.lang.Object o)
o
- an Object of type Date, RawDate, RawTime or RawDateTimepublic static java.lang.Object[] resizeArray(java.lang.Object[] aoOld, int cNew)
aoOld
- the "template" array or nullcNew
- the number of desired elements in the new arraypublic static int decodeTinyInt(int n)
n
- the integer value that the integer is encoded aspublic static char readChar(java.io.DataInput in) throws java.io.IOException
in
- the DataInput object to read fromjava.io.IOException
- on read errorpublic static java.math.BigInteger readBigInteger(java.io.DataInput in) throws java.io.IOException
in
- the DataInput object to read fromjava.io.IOException
- on read errorpublic static RawQuad readQuad(ReadBuffer.BufferInput in) throws java.io.IOException
in
- the DataInput object to read fromjava.io.IOException
- on read errorpublic static java.math.BigDecimal readBigDecimal(ReadBuffer.BufferInput in, int cBytes) throws java.io.IOException
in
- the DataInput object to read fromcBytes
- the number of bytes for the IEEE754 value: 4, 8 or 16java.io.IOException
- on read errorpublic static RawDate readRawDate(ReadBuffer.BufferInput in) throws java.io.IOException
in
- the stream containing the POF date valuejava.io.IOException
- on read errorpublic static RawTime readRawTime(ReadBuffer.BufferInput in) throws java.io.IOException
in
- the stream containing the POF time valuejava.io.IOException
- on read errorpublic static char readAsChar(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a char valuepublic static int readAsInt(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to an integer valuepublic static long readAsLong(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a long valuepublic static float readAsFloat(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a float valuepublic static double readAsDouble(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a double valuepublic static RawQuad readAsQuad(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a double valuepublic static java.math.BigInteger readAsBigInteger(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a BigInteger valuepublic static java.math.BigDecimal readAsBigDecimal(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the POF stream containing the valuenType
- the POF type of the valuejava.io.IOException
- if an I/O error occurs reading the POF stream, or the POF value cannot be coerced to a BigDecimal valuepublic static void skipValue(ReadBuffer.BufferInput in) throws java.io.IOException
in
- the BufferInput containing the POF streamjava.io.IOException
- on read errorpublic static void skipUniformValue(ReadBuffer.BufferInput in, int nType) throws java.io.IOException
in
- the BufferInput containing the POF streamnType
- the type of the value to skipjava.io.IOException
- on read errorpublic static void skipPackedInts(ReadBuffer.BufferInput in, int c) throws java.io.IOException
in
- the BufferInput containing the POF streamc
- the number of packed integers to skip overjava.io.IOException
- on read errorpublic static void writeBigInteger(WriteBuffer.BufferOutput out, java.math.BigInteger n) throws java.io.IOException
out
- the DataOutput to write ton
- the BigInteger valuejava.io.IOException
- on write errorpublic static void writeBigDecimal(WriteBuffer.BufferOutput out, java.math.BigDecimal dec, int cBytes) throws java.io.IOException
out
- the DataOutput to write todec
- the BigDecimal valuecBytes
- the number of bytes for the IEEE754 value: 4, 8 or 16java.io.IOException
- on write errorpublic static int encodeTinyInt(int n)
n
- an integer between -1 and 22 inclusivepublic static void writeDate(WriteBuffer.BufferOutput out, int nYear, int nMonth, int nDay) throws java.io.IOException
out
- the BufferOutput to write tonYear
- the year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900nMonth
- 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 ISO8601java.io.IOException
- thrown if the passed BufferOutput object throws an IOException while the value is being written to itpublic static void writeTime(WriteBuffer.BufferOutput out, int nHour, int nMinute, int nSecond, int nNano, int nTimeZoneType, int nHourOffset, int nMinuteOffset) throws java.io.IOException
out
- the BufferOutput to write tonHour
- the hour between 0 and 23 inclusivenMinute
- the minute value between 0 and 59 inclusivenSecond
- the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)nNano
- the nanosecond value between 0 and 999999999 inclusivenTimeZoneType
- 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 offsetnHourOffset
- the timezone offset in hours from UTC, for example 0 for BST, -5 for EST and 1 for CETnMinuteOffset
- the timezone offset in minutes, for example 0 (in most cases) or 30java.io.IOException
- thrown if the passed BufferOutput object throws an IOException while the value is being written to itpublic static void checkType(int nType)
nType
- the type identifierpublic static void checkElementCount(int cElements)
cElements
- the number of elements in a complex data structurepublic static void checkReferenceRange(int nId)
nId
- the reference identitypublic static void checkDecimalRange(java.math.BigDecimal dec, int cBytes)
dec
- the decimal valuecBytes
- the number of bytes (4, 8 or 16)public static int calcDecimalSize(java.math.BigDecimal dec)
dec
- the decimal valuepublic static void checkDate(int nYear, int nMonth, int nDay)
nYear
- the year numbernMonth
- the month numbernDay
- the day numberpublic static void checkTime(int nHour, int nMinute, int nSecond, int nNano)
nHour
- the hour numbernMinute
- the minute numbernSecond
- the second numbernNano
- the nanosecond numberpublic static void checkTimeZone(int nHourOffset, int nMinuteOffset)
nHourOffset
- the hour offsetnMinuteOffset
- the minute offsetpublic static void checkYearMonthInterval(int cYears, int cMonths)
cYears
- the number of yearscMonths
- the number of monthspublic static void checkTimeInterval(int cHours, int cMinutes, int cSeconds, int cNanos)
cHours
- the number of hourscMinutes
- the number of minutescSeconds
- the number of secondscNanos
- the number of nanosecondspublic static void checkDayTimeInterval(int cDays, int cHours, int cMinutes, int cSeconds, int cNanos)
See http://www.builderau.com.au/architect/database/soa/SQL_basics_Datetime_and_interval_data_types/0,39024547,20269031,00.htm
cDays
- the number of dayscHours
- the number of hourscMinutes
- the number of minutescSeconds
- the number of secondscNanos
- the number of nanosecondspublic static java.lang.String formatDate(int nYear, int nMonth, int nDay)
nYear
- the year numbernMonth
- the month numbernDay
- the day numberpublic static java.lang.String formatTime(int nHour, int nMinute, int nSecond, int nNano, boolean fUTC)
nHour
- the hour numbernMinute
- the minute numbernSecond
- the second numbernNano
- the nanosecond numberfUTC
- true for UTC, false for no time zonepublic static java.lang.String formatTime(int nHour, int nMinute, int nSecond, int nNano, int nHourOffset, int nMinuteOffset)
nHour
- the hour numbernMinute
- the minute numbernSecond
- the second numbernNano
- the nanosecond numbernHourOffset
- the timezone offset in hoursnMinuteOffset
- the timezone offset in minutes
|
Oracle® Coherence Java API Reference Release 3.7.0.0 E18683-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |