Interface DataLookupIfc


public interface DataLookupIfc
An interface implemented by NAR which is used for looking up data fields using integer attribute ids as lookup keys. Data values are stored into a NAR using the methods in DataStoreIfc, also implemented by NAR.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte
    lookupByte(int attrId)
    Retrieves an byte field value with the specified id
    void
    lookupDataBytes(int attrId, byte[] barr, int barrOffset)
    Retrieves the data stored with a specified id by storing the bytes into a given byte array at the specified offset.
    int
    lookupDataLength(int attrId)
    Returns the length of data stored with a specified id expressed in number of bytes.
    int
    lookupDataType(int attrId)
    Retrieves the type of data stored with a specified id
    double
    lookupDouble(int attrId)
    Retrieves an double field value with the specified id
    float
    lookupFloat(int attrId)
    Retrieves a float value with the specified id
    int
    lookupInt(int attrId)
    Retrieves an int field value with the specified id
    long
    lookupLong(int attrId)
    Retrieves an long field value with the specified id
    short
    lookupShort(int attrId)
    Retrieves an short field value with the specified id
    lookupString(int attrId)
    Retrieves a String object with the specified id Use lookupDataBytes() instead, if applicable.
    void
    outputDataBytes(int attrId, OutputStream os)
    Writes the data bytes of a given attribute into a specified output-stream.
  • Method Details

    • lookupDataType

      int lookupDataType(int attrId)
      Retrieves the type of data stored with a specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      int attribute type, e.g. NAR.INT_TYPE, NAR.STRING_TYPE
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
    • lookupDataLength

      int lookupDataLength(int attrId)
      Returns the length of data stored with a specified id expressed in number of bytes.
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      int attribute type, e.g. NAR.INT_TYPE, NAR.STRING_TYPE
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
    • lookupDataBytes

      void lookupDataBytes(int attrId, byte[] barr, int barrOffset)
      Retrieves the data stored with a specified id by storing the bytes into a given byte array at the specified offset. This method would throw a run-time exception if the specified array is not large enough to hold all the bytes of the specified data field starting at the given offset.
      Parameters:
      attrId - Identifier of the desired field
      barr - byte array to store the looked up data
      barrOffset - offset into the barr array where data will be stored
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
    • lookupByte

      byte lookupByte(int attrId)
      Retrieves an byte field value with the specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      byte value stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a byte.
    • lookupInt

      int lookupInt(int attrId)
      Retrieves an int field value with the specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      int value stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a int.
    • lookupShort

      short lookupShort(int attrId)
      Retrieves an short field value with the specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      short value stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a short.
    • lookupLong

      long lookupLong(int attrId)
      Retrieves an long field value with the specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      long value stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a long.
    • lookupFloat

      float lookupFloat(int attrId)
      Retrieves a float value with the specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      float value stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a float.
    • lookupDouble

      double lookupDouble(int attrId)
      Retrieves an double field value with the specified id
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      double value stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a double.
    • lookupString

      String lookupString(int attrId)
      Retrieves a String object with the specified id Use lookupDataBytes() instead, if applicable.
      Parameters:
      attrId - Identifier of the desired field
      Returns:
      String object stored against attrId
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      InvalidAttributeTypeException - if the attribute stored with the given attribute id is not a String.
    • outputDataBytes

      void outputDataBytes(int attrId, OutputStream os) throws IOException
      Writes the data bytes of a given attribute into a specified output-stream. Numeric fields are written out in network byte order, and String objects are encoded with the systems default encoding.
      Parameters:
      attrId - Identifier of the desired field
      os - OutoutStream to which data should be written to.
      Throws:
      NonExistentAttributeException - if there is no attribute with the given attribute id.
      IOException