org.fudgemsg.types
Class UnknownFudgeFieldType

java.lang.Object
  extended by org.fudgemsg.FudgeFieldType<UnknownFudgeFieldValue>
      extended by org.fudgemsg.types.UnknownFudgeFieldType
All Implemented Interfaces:
Serializable

public class UnknownFudgeFieldType
extends FudgeFieldType<UnknownFudgeFieldValue>

A type class for handling variable sized field values where the type isn't available in the current FudgeTypeDictionary.

See Also:
Serialized Form

Constructor Summary
UnknownFudgeFieldType(int typeId)
          Creates a new UnknownFudgeFieldType for the given type identifier.
 
Method Summary
 int getVariableSize(UnknownFudgeFieldValue value, FudgeTaxonomy taxonomy)
          Gets the number of bytes used to encode a value.
 UnknownFudgeFieldValue readValue(DataInput input, int dataSize)
          Reads a value of this type to the output.
 void writeValue(DataOutput output, UnknownFudgeFieldValue value)
          Writes a value of this type to the output.
 
Methods inherited from class org.fudgemsg.FudgeFieldType
equals, getFixedSize, getJavaType, getTypeId, hashCode, isVariableSize, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnknownFudgeFieldType

public UnknownFudgeFieldType(int typeId)
Creates a new UnknownFudgeFieldType for the given type identifier.

Parameters:
typeId - the type identifier not recognised by the FudgeTypeDictionary
Method Detail

getVariableSize

public int getVariableSize(UnknownFudgeFieldValue value,
                           FudgeTaxonomy taxonomy)
Gets the number of bytes used to encode a value.

A variable width type must override this method. A fixed width type will return the fixed size.

Overrides:
getVariableSize in class FudgeFieldType<UnknownFudgeFieldValue>
Parameters:
value - the value to check, not used for fixed width types
taxonomy - the taxonomy being used for the encoding, not used for fixed width types
Returns:
the size in bytes

readValue

public UnknownFudgeFieldValue readValue(DataInput input,
                                        int dataSize)
                                 throws IOException
Reads a value of this type to the output.

This is intended for use by variable width types and must read the given value. The implementation must read exactly the number of bytes passed into the method.

Overrides:
readValue in class FudgeFieldType<UnknownFudgeFieldValue>
Parameters:
input - the input source to read the value from, not null
dataSize - the number of bytes of data to read
Returns:
the value that was read
Throws:
IOException - if an error occurs, which must be wrapped by the caller

writeValue

public void writeValue(DataOutput output,
                       UnknownFudgeFieldValue value)
                throws IOException
Writes a value of this type to the output.

This is intended for use by variable width types and must write the given value. The implementation must write exactly the number of bytes returned by the size calculation.

Overrides:
writeValue in class FudgeFieldType<UnknownFudgeFieldValue>
Parameters:
output - the output target to write the value to, not null
value - the value to write
Throws:
IOException - if an error occurs, which must be wrapped by the caller


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