Package org.firebirdsql.gds
Class VaxEncoding
- java.lang.Object
- 
- org.firebirdsql.gds.VaxEncoding
 
- 
 public final class VaxEncoding extends java.lang.ObjectHelper methods for decoding Vax style (little endian) integers as used by Firebird from byte arrays.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static intdecodeVaxInteger2WithoutLength(java.io.InputStream in)Decodes an integer using two byte Vax encoding from an input stream, without length prefix.static voidencodeVaxInteger(byte[] buf, int off, int val)Encodes an integer using Vax encoding intobuf, length prefix is included.static voidencodeVaxInteger(java.io.OutputStream out, int val)Encodes an integer using Vax encoding into an output stream, length prefix is included.static voidencodeVaxInteger2WithoutLength(byte[] buf, int off, int val)Encodes an integer using two byte Vax encoding intobuf, without length prefix.static voidencodeVaxInteger2WithoutLength(java.io.OutputStream out, int val)Encodes an integer using two byte Vax encoding into an output stream, without length prefix.static voidencodeVaxIntegerWithoutLength(byte[] buf, int off, int val)Encodes an integer using Vax encoding intobuf, without length prefix.static voidencodeVaxIntegerWithoutLength(java.io.OutputStream out, int val)Encodes an integer using Vax encoding into an output stream, without length prefix.static voidencodeVaxLong(byte[] buf, int off, long val)Encodes a long using Vax encoding intobuf, length prefix is included.static voidencodeVaxLong(java.io.OutputStream out, long val)Encodes a long using Vax encoding into an output stream, length prefix is included.static voidencodeVaxLongWithoutLength(byte[] buf, int off, long val)Encodes a long using Vax encoding intobuf, without length prefix.static voidencodeVaxLongWithoutLength(java.io.OutputStream out, long val)Encodes a long using Vax encoding into an output stream, without length prefix.static intiscVaxInteger(byte[] buf, int off, int len)Reads Vax style integers frombuf, starting atoffand reading forlenbytes.static intiscVaxInteger2(byte[] buf, int off)Variant ofiscVaxInteger(byte[], int, int)specifically for two-byte integers.static longiscVaxLong(byte[] buf, int off, int len)Reads Vax style integers (longs) frombuf, starting atoffand reading forlenbytes.
 
- 
- 
- 
Method Detail- 
iscVaxIntegerpublic static int iscVaxInteger(byte[] buf, int off, int len)Reads Vax style integers frombuf, starting atoffand reading forlenbytes.This method is useful for lengths up to 4 bytes (i.e. normal Java integers ( int). For larger lengths it will return0. UseiscVaxLong(byte[], int, int)for reading values with length up to 8 bytes. For decoding 2 byte integers, useiscVaxInteger2(byte[], int)for optimal performance.- Parameters:
- buf- byte array from which the integer is to be retrieved
- off- offset from which to start retrieving byte values
- len- number of bytes to read
- Returns:
- integer value retrieved from the bytes
- See Also:
- iscVaxLong(byte[], int, int),- iscVaxInteger2(byte[], int)
 
 - 
encodeVaxIntegerpublic static void encodeVaxInteger(java.io.OutputStream out, int val) throws java.io.IOExceptionEncodes an integer using Vax encoding into an output stream, length prefix is included.- Parameters:
- out- output stream to write
- val- value to encode
- Throws:
- java.io.IOException
 
 - 
encodeVaxIntegerpublic static void encodeVaxInteger(byte[] buf, int off, int val)Encodes an integer using Vax encoding intobuf, length prefix is included.- Parameters:
- buf- byte array of sufficient size
- off- offset to start writing
- val- value to encode
 
 - 
encodeVaxIntegerWithoutLengthpublic static void encodeVaxIntegerWithoutLength(java.io.OutputStream out, int val) throws java.io.IOExceptionEncodes an integer using Vax encoding into an output stream, without length prefix.- Parameters:
- out- output stream to write
- val- value to encode
- Throws:
- java.io.IOException
 
 - 
encodeVaxIntegerWithoutLengthpublic static void encodeVaxIntegerWithoutLength(byte[] buf, int off, int val)Encodes an integer using Vax encoding intobuf, without length prefix.- Parameters:
- buf- byte array of sufficient size
- off- offset to start writing
- val- value to encode
 
 - 
iscVaxLongpublic static long iscVaxLong(byte[] buf, int off, int len)Reads Vax style integers (longs) frombuf, starting atoffand reading forlenbytes.This method is useful for lengths up to 8 bytes (i.e. normal Java longs ( long). For larger lengths it will return0.- Parameters:
- buf- byte array from which the long is to be retrieved
- off- offset from which to start retrieving byte values
- len- number of bytes to read
- Returns:
- long value retrieved from the bytes
- See Also:
- iscVaxInteger(byte[], int, int),- iscVaxInteger2(byte[], int)
 
 - 
encodeVaxLongpublic static void encodeVaxLong(java.io.OutputStream out, long val) throws java.io.IOExceptionEncodes a long using Vax encoding into an output stream, length prefix is included.- Parameters:
- out- output stream to write
- val- value to encode
- Throws:
- java.io.IOException
 
 - 
encodeVaxLongpublic static void encodeVaxLong(byte[] buf, int off, long val)Encodes a long using Vax encoding intobuf, length prefix is included.- Parameters:
- buf- byte array of sufficient size
- off- offset to start writing
- val- value to encode
 
 - 
encodeVaxLongWithoutLengthpublic static void encodeVaxLongWithoutLength(java.io.OutputStream out, long val) throws java.io.IOExceptionEncodes a long using Vax encoding into an output stream, without length prefix.- Parameters:
- out- output stream to write
- val- value to encode
- Throws:
- java.io.IOException
 
 - 
encodeVaxLongWithoutLengthpublic static void encodeVaxLongWithoutLength(byte[] buf, int off, long val)Encodes a long using Vax encoding intobuf, without length prefix.- Parameters:
- buf- byte array of sufficient size
- off- offset to start writing
- val- value to encode
 
 - 
iscVaxInteger2public static int iscVaxInteger2(byte[] buf, int off)Variant ofiscVaxInteger(byte[], int, int)specifically for two-byte integers.- Parameters:
- buf- byte array from which the integer is to be retrieved
- off- offset from which to start retrieving byte values
- Returns:
- integer value retrieved from the bytes
- See Also:
- iscVaxInteger(byte[], int, int),- iscVaxLong(byte[], int, int)
 
 - 
encodeVaxInteger2WithoutLengthpublic static void encodeVaxInteger2WithoutLength(java.io.OutputStream out, int val) throws java.io.IOExceptionEncodes an integer using two byte Vax encoding into an output stream, without length prefix.- Parameters:
- out- output stream to write
- val- value to encode
- Throws:
- java.io.IOException
 
 - 
encodeVaxInteger2WithoutLengthpublic static void encodeVaxInteger2WithoutLength(byte[] buf, int off, int val)Encodes an integer using two byte Vax encoding intobuf, without length prefix.- Parameters:
- buf- byte array of sufficient size
- off- offset to start writing
- val- value to encode
- Since:
- 5.0.8
 
 - 
decodeVaxInteger2WithoutLengthpublic static int decodeVaxInteger2WithoutLength(java.io.InputStream in) throws java.io.IOExceptionDecodes an integer using two byte Vax encoding from an input stream, without length prefix.- Parameters:
- in- input stream to read
- Returns:
- decoded value
- Throws:
- java.io.IOException- for errors reading from the stream, or if end-of-stream was reached before the full integer
- Since:
- 5.0.7
 
 
- 
 
-