Package org.symbol.sdk
Class ByteArray
java.lang.Object
org.symbol.sdk.ByteArray
- All Implemented Interfaces:
Serializer
- Direct Known Subclasses:
Address,Address,CryptoTypes.Hash256,CryptoTypes.PrivateKey,CryptoTypes.PublicKey,CryptoTypes.SharedKey256,CryptoTypes.Signature,Hash256,Hash512,ProofGamma,ProofScalar,ProofVerificationHash,PublicKey,Signature,UnresolvedAddress,VotingPublicKey
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedByteArray(byte[] bytes, int size) Creates a fixed-size byte value, validating its length. -
Method Summary
Modifier and TypeMethodDescriptionfinal byte[]bytes()Returns the raw bytes backing this value.final booleanfinal inthashCode()final byte[]Serializes this object to a fresh byte array.final intsize()Returns the size, in bytes, of the serialized form of this object.static byte[]final StringtoJson()JSON-safe representation; delegates totoString()so each subclass's external format flows through.toString()Returns the external string representation — hex by default.
-
Constructor Details
-
ByteArray
protected ByteArray(byte[] bytes, int size) Creates a fixed-size byte value, validating its length.- Parameters:
bytes- Raw bytes (defensively copied).size- Required length.
-
-
Method Details
-
bytes
public final byte[] bytes()- ByteArray.bytes
- Returns the raw bytes backing this value. The returned array is the internal buffer — callers must not mutate it.
- Returns:
- Raw bytes.
-
size
public final int size()- ByteArray.size
- Description copied from interface:
Serializer
Returns the size, in bytes, of the serialized form of this object.- Specified by:
sizein interfaceSerializer- Returns:
- Size in bytes.
-
serialize
public final byte[] serialize()- ByteArray.serialize
- Description copied from interface:
Serializer
Serializes this object to a fresh byte array.- Specified by:
serializein interfaceSerializer- Returns:
- Serialized bytes.
-
toString
- ByteArray.toString
- Returns the external string representation — hex by default.
-
toJson
- ByteArray.toJson
- JSON-safe representation; delegates to
toString()so each subclass's external format flows through.
- Returns:
- String representation of this value.
-
equals
-
hashCode
public final int hashCode() -
toBytes
- Parameters:
value- Raw value.- Returns:
- Converted bytes.
-