Package htsjdk.variant.bcf2
Enum BCF2Type
- java.lang.Object
-
- java.lang.Enum<BCF2Type>
-
- htsjdk.variant.bcf2.BCF2Type
-
- All Implemented Interfaces:
Serializable
,Comparable<BCF2Type>
public enum BCF2Type extends Enum<BCF2Type>
BCF2 types and associated information- Since:
- 05/12
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getID()
The ID according to the BCF2 specificationint
getMissingBytes()
The bytes (encoded as an int) that are used to represent a missing value for this type in BCF2Object
getMissingJavaValue()
Return the java object (aka null) that is used to represent a missing value for this type in Javaint
getSizeInBytes()
How many bytes are used to represent this type on disk?boolean
isIntegerType()
boolean
isMissingType()
int
read(InputStream in)
Read a value from in stream of this BCF2 type as an int [32 bit] collection of bits For intX and char values this is just the int / byte value of the underlying data represented as a 32 bit int For a char the result must be converted to a char by (char)(byte)(0x0F & value) For doubles it's necessary to convert subsequently this value to a double via Double.bitsToDouble()static BCF2Type
valueOf(String name)
Returns the enum constant of this type with the specified name.static BCF2Type[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.boolean
withinRange(long v)
Can we encode value v in this type, according to its declared range.void
write(int value, OutputStream out)
-
-
-
Method Detail
-
values
public static BCF2Type[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BCF2Type c : BCF2Type.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BCF2Type valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getSizeInBytes
public int getSizeInBytes()
How many bytes are used to represent this type on disk?- Returns:
-
getID
public int getID()
The ID according to the BCF2 specification- Returns:
-
withinRange
public final boolean withinRange(long v)
Can we encode value v in this type, according to its declared range. Only makes sense for integer values- Parameters:
v
-- Returns:
-
getMissingJavaValue
public Object getMissingJavaValue()
Return the java object (aka null) that is used to represent a missing value for this type in Java- Returns:
-
getMissingBytes
public int getMissingBytes()
The bytes (encoded as an int) that are used to represent a missing value for this type in BCF2- Returns:
-
isMissingType
public boolean isMissingType()
- Returns:
- true if this BCF2Type corresponds to the magic "MISSING" type (0x00)
-
isIntegerType
public boolean isIntegerType()
-
read
public int read(InputStream in) throws IOException
Read a value from in stream of this BCF2 type as an int [32 bit] collection of bits For intX and char values this is just the int / byte value of the underlying data represented as a 32 bit int For a char the result must be converted to a char by (char)(byte)(0x0F & value) For doubles it's necessary to convert subsequently this value to a double via Double.bitsToDouble()- Parameters:
in
-- Returns:
- Throws:
IOException
-
write
public void write(int value, OutputStream out) throws IOException
- Throws:
IOException
-
-