java.lang.Object
com.blackhillsoftware.smf.Data
Direct Known Subclasses:
AggregateGroup.IDsnMem, BaseConfiguration.SystemFeatures, BaseConfiguration.SystemInformation, Drive.Status, Library.Status, SmfData, SmsVolume.Status, StorageGroup.Library, StorageGroup.Status, Token, VRecord

public class Data extends Object
Base class to contain data for records and sections
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Data(byte[] source)
    Create a Data section from a byte array.
    Data(byte[] source, int offset, int length)
    Create a Data section with data copied from an existing byte array
    Data(Data source)
    Create a Data section from an existing Data object.
    Data(com.blackhillsoftware.smf.internal.Section source)
    Create a Data section from an existing Section array.
    Data(com.blackhillsoftware.smf.internal.Section source, int offset, int length)
    Create a Data section with data from an existing byte array
  • Method Summary

    Modifier and Type
    Method
    Description
     
    static String
    dump(byte[] data)
     
    static String
    dump(byte[] data, int offset, int length)
     
    dump(int offset, int length)
     
    static String
    dump(com.blackhillsoftware.smf.internal.Section data, int offset, int length)
     
    boolean
    Tests equality, returns true if data arrays contain the same data, and objects are of the same type.
    void
    Copy data from this section into a new array.
    byte[]
    Get a copy of the data in this record or section
    byte[]
    getBytes(int offset, int length)
    Get a copy of the data in this record or section from a particular offset and length
    int
     
    int
    Get the length of the section
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final byte[] EMPTY
  • Constructor Details

    • Data

      public Data(byte[] source, int offset, int length)
      Create a Data section with data copied from an existing byte array
      Parameters:
      source - the byte array containing the data section
      offset - the offset of the start of the data
      length - the length of the data
    • Data

      public Data(com.blackhillsoftware.smf.internal.Section source, int offset, int length)
      Create a Data section with data from an existing byte array
      Parameters:
      source -
      offset -
      length -
    • Data

      public Data(byte[] source)
      Create a Data section from a byte array.
      Parameters:
      source - a byte array containing a complete section
    • Data

      public Data(com.blackhillsoftware.smf.internal.Section source)
      Create a Data section from an existing Section array.
      Parameters:
      source - a Section containing a complete section
    • Data

      public Data(Data source)
      Create a Data section from an existing Data object.
      Parameters:
      source - a Data object
  • Method Details

    • extract

      public void extract()
      Copy data from this section into a new array. This allows data from the parent record to be garbage collected while this section is alive. This can reduce memory usage if references to subsections are kept for longer than the parent record.
    • length

      public int length()
      Get the length of the section
      Returns:
      int length
    • getBytes

      public byte[] getBytes()
      Get a copy of the data in this record or section
      Returns:
      A byte array with a copy of this section
    • getBytes

      public byte[] getBytes(int offset, int length)
      Get a copy of the data in this record or section from a particular offset and length
      Parameters:
      offset - offset from the start of the data
      length - the length of the data to be returned
      Returns:
      A byte array with the bytes requested.
    • dump

      public String dump()
    • dump

      public String dump(int offset, int length)
    • dump

      public static String dump(byte[] data)
    • dump

      public static String dump(com.blackhillsoftware.smf.internal.Section data, int offset, int length)
    • dump

      public static String dump(byte[] data, int offset, int length)
    • equals

      public boolean equals(Object obj)
      Tests equality, returns true if data arrays contain the same data, and objects are of the same type.
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object