|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neodatis.odb.impl.core.layers.layer3.engine.DefaultByteArrayConverter
public class DefaultByteArrayConverter
Converts array of bytes into native objects and native objects into array of bytes
Constructor Summary | |
---|---|
DefaultByteArrayConverter()
|
Method Summary | |
---|---|
byte[] |
bigDecimalToByteArray(java.math.BigDecimal bigDecimal,
boolean withSize)
|
byte[] |
bigIntegerToByteArray(java.math.BigInteger bigInteger,
boolean withSize)
|
byte[] |
booleanToByteArray(boolean b)
|
void |
booleanToByteArray(boolean b,
byte[] arrayWhereToWrite,
int offset)
|
java.math.BigDecimal |
byteArrayToBigDecimal(byte[] bytes,
boolean hasSize)
|
java.math.BigInteger |
byteArrayToBigInteger(byte[] bytes,
boolean hasSize)
|
boolean |
byteArrayToBoolean(byte[] bytes,
int offset)
|
char |
byteArrayToChar(byte[] bytes)
|
java.util.Date |
byteArrayToDate(byte[] bytes)
|
double |
byteArrayToDouble(byte[] bytes)
|
float |
byteArrayToFloat(byte[] bytes)
|
int |
byteArrayToInt(byte[] bytes,
int offset)
|
long |
byteArrayToLong(byte[] bytes,
int offset)
|
short |
byteArrayToShort(byte[] bytes)
|
java.lang.String |
byteArrayToString(byte[] bytes,
boolean hasSize,
boolean useEncoding)
|
byte[] |
charToByteArray(char c)
|
byte[] |
dateToByteArray(java.util.Date date)
|
byte[] |
doubleToByteArray(double d)
|
byte[] |
floatToByteArray(float f)
|
int |
getNumberOfBytesOfAString(java.lang.String s,
boolean useEncoding)
|
void |
init2()
Two Phase Init method |
byte[] |
intToByteArray(int l)
|
void |
intToByteArray(int l,
byte[] arrayWhereToWrite,
int offset)
This method writes the byte directly to the array parameter |
byte[] |
longToByteArray(long l)
|
void |
longToByteArray(long l,
byte[] arrayWhereToWrite,
int offset)
This method writes the byte directly to the array parameter |
void |
setDatabaseCharacterEncoding(java.lang.String databaseCharacterEncoding)
|
byte[] |
shortToByteArray(short s)
|
byte[] |
stringToByteArray(java.lang.String s,
boolean withSize,
int totalSpace,
boolean withEncoding)
|
void |
testEncoding(java.lang.String encoding)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultByteArrayConverter()
Method Detail |
---|
public void init2()
init2
in interface ITwoPhaseInit
public byte[] booleanToByteArray(boolean b)
booleanToByteArray
in interface IByteArrayConverter
public void booleanToByteArray(boolean b, byte[] arrayWhereToWrite, int offset)
booleanToByteArray
in interface IByteArrayConverter
public boolean byteArrayToBoolean(byte[] bytes, int offset)
byteArrayToBoolean
in interface IByteArrayConverter
public byte[] shortToByteArray(short s)
shortToByteArray
in interface IByteArrayConverter
public short byteArrayToShort(byte[] bytes)
byteArrayToShort
in interface IByteArrayConverter
public byte[] charToByteArray(char c)
charToByteArray
in interface IByteArrayConverter
public char byteArrayToChar(byte[] bytes)
byteArrayToChar
in interface IByteArrayConverter
public int getNumberOfBytesOfAString(java.lang.String s, boolean useEncoding)
getNumberOfBytesOfAString
in interface IByteArrayConverter
public byte[] stringToByteArray(java.lang.String s, boolean withSize, int totalSpace, boolean withEncoding)
stringToByteArray
in interface IByteArrayConverter
withSize
- if true, returns an array with an initial int with its sizetotalSpace
- The total space of the string (can be bigger that the real string size - to support later in place update)withEncoding
- To specify if SPECIFIC encoding must be used
public java.lang.String byteArrayToString(byte[] bytes, boolean hasSize, boolean useEncoding)
byteArrayToString
in interface IByteArrayConverter
hasSize
- If hasSize is true, the first four bytes are the size of the string
public byte[] bigDecimalToByteArray(java.math.BigDecimal bigDecimal, boolean withSize)
bigDecimalToByteArray
in interface IByteArrayConverter
public java.math.BigDecimal byteArrayToBigDecimal(byte[] bytes, boolean hasSize)
byteArrayToBigDecimal
in interface IByteArrayConverter
public byte[] bigIntegerToByteArray(java.math.BigInteger bigInteger, boolean withSize)
bigIntegerToByteArray
in interface IByteArrayConverter
public java.math.BigInteger byteArrayToBigInteger(byte[] bytes, boolean hasSize)
byteArrayToBigInteger
in interface IByteArrayConverter
public byte[] intToByteArray(int l)
intToByteArray
in interface IByteArrayConverter
public void intToByteArray(int l, byte[] arrayWhereToWrite, int offset)
intToByteArray
in interface IByteArrayConverter
public int byteArrayToInt(byte[] bytes, int offset)
byteArrayToInt
in interface IByteArrayConverter
public byte[] longToByteArray(long l)
longToByteArray
in interface IByteArrayConverter
public void longToByteArray(long l, byte[] arrayWhereToWrite, int offset)
longToByteArray
in interface IByteArrayConverter
public long byteArrayToLong(byte[] bytes, int offset)
byteArrayToLong
in interface IByteArrayConverter
public byte[] dateToByteArray(java.util.Date date)
dateToByteArray
in interface IByteArrayConverter
public java.util.Date byteArrayToDate(byte[] bytes)
byteArrayToDate
in interface IByteArrayConverter
public byte[] floatToByteArray(float f)
floatToByteArray
in interface IByteArrayConverter
public float byteArrayToFloat(byte[] bytes)
byteArrayToFloat
in interface IByteArrayConverter
public byte[] doubleToByteArray(double d)
doubleToByteArray
in interface IByteArrayConverter
public double byteArrayToDouble(byte[] bytes)
byteArrayToDouble
in interface IByteArrayConverter
public void setDatabaseCharacterEncoding(java.lang.String databaseCharacterEncoding)
setDatabaseCharacterEncoding
in interface IByteArrayConverter
public void testEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingException
testEncoding
in interface IByteArrayConverter
java.io.UnsupportedEncodingException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |