Package me.panjohnny.jip.util
Record Class Bytes
java.lang.Object
java.lang.Record
me.panjohnny.jip.util.Bytes
Třída Bytes slouží k manipulaci s poly bajtů.
Poskytuje metody pro přidávání, odebírání a iteraci přes pole bajtů.
- Since:
- 1.0
- Author:
- Jan Štefanča
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend
(byte[] arr) Přidá nové pole bajtů na konec.byte[]
at
(int index) Vrátí pole bajtů na daném indexu.byte[][]
bytes()
Returns the value of thebytes
record component.void
clear()
Vymaže všechna pole bajtů.final boolean
Indicates whether some other object is "equal to" this one.void
Provede danou akci pro každé pole bajtů.final int
hashCode()
Returns a hash code value for this object.int
length()
Vrátí celkovou délku všech polí bajtů.prepend
(byte[] arr) Přidá nové pole bajtů na začátek.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Bytes
public Bytes(byte[]... bytes) Creates an instance of aBytes
record class.- Parameters:
bytes
- the value for thebytes
record component
-
-
Method Details
-
length
public int length()Vrátí celkovou délku všech polí bajtů.- Returns:
- celková délka
-
append
Přidá nové pole bajtů na konec.- Parameters:
arr
- pole bajtů k přidání- Returns:
- nová instance Bytes s přidaným polem bajtů
-
prepend
Přidá nové pole bajtů na začátek.- Parameters:
arr
- pole bajtů k přidání- Returns:
- nová instance Bytes s přidaným polem bajtů
-
forEach
Provede danou akci pro každé pole bajtů.- Parameters:
consumer
- akce k provedení
-
at
public byte[] at(int index) Vrátí pole bajtů na daném indexu.- Parameters:
index
- index pole bajtů- Returns:
- pole bajtů na daném indexu
-
clear
public void clear()Vymaže všechna pole bajtů. -
toString
-
hashCode
-
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)
. -
bytes
public byte[][] bytes()Returns the value of thebytes
record component.- Returns:
- the value of the
bytes
record component
-