Package com.github.glusk.srp6_variables
Class SRP6CustomIntegerVariable
- java.lang.Object
-
- com.github.glusk.srp6_variables.AbstractSRP6IntegerVariable
-
- com.github.glusk.srp6_variables.SRP6CustomIntegerVariable
-
- All Implemented Interfaces:
SRP6IntegerVariable
public final class SRP6CustomIntegerVariable extends AbstractSRP6IntegerVariable
A Custom SRP-6 Integer Variable.Objects of this class can be used to mock a variable for testing purposes or to represent constants.
You can also use this class to instantiate a custom variable if none of the other classes in this package seem suitable.
-
-
Constructor Summary
Constructors Constructor Description SRP6CustomIntegerVariable(byte[] bytes, ByteOrder order)Creates a new Custom SRP-6 Integer Variable from the specified byte array and the desired byteorder.SRP6CustomIntegerVariable(Bytes bytes, ByteOrder order)Creates a new Custom SRP-6 Integer Variable from the specified byte sequence and the desired byteorder.SRP6CustomIntegerVariable(BigInteger bi)Creates a new Custom SRP-6 Integer Variable from aBigInteger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bytesbytes(ByteOrder preferredOrder)ReturnsthisSRP-6 Integer Variable as a byte sequence in the preferred byte order.-
Methods inherited from class com.github.glusk.srp6_variables.AbstractSRP6IntegerVariable
equals, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.glusk.srp6_variables.SRP6IntegerVariable
asNonNegativeBigInteger, bytes
-
-
-
-
Constructor Detail
-
SRP6CustomIntegerVariable
public SRP6CustomIntegerVariable(BigInteger bi)
Creates a new Custom SRP-6 Integer Variable from aBigInteger.Equivalent to:
new SRP6CustomIntegerVariable( Bytes.wrapped(bi.toByteArray()), ByteOrder.BIG_ENDIAN )- Parameters:
bi- aBigIntegerargument that representsthisSRP-6 Integer Variable
-
SRP6CustomIntegerVariable
public SRP6CustomIntegerVariable(byte[] bytes, ByteOrder order)Creates a new Custom SRP-6 Integer Variable from the specified byte array and the desired byteorder.Equivalent to:
new SRP6CustomIntegerVariable( Bytes.wrapped(bytes), order )- Parameters:
bytes- the byte array that representsthisSRP-6 Integer Variableorder- the byte order ofbytes
-
SRP6CustomIntegerVariable
public SRP6CustomIntegerVariable(Bytes bytes, ByteOrder order)
Creates a new Custom SRP-6 Integer Variable from the specified byte sequence and the desired byteorder.- Parameters:
bytes- the byte sequence that representsthisSRP-6 Integer Variableorder- the byte order ofbytes
-
-
Method Detail
-
bytes
public Bytes bytes(ByteOrder preferredOrder)
Description copied from interface:SRP6IntegerVariableReturnsthisSRP-6 Integer Variable as a byte sequence in the preferred byte order.The representation returned must be minimal. That is, all leading (or trailing, depending on the
preferredOrder) zero bytes have to be trimmed.Number zero is hence defined as an empty byte sequence.
- Parameters:
preferredOrder- the preferred byte order of the byte sequence that representsthisSRP-6 Integer Variable- Returns:
- the byte sequence that represents
thisSRP-6 Integer Variable in the preferred byte order
-
-