Documentation of 'org.apache.derby.iapi.util.ByteArray' Java class
ByteArray
org.apache.derby.iapi.util

Class ByteArray



  • public final class ByteArray
    extends java.lang.Object
    ByteArray wraps java byte arrays (byte[]) to allow byte arrays to be used as keys in hashtables. This is required because the equals function on byte[] directly uses reference equality.

    This class also allows the trio of array, offset and length to be carried around as a single object.

    • Constructor Summary

      Constructors 
      Constructor and Description
      ByteArray() 
      ByteArray(byte[] array) 
      ByteArray(byte[] array, int offset, int length)
      Create an instance of this class that wraps ths given array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object other)
      Value equality for byte arrays.
      byte[] getArray() 
      int getLength() 
      int getOffset() 
      int hashCode() 
      void readExternal(java.io.ObjectInput in)
      Read this object from a stream of stored objects.
      void setBytes(byte[] array) 
      void setBytes(byte[] array, int length) 
      void setBytes(byte[] array, int offset, int length) 
      void setLength(int newLength) 
      void writeExternal(java.io.ObjectOutput out)
      Write the byte array out w/o compression
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ByteArray

        public ByteArray(byte[] array,
                         int offset,
                         int length)
        Create an instance of this class that wraps ths given array. This class does not make a copy of the array, it just saves the reference.
      • ByteArray

        public ByteArray(byte[] array)
      • ByteArray

        public ByteArray()
    • Method Detail

      • setBytes

        public void setBytes(byte[] array)
      • setBytes

        public void setBytes(byte[] array,
                             int length)
      • setBytes

        public void setBytes(byte[] array,
                             int offset,
                             int length)
      • equals

        public boolean equals(java.lang.Object other)
        Value equality for byte arrays.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getArray

        public final byte[] getArray()
      • getOffset

        public final int getOffset()
      • getLength

        public final int getLength()
      • setLength

        public final void setLength(int newLength)
      • readExternal

        public void readExternal(java.io.ObjectInput in)
                          throws java.io.IOException
        Read this object from a stream of stored objects.
        Parameters:
        in - read this.
        Throws:
        java.io.IOException - thrown on error
      • writeExternal

        public void writeExternal(java.io.ObjectOutput out)
                           throws java.io.IOException
        Write the byte array out w/o compression
        Parameters:
        out - write bytes here.
        Throws:
        java.io.IOException - thrown on error

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.