RegisterSign In

API Documentation: Interface ByteArray

Package: com.mckoi.data
implements java.lang.Comparable<com.mckoi.data.ByteArray>

An immutable wrapper for a sequence of bytes that also has an order specification.

Methods Summary

int length()
byte getByteAt(int p)
DataInputStream getDataInputStream()
int compareTo(ByteArray dest)
boolean equals(Object dest)

Method Details

int length()

Returns the size of the byte array.

byte getByteAt(int p)

Returns the byte at position p.

DataInputStream getDataInputStream()

Returns a DataInputStream for reading the content of the array from the beginning.

int compareTo(ByteArray dest)

Compares this byte array to the given byte array. The default implementation of this should be a lexicographic comparison that is implemented as follows; Start at byte index 0. If the byte in this array is greater than the byte in 'dest' then return 1. If it's less then return -1. If it's the same, repeat the text for the next byte. If there are no more bytes left to read in one of the arrays, return the length of this array minus the length of the array in 'dest'.

Note that custom implementations of this interface may choose any kind of comparison function that is desired.

boolean equals(Object dest)

Equality check for this byte array. The default implementation of this should be a lexicographic equality test. 'o1.equals(o2) == true' is the same as 'o1.compareTo(o2) == 0'. See the 'compareTo' method description for details of this test.

Note that custom implementations of this interface may choose any kind of comparison function that is desired.

The text on this page is licensed under the Creative Commons Attribution 3.0 License. Java is a registered trademark of Oracle and/or its affiliates.
Mckoi is Copyright © 2000 - 2020 Diehl and Associates, Inc. All rights reserved.