APIdia Launch Partner
Top Description Inners Fields Constructors Methods
io.github.spannm.jackcess.impl

pack-priv final Class CalculatedColumnUtil

extends Object
Class Inheritance
Imports
io.github.spannm.jackcess.InvalidValueException, java.io.IOException, java.math.BigDecimal, java.nio.ByteBuffer, .ByteOrder

Utility code for dealing with calculated columns.

These are the currently possible calculated types: FLOAT, DOUBLE, INT, LONG, BIG_INT, GUID, SHORT_DATE_TIME, MONEY, BOOLEAN, NUMERIC, TEXT, MEMO.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
CalculatedColumnUtil.CalcBooleanColImpl

Calculated BOOLEAN column implementation.

private static class
CalculatedColumnUtil.CalcColImpl

General calculated column implementation.

private static class
CalculatedColumnUtil.CalcMemoColImpl

Calculated MEMO column implementation.

private static class
CalculatedColumnUtil.CalcNumericColImpl

Calculated NUMERIC column implementation.

private static class
CalculatedColumnUtil.CalcTextColImpl

Calculated TEXT column implementation.

Field Summary

Modifier and TypeField and Description
private static final byte[]
private static final byte[]
private static final int
private static final int
pack-priv static final short
pack-priv static final short

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static ColumnImpl
create(ColumnImpl.InitArgs
column construction info
args
)

Creates the appropriate ColumnImpl class for a calculated column and reads a column definition in from a buffer

private static ByteBuffer
prepareWrappedCalcValue(int dataLen, ByteOrder order)

Prepares a calculated value buffer for data of the given length.

private static byte[]
unwrapCalculatedValue(byte[] data)

Grabs the real data bytes from a calculated value.

private static byte[]
wrapCalculatedValue(byte[] data)

Wraps the given data bytes with the extra calculated value data and returns a new byte[] containing the final data.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CALC_BOOL_FALSEback to summary
private static final byte[] CALC_BOOL_FALSE
CALC_BOOL_TRUEback to summary
private static final byte[] CALC_BOOL_TRUE
CALC_DATA_LEN_OFFSETback to summary
private static final int CALC_DATA_LEN_OFFSET
CALC_DATA_OFFSETback to summary
private static final int CALC_DATA_OFFSET
CALC_EXTRA_DATA_LENback to summary
pack-priv static final short CALC_EXTRA_DATA_LEN
CALC_FIXED_FIELD_LENback to summary
pack-priv static final short CALC_FIXED_FIELD_LEN

Constructor Detail

CalculatedColumnUtilback to summary
private CalculatedColumnUtil()

Method Detail

createback to summary
pack-priv static ColumnImpl create(ColumnImpl.InitArgs args)

Creates the appropriate ColumnImpl class for a calculated column and reads a column definition in from a buffer

Parameters
args:ColumnImpl.InitArgs

column construction info

prepareWrappedCalcValueback to summary
private static ByteBuffer prepareWrappedCalcValue(int dataLen, ByteOrder order)

Prepares a calculated value buffer for data of the given length.

unwrapCalculatedValueback to summary
private static byte[] unwrapCalculatedValue(byte[] data)

Grabs the real data bytes from a calculated value.

wrapCalculatedValueback to summary
private static byte[] wrapCalculatedValue(byte[] data)

Wraps the given data bytes with the extra calculated value data and returns a new byte[] containing the final data.

io.github.spannm.jackcess.impl back to summary

private Class CalculatedColumnUtil.CalcBooleanColImpl

extends ColumnImpl
Class Inheritance

Calculated BOOLEAN column implementation.

Field Summary

Modifier and TypeField and Description
private CalcColEvalContext
Inherited from io.github.spannm.jackcess.impl.ColumnImpl:
AUTO_NUMBER_FLAG_MASKAUTO_NUMBER_GUID_FLAG_MASKBASE_LDBASE_LDTBASE_LTCOMPLEX_FK_EXT_FLAG_MASKCOMPRESSED_UNICODE_EXT_FLAG_MASKFIXED_LEN_FLAG_MASKGENERAL_97_SORT_ORDERGENERAL_LEGACY_SORT_ORDERGENERAL_SORT_ORDERHYPERLINK_FLAG_MASKINVALID_AUTO_NUMBERINVALID_LENGTHLDT_DATE_TIME_FACTORYLOGGERMILLIS_BETWEEN_EPOCH_AND_1900NUMERIC_NEGATIVE_BYTERETURN_ROW_IDRUSSIAN_SORT_ORDERTURKISH_SORT_ORDERUKRAINIAN_SORT_ORDERUPDATABLE_FLAG_MASK

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected CalcColEvalContext
getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

public Object
read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

protected void
public boolean
protected ByteBuffer
Inherited from io.github.spannm.jackcess.impl.ColumnImpl:
booleanToIntegercalcLengthInUnitscollectUsageMapPagescompareTocountVariableLengthcreatedecodeTextValuedecodeUncompressedTextencodeTextValueencodeUncompressedTextfromDateDoublefromLocalDateDoublegenerateDefaultValuegetAutoNumberGeneratorgetCharsetgetColumnIdgetColumnIndexgetColumnNumbergetColumnValidatorgetComplexInfogetDatabasegetDateTimeFactorygetDateTimeFactorygetDisplayIndexgetFixedDataOffsetgetFixedDataSizegetFormatgetLengthgetLengthInUnitsgetNamegetOriginalDataTypegetOwnedPageCountgetPageChannelgetPrecisiongetPropertiesgetRowValuegetRowValuegetScalegetSQLTypegetTablegetTextCodePagegetTextSortOrdergetTimeZonegetTypegetVarLenTableIndexgetVersionHistoryColumngetZoneIdinitColumnValidatorisAppendOnlyisAutoNumberisCalculatedisComplexValueForeignKeyisCompressedUnicodeisGUIDValueisHyperlinkisImmutableValueisRawDataisThisColumnisVariableLengthldtFromLocalDateDoublepostTableLoadInitpropertiesUpdatedrawDataWrapperreadreadCodePagereadExtraFlagsreadFromNullMaskreadSortOrderreloadPropertiesValidatorssetColumnIndexsetColumnValidatorsetRowValuesetRowValuesetUsageMapssetVersionHistoryColumntoBigDecimaltoBigDecimaltoBigDecimaltoBooleanValuetoByteArraytoCharSequencetoDateDoubletoDateDoubletoInternalValuetoInternalValuetoLocalDateDoubletoLocalDateTimetoStringtoUnscaledByteArrayvalidatewithErrorContextwritewritewriteColUsageMapDefinitionwriteColUsageMapDefinitionswriteDefinitionwriteDefinitionswriteFixedLengthFieldwriteFixedLengthFieldwriteToNullMask

Field Detail

calcColback to summary
private CalcColEvalContext calcCol

Constructor Detail

CalcBooleanColImplback to summary
pack-priv CalcBooleanColImpl(ColumnImpl.InitArgs args)

Method Detail

getCalculationContextback to summary
protected CalcColEvalContext getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

Annotations
@Override
readback to summary
public Object read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

Annotations
@Override
setCalcColEvalContextback to summary
protected void setCalcColEvalContext(CalcColEvalContext newCalcCol)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.setCalcColEvalContext.

Annotations
@Override
storeInNullMaskback to summary
public boolean storeInNullMask()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.storeInNullMask.

Annotations
@Override
writeRealDataback to summary
protected ByteBuffer writeRealData(Object obj, int remainingRowLength, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.writeRealData.

Annotations
@Override
io.github.spannm.jackcess.impl back to summary

private Class CalculatedColumnUtil.CalcColImpl

extends ColumnImpl
Class Inheritance

General calculated column implementation.

Field Summary

Modifier and TypeField and Description
private CalcColEvalContext
Inherited from io.github.spannm.jackcess.impl.ColumnImpl:
AUTO_NUMBER_FLAG_MASKAUTO_NUMBER_GUID_FLAG_MASKBASE_LDBASE_LDTBASE_LTCOMPLEX_FK_EXT_FLAG_MASKCOMPRESSED_UNICODE_EXT_FLAG_MASKFIXED_LEN_FLAG_MASKGENERAL_97_SORT_ORDERGENERAL_LEGACY_SORT_ORDERGENERAL_SORT_ORDERHYPERLINK_FLAG_MASKINVALID_AUTO_NUMBERINVALID_LENGTHLDT_DATE_TIME_FACTORYLOGGERMILLIS_BETWEEN_EPOCH_AND_1900NUMERIC_NEGATIVE_BYTERETURN_ROW_IDRUSSIAN_SORT_ORDERTURKISH_SORT_ORDERUKRAINIAN_SORT_ORDERUPDATABLE_FLAG_MASK

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected CalcColEvalContext
getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

public Object
read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

protected void
protected ByteBuffer
Inherited from io.github.spannm.jackcess.impl.ColumnImpl:
booleanToIntegercalcLengthInUnitscollectUsageMapPagescompareTocountVariableLengthcreatedecodeTextValuedecodeUncompressedTextencodeTextValueencodeUncompressedTextfromDateDoublefromLocalDateDoublegenerateDefaultValuegetAutoNumberGeneratorgetCharsetgetColumnIdgetColumnIndexgetColumnNumbergetColumnValidatorgetComplexInfogetDatabasegetDateTimeFactorygetDateTimeFactorygetDisplayIndexgetFixedDataOffsetgetFixedDataSizegetFormatgetLengthgetLengthInUnitsgetNamegetOriginalDataTypegetOwnedPageCountgetPageChannelgetPrecisiongetPropertiesgetRowValuegetRowValuegetScalegetSQLTypegetTablegetTextCodePagegetTextSortOrdergetTimeZonegetTypegetVarLenTableIndexgetVersionHistoryColumngetZoneIdinitColumnValidatorisAppendOnlyisAutoNumberisCalculatedisComplexValueForeignKeyisCompressedUnicodeisGUIDValueisHyperlinkisImmutableValueisRawDataisThisColumnisVariableLengthldtFromLocalDateDoublepostTableLoadInitpropertiesUpdatedrawDataWrapperreadreadCodePagereadExtraFlagsreadFromNullMaskreadSortOrderreloadPropertiesValidatorssetColumnIndexsetColumnValidatorsetRowValuesetRowValuesetUsageMapssetVersionHistoryColumnstoreInNullMasktoBigDecimaltoBigDecimaltoBigDecimaltoBooleanValuetoByteArraytoCharSequencetoDateDoubletoDateDoubletoInternalValuetoInternalValuetoLocalDateDoubletoLocalDateTimetoStringtoUnscaledByteArrayvalidatewithErrorContextwritewritewriteColUsageMapDefinitionwriteColUsageMapDefinitionswriteDefinitionwriteDefinitionswriteFixedLengthFieldwriteFixedLengthFieldwriteToNullMask

Field Detail

calcColback to summary
private CalcColEvalContext calcCol

Constructor Detail

CalcColImplback to summary
pack-priv CalcColImpl(ColumnImpl.InitArgs args)

Method Detail

getCalculationContextback to summary
protected CalcColEvalContext getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

Annotations
@Override
readback to summary
public Object read(byte[] data, ByteOrder order) throws IOException

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

Annotations
@Override
setCalcColEvalContextback to summary
protected void setCalcColEvalContext(CalcColEvalContext newCalcCol)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.setCalcColEvalContext.

Annotations
@Override
writeRealDataback to summary
protected ByteBuffer writeRealData(Object obj, int remainingRowLength, ByteOrder order) throws IOException

Overrides io.github.spannm.jackcess.impl.ColumnImpl.writeRealData.

Annotations
@Override
io.github.spannm.jackcess.impl back to summary

private Class CalculatedColumnUtil.CalcMemoColImpl

extends MemoColumnImpl
Class Inheritance

Calculated MEMO column implementation.

Field Summary

Modifier and TypeField and Description
private CalcColEvalContext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected int
protected CalcColEvalContext
getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

protected byte[]
readLongValue(byte[] lvalDefinition)

Overrides io.github.spannm.jackcess.impl.LongValueColumnImpl.readLongValue.

Returns the LVAL data.

protected void
protected ByteBuffer
writeLongValue(byte[] value, int remainingRowLength)

Overrides io.github.spannm.jackcess.impl.LongValueColumnImpl.writeLongValue.

Write an LVAL column into a ByteBuffer inline if it fits, otherwise in other data page(s).

Inherited from io.github.spannm.jackcess.impl.MemoColumnImpl:
getTextCodePagegetTextSortOrdergetVersionHistoryColumnisCompressedUnicodeisHyperlinksetVersionHistoryColumn

Field Detail

calcColback to summary
private CalcColEvalContext calcCol

Constructor Detail

CalcMemoColImplback to summary
pack-priv CalcMemoColImpl(ColumnImpl.InitArgs args)

Method Detail

calcMaxLengthInUnitsback to summary
protected int calcMaxLengthInUnits()

Overrides io.github.spannm.jackcess.impl.LongValueColumnImpl.calcMaxLengthInUnits.

Annotations
@Override
getCalculationContextback to summary
protected CalcColEvalContext getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

Annotations
@Override
readLongValueback to summary
protected byte[] readLongValue(byte[] lvalDefinition) throws IOException

Overrides io.github.spannm.jackcess.impl.LongValueColumnImpl.readLongValue.

Doc from io.github.spannm.jackcess.impl.LongValueColumnImpl.readLongValue.

Returns the LVAL data.

Annotations
@Override
setCalcColEvalContextback to summary
protected void setCalcColEvalContext(CalcColEvalContext newCalcCol)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.setCalcColEvalContext.

Annotations
@Override
writeLongValueback to summary
protected ByteBuffer writeLongValue(byte[] value, int remainingRowLength) throws IOException

Overrides io.github.spannm.jackcess.impl.LongValueColumnImpl.writeLongValue.

Doc from io.github.spannm.jackcess.impl.LongValueColumnImpl.writeLongValue.

Write an LVAL column into a ByteBuffer inline if it fits, otherwise in other data page(s).

Annotations
@Override
io.github.spannm.jackcess.impl back to summary

private Class CalculatedColumnUtil.CalcNumericColImpl

extends NumericColumnImpl
Class Inheritance

Calculated NUMERIC column implementation.

Field Summary

Modifier and TypeField and Description
private CalcColEvalContext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
fixNumericByteOrder(byte[] bytes)

Hides io.github.spannm.jackcess.impl.ColumnImpl.fixNumericByteOrder.

Swaps the bytes of the given numeric in place.

protected CalcColEvalContext
getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

public byte
getPrecision()

Overrides io.github.spannm.jackcess.impl.NumericColumnImpl.getPrecision.

Implements io.github.spannm.jackcess.Column.getPrecision.

Returns the numeric precision of this column (only meaningful for DataTypes NUMERIC and MONEY).

public Object
read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

private static BigDecimal
protected void
private static int
toMul4(int val)

private void
writeCalcNumericValue(ByteBuffer buffer, Object value, int dataLen)

protected ByteBuffer
Inherited from io.github.spannm.jackcess.impl.NumericColumnImpl:
getScale

Field Detail

calcColback to summary
private CalcColEvalContext calcCol

Constructor Detail

CalcNumericColImplback to summary
pack-priv CalcNumericColImpl(ColumnImpl.InitArgs args)

Method Detail

fixNumericByteOrderback to summary
private static void fixNumericByteOrder(byte[] bytes)

Hides io.github.spannm.jackcess.impl.ColumnImpl.fixNumericByteOrder.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.fixNumericByteOrder.

Swaps the bytes of the given numeric in place.

getCalculationContextback to summary
protected CalcColEvalContext getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

Annotations
@Override
getPrecisionback to summary
public byte getPrecision()

Overrides io.github.spannm.jackcess.impl.NumericColumnImpl.getPrecision.

Implements io.github.spannm.jackcess.Column.getPrecision.

Doc from io.github.spannm.jackcess.Column.getPrecision.

Returns the numeric precision of this column (only meaningful for DataTypes NUMERIC and MONEY).

Annotations
@Override
readback to summary
public Object read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

Annotations
@Override
readCalcNumericValueback to summary
private static BigDecimal readCalcNumericValue(ByteBuffer buffer)
setCalcColEvalContextback to summary
protected void setCalcColEvalContext(CalcColEvalContext newCalcCol)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.setCalcColEvalContext.

Annotations
@Override
toMul4back to summary
private static int toMul4(int val)
writeCalcNumericValueback to summary
private void writeCalcNumericValue(ByteBuffer buffer, Object value, int dataLen) throws IOException
writeRealDataback to summary
protected ByteBuffer writeRealData(Object obj, int remainingRowLength, ByteOrder order) throws IOException

Overrides io.github.spannm.jackcess.impl.ColumnImpl.writeRealData.

Annotations
@Override
io.github.spannm.jackcess.impl back to summary

private Class CalculatedColumnUtil.CalcTextColImpl

extends TextColumnImpl
Class Inheritance

Calculated TEXT column implementation.

Field Summary

Modifier and TypeField and Description
private CalcColEvalContext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected int
protected CalcColEvalContext
getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

public Object
read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

protected void
private static ByteBuffer
wrapCalculatedValue(ByteBuffer buffer)

Wraps the given data bytes with the extra calculated value data and returns a new ByteBuffer containing the final data.

protected ByteBuffer
Inherited from io.github.spannm.jackcess.impl.TextColumnImpl:
getTextCodePagegetTextSortOrderisCompressedUnicode

Field Detail

calcColback to summary
private CalcColEvalContext calcCol

Constructor Detail

CalcTextColImplback to summary
pack-priv CalcTextColImpl(ColumnImpl.InitArgs args)

Method Detail

calcLengthInUnitsback to summary
protected int calcLengthInUnits()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.calcLengthInUnits.

Annotations
@Override
getCalculationContextback to summary
protected CalcColEvalContext getCalculationContext()

Overrides io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.getCalculationContext.

Returns the context used to manage calculated column values.

Annotations
@Override
readback to summary
public Object read(byte[] data, ByteOrder order)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.read.

Doc from io.github.spannm.jackcess.impl.ColumnImpl.read.

Deserialize a raw byte value for this column into an Object

Annotations
@Override
setCalcColEvalContextback to summary
protected void setCalcColEvalContext(CalcColEvalContext newCalcCol)

Overrides io.github.spannm.jackcess.impl.ColumnImpl.setCalcColEvalContext.

Annotations
@Override
wrapCalculatedValueback to summary
private static ByteBuffer wrapCalculatedValue(ByteBuffer buffer)

Wraps the given data bytes with the extra calculated value data and returns a new ByteBuffer containing the final data.

writeRealDataback to summary
protected ByteBuffer writeRealData(Object obj, int remainingRowLength, ByteOrder order) throws IOException

Overrides io.github.spannm.jackcess.impl.ColumnImpl.writeRealData.

Annotations
@Override