com.jguild.jrpm.io.datatype

Class TypeFactory

public final class TypeFactory extends Object

Factory to create rpm data types.

Version: $Id: TypeFactory.java,v 1.4 2005/11/11 08:27:40 mkuss Exp $

Author: kuss

Method Summary
static BINcreateBIN(byte[] data)
Create a data object of type BIN
static CHARcreateCHAR(char[] data)
Create a data object of type CHAR
static DataTypeIfcreateFromStream(DataInputStream inputStream, IndexEntry indexEntry, long length)
This method creates a rpm data type out of a input stream and an IndexEntry.
static I18NSTRINGcreateI18NSTRING(String[] str)
Create a data object of type I18NSTRING
static INT16createINT16(short[] data)
Create a data object of type INT16
static INT32createINT32(int[] data)
Create a data object of type INT32
static INT64createINT64(long[] data)
Create a data object of type INT64
static INT8createINT8(byte[] data)
Create a data object of type INT8
static NULLcreateNULL(int size)
Create a data object of type NULL
static STRINGcreateSTRING(String str)
Create a data object of type STRING
static STRING_ARRAYcreateSTRING_ARRAY(String[] str)
Create a data object of type STRING_ARRAY

Method Detail

createBIN

public static BIN createBIN(byte[] data)
Create a data object of type BIN

Parameters: data The raw data

Returns: The BIN object

createCHAR

public static CHAR createCHAR(char[] data)
Create a data object of type CHAR

Parameters: data The raw data

Returns: The CHAR object

createFromStream

public static DataTypeIf createFromStream(DataInputStream inputStream, IndexEntry indexEntry, long length)
This method creates a rpm data type out of a input stream and an IndexEntry. The object must at the current position of the input stream. The length is only needed for string objects; the string objects will read length bytes of the input stream and will try to convert the data into a rpm data type.

Parameters: inputStream The input stream indexEntry The IndexEntry that should be read length The number of bytes to read for string objects

Returns: One of the rpm data types coresponding with the type contained in the IndexEntry.

Throws: IOException if something was wrong during reading of the input stream

createI18NSTRING

public static I18NSTRING createI18NSTRING(String[] str)
Create a data object of type I18NSTRING

Parameters: str An array of language strings

Returns: The I18NSTRING object

createINT16

public static INT16 createINT16(short[] data)
Create a data object of type INT16

Parameters: data The raw data

Returns: The INT16 object

createINT32

public static INT32 createINT32(int[] data)
Create a data object of type INT32

Parameters: data The raw data

Returns: The INT32 object

createINT64

public static INT64 createINT64(long[] data)
Create a data object of type INT64

Parameters: data The raw data

Returns: The INT64 object

createINT8

public static INT8 createINT8(byte[] data)
Create a data object of type INT8

Parameters: data The raw data

Returns: The INT8 object

createNULL

public static NULL createNULL(int size)
Create a data object of type NULL

Parameters: size The length of the entry

Returns: The NULL object

createSTRING

public static STRING createSTRING(String str)
Create a data object of type STRING

Parameters: str A raw string

Returns: The STRING object

createSTRING_ARRAY

public static STRING_ARRAY createSTRING_ARRAY(String[] str)
Create a data object of type STRING_ARRAY

Parameters: str Raw strings

Returns: The STRING_ARRAY object