Package smile.util
Record Class Bytes
java.lang.Object
java.lang.Record
smile.util.Bytes
- Record Components:
array
- the array buffer of bytes.
Byte string.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
array()
Returns the value of thearray
record component.boolean
Indicates whether some other object is "equal to" this one.int
hashCode()
Returns a hash code value for this object.int
length()
Returns the length of byte string.slice
(int start, int end) Returns a copy of byte string slice.toString()
Returns a string representation of this record class.
-
Constructor Details
-
Bytes
Constructor with a string input.- Parameters:
s
- the UTF8 encoding of string will be stored.
-
Bytes
public Bytes(byte[] array) Creates an instance of aBytes
record class.- Parameters:
array
- the value for thearray
record component
-
-
Method Details
-
length
public int length()Returns the length of byte string.- Returns:
- the length of byte string.
-
slice
Returns a copy of byte string slice.- Parameters:
start
- the initial index of the range to be copied, inclusiveend
- the final index of the range to be copied, exclusive.- Returns:
- a copy of byte string slice.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
array
public byte[] array()Returns the value of thearray
record component.- Returns:
- the value of the
array
record component
-