org.fudgemsg
Class FudgeFieldPrefixCodec

java.lang.Object
  extended by org.fudgemsg.FudgeFieldPrefixCodec

public final class FudgeFieldPrefixCodec
extends Object

Utility to manage the one byte field prefix.

This class is a static utility with no shared state.


Method Summary
static int composeFieldPrefix(boolean fixedWidth, int varDataSize, boolean hasOrdinal, boolean hasName)
          Creates a Fudge field prefix byte.
static int getFieldWidthByteCount(int fieldPrefix)
          Returns the length of the field width indicator.
static boolean hasName(int fieldPrefix)
          Tests if the field name present flag is set.
static boolean hasOrdinal(int fieldPrefix)
          Tests if the ordinal value present flag is set.
static boolean isFixedWidth(int fieldPrefix)
          Tests if the fixed width flag is set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isFixedWidth

public static boolean isFixedWidth(int fieldPrefix)
Tests if the fixed width flag is set.

Parameters:
fieldPrefix - the field prefix byte from the field header
Returns:
true if the fixed width flag is set, false otherwise

hasOrdinal

public static boolean hasOrdinal(int fieldPrefix)
Tests if the ordinal value present flag is set.

Parameters:
fieldPrefix - the field prefix byte from the field header
Returns:
true if the ordinal present flag is set, false otherwise

hasName

public static boolean hasName(int fieldPrefix)
Tests if the field name present flag is set.

Parameters:
fieldPrefix - the field prefix byte from the field header
Returns:
true if the name present flag is set, false otherwise

getFieldWidthByteCount

public static int getFieldWidthByteCount(int fieldPrefix)
Returns the length of the field width indicator. If the field is fixed width, a valid Fudge field header will have a field width of zero.

Parameters:
fieldPrefix - the field prefix byte from the field header
Returns:
the number of bytes used for the variable field width

composeFieldPrefix

public static int composeFieldPrefix(boolean fixedWidth,
                                     int varDataSize,
                                     boolean hasOrdinal,
                                     boolean hasName)
Creates a Fudge field prefix byte.

Parameters:
fixedWidth - true if the field type defines the width of the data to follow, false for variable width
varDataSize - the number of bytes of field data - ignored if fixedWidth is true
hasOrdinal - true if the field header will include an ordinal, false otherwise
hasName - true if the field header will include a field name, false otherwise
Returns:
the field prefix byte


Copyright 2009-Present by OpenGamma Inc. and individual contributors
Released under the Apache License, Version 2.0