LibreOffice Module xmerge (master) 1
Static Public Member Functions | List of all members
org.openoffice.xmerge.util.EndianConverter Class Reference

Helper class providing static methods to convert data to/from Network Byte Order (Big Endian). More...

Static Public Member Functions

static byte[] writeShort (short value)
 Convert a short to a Little Endian representation. More...
 
static byte[] writeInt (int value)
 Convert an integer to a Little Endian representation. More...
 
static byte[] writeDouble (double value)
 Converts a double to a Little Endian representation of a float in IEEE-754 format. More...
 
static short readShort (byte[] value)
 Convert a Little Endian representation of a short to a Java short (Network Byte Order). More...
 
static int readInt (byte[] value)
 Convert a Little Endian representation of an integer to a Java int (Network Byte Order). More...
 
static double readDouble (byte[] value)
 Convert a Little Endian representation of a float in IEEE-754 Little Endian to a Java double (Network Byte Order). More...
 

Detailed Description

Helper class providing static methods to convert data to/from Network Byte Order (Big Endian).

With the introduction of java.nio.ByteOrder and java.nio.ByteBuffer in Java 1.4, it may no longer be necessary to use this class in the future.

Version
1.1

Definition at line 34 of file EndianConverter.java.

Member Function Documentation

◆ readDouble()

static double org.openoffice.xmerge.util.EndianConverter.readDouble ( byte[]  value)
inlinestatic

Convert a Little Endian representation of a float in IEEE-754 Little Endian to a Java double (Network Byte Order).

An array with more than eight elements can be used, but only the first eight elements will be read.

Parameters
valuebyte array containing the LE representation of an IEEE-754 float.
Returns
double containing the converted value.

Definition at line 123 of file EndianConverter.java.

References Double, and value.

◆ readInt()

static int org.openoffice.xmerge.util.EndianConverter.readInt ( byte[]  value)
inlinestatic

Convert a Little Endian representation of an integer to a Java int (Network Byte Order).

An array with more than four elements can be used, but only the first four elements will be read.

Parameters
valuebyte array containing the LE representation of the value.
Returns
int containing the converted value.

Definition at line 106 of file EndianConverter.java.

References value.

◆ readShort()

static short org.openoffice.xmerge.util.EndianConverter.readShort ( byte[]  value)
inlinestatic

Convert a Little Endian representation of a short to a Java short (Network Byte Order).

An array with more than two elements can be used, but only the first two elements will be read.

Parameters
valuebyte array containing the LE representation of the value.
Returns
short containing the converted value.

Definition at line 89 of file EndianConverter.java.

References value.

◆ writeDouble()

static byte[] org.openoffice.xmerge.util.EndianConverter.writeDouble ( double  value)
inlinestatic

Converts a double to a Little Endian representation of a float in IEEE-754 format.

An array with more than eight elements can be used, but only the first eight elements will be read.

Parameters
valuedouble containing the value to be converted.
Returns
byte array containing the LE representation of a IEEE-754 float.

Definition at line 72 of file EndianConverter.java.

References Double, and value.

◆ writeInt()

static byte[] org.openoffice.xmerge.util.EndianConverter.writeInt ( int  value)
inlinestatic

Convert an integer to a Little Endian representation.

Parameters
valueThe int to be converted.
Returns
Four element byte array containing the converted value.

Definition at line 55 of file EndianConverter.java.

References value.

◆ writeShort()

static byte[] org.openoffice.xmerge.util.EndianConverter.writeShort ( short  value)
inlinestatic

Convert a short to a Little Endian representation.

Parameters
valueThe short to be converted.
Returns
Two element byte array containing the converted value.

Definition at line 43 of file EndianConverter.java.

References value.


The documentation for this class was generated from the following file: