Interface DataStoreIfc


public interface DataStoreIfc
An interface implemented by NAR which is used for storing data fields using integer attribute ids. Data values stored into a NAR using these methods can be looked up using the methods of DataLookupIfc, also implemented by NAR.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    load(int attrId)
    Stores a null attrubute (with no data) at the specified id Stored type is NAR.NULL_TYPE
    void
    load(int attrId, byte val)
    Stores a given integer value at the specified id Stored type is NAR.BYTE_TYPE
    void
    load(int attrId, byte[] barr)
    Stores a data field given as a byte array at the specified id Stored type is NAR.BYTE_ARRAY_TYPE
    void
    load(int attrId, double val)
    Stores a given floating point value at the specified id Stored type is NAR.DOUBLE_TYPE
    void
    load(int attrId, float val)
    Stores a given floating point value at the specified id Stored type is NAR.FLOAT_TYPE
    void
    load(int attrId, int val)
    Stores a given integer value at the specified id Stored type is NAR.INT_TYPE
    void
    load(int attrId, int type, byte[] barr, int barrOffset, int len)
    Stores a given value of specified type with the specified id.
    void
    load(int attrId, long val)
    Stores a given integer value at the specified id Stored type is NAR.LONG_TYPE
    void
    load(int attrId, short val)
    Stores a given integer value at the specified id Stored type is NAR.SHORT_TYPE
    void
    load(int attrId, String str)
    Stores a String object at the specified id Stored type is NAR.STRING_TYPE
    void
    loadBigEndian(int attrId, int attrType, DataInputStream dis)
    Stores a numeric primitive, e.g.
    void
    loadByteArray(int attrId, InputStream is, int nbytes)
    Stores a given number of bytes of data from a given InputeStream at the specified id.
    void
    loadString(int attrId, Reader rd, char delimChar)
    Stores a String object by reading it in from a given character Reader.
  • Method Details

    • load

      void load(int attrId)
      Stores a null attrubute (with no data) at the specified id Stored type is NAR.NULL_TYPE
      Parameters:
      attrId - Numeric identifier for the field
    • load

      void load(int attrId, byte val)
      Stores a given integer value at the specified id Stored type is NAR.BYTE_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - byte value to be stored in the given field
    • load

      void load(int attrId, short val)
      Stores a given integer value at the specified id Stored type is NAR.SHORT_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - short value to be stored in the given field
    • load

      void load(int attrId, int val)
      Stores a given integer value at the specified id Stored type is NAR.INT_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - integer value to be stored in the given field
    • load

      void load(int attrId, long val)
      Stores a given integer value at the specified id Stored type is NAR.LONG_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - long value to be stored in the given field
    • load

      void load(int attrId, float val)
      Stores a given floating point value at the specified id Stored type is NAR.FLOAT_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - float value to be stored in the given field
    • load

      void load(int attrId, double val)
      Stores a given floating point value at the specified id Stored type is NAR.DOUBLE_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - double value to be stored in the given field
    • load

      void load(int attrId, byte[] barr)
      Stores a data field given as a byte array at the specified id Stored type is NAR.BYTE_ARRAY_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      barr - byte array to be stored in the given field
    • load

      void load(int attrId, String str)
      Stores a String object at the specified id Stored type is NAR.STRING_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      val - String object to be stored in the given field
    • loadByteArray

      void loadByteArray(int attrId, InputStream is, int nbytes) throws IOException
      Stores a given number of bytes of data from a given InputeStream at the specified id. Stored type is NAR.BYTE_ARRAY_TYPE
      Parameters:
      attrId - Numeric identifier for the field
      is - InputStream from which bytes will be read
      nbytes - Number of bytes to be read to create this data item
      Throws:
      IOException
    • loadBigEndian

      void loadBigEndian(int attrId, int attrType, DataInputStream dis) throws IOException, NonNumericTypeException
      Stores a numeric primitive, e.g. int, float, long, by reading in appropriate number of bytes from a given DataInputStream. The DataInputStream is assumed to contain the number in big-endian, or network byte order.
      Parameters:
      attrId - Numeric identifier for the field
      attrType - an integer type id which should be one of NAR.INT_TYPE, NAR.FLOAT_TYPE, NAR.SHORT_TYPE, etc.
      dis - DataInputStream which contains the big-endian number at the current position of the input-stream.
      Throws:
      IOException
      NonNumericTypeException
    • loadString

      void loadString(int attrId, Reader rd, char delimChar) throws IOException
      Stores a String object by reading it in from a given character Reader. The end of the string is recognized by the specified delimiting character. It is assumed that the default encoding of the platform is ASCII.
      Parameters:
      attrId - Numeric identifier for the field
      rd - A character Reader from which char's are extracted until a delimChar is seen.
      delimChar - byte value of the separation character.
      Throws:
      IOException
    • load

      void load(int attrId, int type, byte[] barr, int barrOffset, int len)
      Stores a given value of specified type with the specified id. Numeric values have to be given in network byte order, and strings have to be encoded with the platform's defualt encoding.
      Parameters:
      attrId - Identifier for the field
      type - Data type for the field
      barr - byte array containing the data value
      barrOffset - offset into the given byte array where field begins
      len - number of bytes occupied by field