Package org.eolang
Interface Bytes
- All Known Implementing Classes:
BytesOf
public interface Bytes
Bytes.
Represents byte array of arbitrary size, convertible to a numeric value. Original size is preserved by and, or and xor.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionAND operation.asNumber()Convert to double number.<T extends Number>
TConvert to number.asString()Convert to string.not()NOT operation.OR operation.shift(int bits) Big-endian unsigned shift.sshift(int bits) Big-endian signed right shift.byte[]take()Get bytes itself.XOR operation.
-
Method Details
-
not
Bytes not()NOT operation.- Returns:
- Bytes.
-
and
AND operation.- Parameters:
other- Bytes.- Returns:
- Bytes.
-
or
OR operation.- Parameters:
other- Bytes.- Returns:
- Bytes.
-
xor
XOR operation.- Parameters:
other- Bytes.- Returns:
- Bytes.
-
shift
Big-endian unsigned shift. Shifts left if value is positive, or right otherwise. Does not perform sign extension.- Parameters:
bits- Bits to shift, negative to shift left.- Returns:
- Bytes.
-
sshift
Big-endian signed right shift. Performs sign extension, i.e. it will fill the top bits with 1 if the first bit is 1 and with 0 otherwise.- Parameters:
bits- Bits to shift, negative value causes exception.- Returns:
- Bytes.
-
asNumber
Double asNumber()Convert to double number.- Returns:
- Number.
-
asNumber
Convert to number.- Type Parameters:
T- Type- Parameters:
type- Number type- Returns:
- Number
-
asString
String asString()Convert to string.- Returns:
- String.
-
take
byte[] take()Get bytes itself.- Returns:
- Bytes.
-