undeprecate get*() methods with 0 offset
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1187981 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ed5482fbf
commit
2c06f34413
@ -74,6 +74,20 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a double value from a byte array, reads it in little endian format
|
||||||
|
* then converts the resulting revolting IEEE 754 (curse them) floating
|
||||||
|
* point number to a happy java double
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* the byte array
|
||||||
|
* @return the double (64-bit) value
|
||||||
|
*/
|
||||||
|
public static double getDouble( byte[] data )
|
||||||
|
{
|
||||||
|
return Double.longBitsToDouble( getLong( data, 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a double value from a byte array, reads it in little endian format
|
* get a double value from a byte array, reads it in little endian format
|
||||||
* then converts the resulting revolting IEEE 754 (curse them) floating
|
* then converts the resulting revolting IEEE 754 (curse them) floating
|
||||||
@ -90,6 +104,20 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
return Double.longBitsToDouble( getLong( data, offset ) );
|
return Double.longBitsToDouble( getLong( data, offset ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a float value from a byte array, reads it in little endian format
|
||||||
|
* then converts the resulting revolting IEEE 754 (curse them) floating
|
||||||
|
* point number to a happy java float
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* the byte array
|
||||||
|
* @return the double (64-bit) value
|
||||||
|
*/
|
||||||
|
public static float getFloat( byte[] data )
|
||||||
|
{
|
||||||
|
return getFloat( data, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a float value from a byte array, reads it in little endian format
|
* get a float value from a byte array, reads it in little endian format
|
||||||
* then converts the resulting revolting IEEE 754 (curse them) floating
|
* then converts the resulting revolting IEEE 754 (curse them) floating
|
||||||
@ -112,9 +140,7 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
* @param data
|
* @param data
|
||||||
* the byte array
|
* the byte array
|
||||||
* @return the int (32-bit) value
|
* @return the int (32-bit) value
|
||||||
* @deprecated Use {@link #getInt(byte[], int)}
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static int getInt( byte[] data )
|
public static int getInt( byte[] data )
|
||||||
{
|
{
|
||||||
return getInt( data, 0 );
|
return getInt( data, 0 );
|
||||||
@ -139,6 +165,18 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
return ( b3 << 24 ) + ( b2 << 16 ) + ( b1 << 8 ) + ( b0 << 0 );
|
return ( b3 << 24 ) + ( b2 << 16 ) + ( b1 << 8 ) + ( b0 << 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a long value from a byte array
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* the byte array
|
||||||
|
* @return the long (64-bit) value
|
||||||
|
*/
|
||||||
|
public static long getLong( byte[] data )
|
||||||
|
{
|
||||||
|
return getLong( data, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a long value from a byte array
|
* get a long value from a byte array
|
||||||
*
|
*
|
||||||
@ -150,7 +188,7 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
*/
|
*/
|
||||||
public static long getLong( byte[] data, int offset )
|
public static long getLong( byte[] data, int offset )
|
||||||
{
|
{
|
||||||
long result = 0;
|
long result = 0xff & data[offset + 7];
|
||||||
|
|
||||||
for ( int j = offset + LONG_SIZE - 1; j >= offset; j-- )
|
for ( int j = offset + LONG_SIZE - 1; j >= offset; j-- )
|
||||||
{
|
{
|
||||||
@ -166,9 +204,7 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
* @param data
|
* @param data
|
||||||
* the byte array
|
* the byte array
|
||||||
* @return the short (16-bit) value
|
* @return the short (16-bit) value
|
||||||
* @deprecated Use {@link #getShort(byte[], int)} instead
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static short getShort( byte[] data )
|
public static short getShort( byte[] data )
|
||||||
{
|
{
|
||||||
return getShort( data, 0 );
|
return getShort( data, 0 );
|
||||||
@ -212,6 +248,18 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the unsigned value of a byte.
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* the byte array.
|
||||||
|
* @return the unsigned value of the byte as a 16 bit short
|
||||||
|
*/
|
||||||
|
public static short getUByte( byte[] data )
|
||||||
|
{
|
||||||
|
return (short) ( data[0] & 0xFF );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the unsigned value of a byte.
|
* get the unsigned value of a byte.
|
||||||
*
|
*
|
||||||
@ -232,9 +280,7 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
* @param data
|
* @param data
|
||||||
* the byte array
|
* the byte array
|
||||||
* @return the unsigned int (32-bit) value in a long
|
* @return the unsigned int (32-bit) value in a long
|
||||||
* @deprecated Use {@link #getUInt(byte[], int)}
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static long getUInt( byte[] data )
|
public static long getUInt( byte[] data )
|
||||||
{
|
{
|
||||||
return getUInt( data, 0 );
|
return getUInt( data, 0 );
|
||||||
@ -277,9 +323,7 @@ public class LittleEndian implements LittleEndianConsts
|
|||||||
* @param data
|
* @param data
|
||||||
* the byte array
|
* the byte array
|
||||||
* @return the unsigned short (16-bit) value in an int
|
* @return the unsigned short (16-bit) value in an int
|
||||||
* @deprecated Use {@link #getUShort(byte[], int)}
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static int getUShort( byte[] data )
|
public static int getUShort( byte[] data )
|
||||||
{
|
{
|
||||||
return getUShort( data, 0 );
|
return getUShort( data, 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user