Package org.apache.cassandra.dht
Class Token.TokenFactory
java.lang.Object
org.apache.cassandra.dht.Token.TokenFactory
- Enclosing class:
- Token
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasComparableBytes(Token token, ByteComparable.Version version) Produce a byte-comparable representation of the token.intabstract TokenfromByteArray(ByteBuffer bytes) fromByteBuffer(ByteBuffer bytes, int position, int length) abstract TokenfromComparableBytes(ByteSource.Peekable comparableBytes, ByteComparable.Version version) Translates the given byte-comparable representation to a token instance.abstract TokenfromString(String string) voidserialize(Token token, ByteBuffer out) voidserialize(Token token, DataOutputPlus out) abstract ByteBuffertoByteArray(Token token) abstract Stringabstract void
-
Constructor Details
-
TokenFactory
public TokenFactory()
-
-
Method Details
-
toByteArray
-
fromByteArray
-
asComparableBytes
Produce a byte-comparable representation of the token. SeeToken.asComparableBytes(org.apache.cassandra.utils.bytecomparable.ByteComparable.Version) -
fromComparableBytes
public abstract Token fromComparableBytes(ByteSource.Peekable comparableBytes, ByteComparable.Version version) Translates the given byte-comparable representation to a token instance. If the given bytes don't correspond to the encoding of an instance of the expected token type, anIllegalArgumentExceptionmay be thrown.- Parameters:
comparableBytes- A byte-comparable representation (presumably of a token of some expected token type).- Returns:
- A new
Tokeninstance, corresponding to the given byte-ordered representation. If we were to callToken.asComparableBytes(ByteComparable.Version)on the returned object, we should get aByteSourceequal to the input one as a result. - Throws:
IllegalArgumentException- if the bytes do not encode a valid token.
-
toString
-
fromString
-
validate
- Throws:
ConfigurationException
-
serialize
- Throws:
IOException
-
serialize
- Throws:
IOException
-
fromByteBuffer
-
byteSize
-