public class Inet6AddressType extends NonNullFieldType<T>
Inet6Address
type. Null values are not supported by this class.
Binary encoding uses the binary value from InetAddress.getAddress()
.
Modifier and Type | Field and Description |
---|---|
static int |
LENGTH |
name, NAME_PATTERN, REFERENCE_TYPE_NAME, signature, typeToken
Constructor and Description |
---|
Inet6AddressType() |
Modifier and Type | Method and Description |
---|---|
int |
compare(T addr1,
T addr2)
Order two field values.
|
T |
fromParseableString(ParseContext ctx)
Parse a value previously encoded by
toParseableString() as a self-delimited String
and positioned at the start of the given parsing context. |
T |
fromString(String string)
Parse a non-null value previously encoded by
toString(T) . |
protected int |
getLength(ByteReader reader) |
T |
read(ByteReader reader)
Read a value from the given input.
|
void |
skip(ByteReader reader)
Read and discard a value from the given input.
|
String |
toParseableString(T addr)
Encode a possibly null value as a
String for later decoding by fromParseableString() . |
String |
toString(T addr)
Encode a non-null value as a
String for later decoding by fromString() . |
void |
write(ByteWriter writer,
T addr)
Write a value to the given output.
|
validate
convert, equals, genericizeForIndex, getDefaultValue, getDefaultValueObject, getEncodingSignature, getKeyRange, getName, getTypeToken, hashCode, hasPrefix0x00, hasPrefix0xff, toString, validateAndWrite
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final int LENGTH
protected int getLength(ByteReader reader)
public T read(ByteReader reader)
FieldType
read
in class FieldType<T extends InetAddress>
reader
- byte inputpublic void write(ByteWriter writer, T addr)
FieldType
write
in class FieldType<T extends InetAddress>
writer
- byte outputaddr
- value to write (possibly null)public void skip(ByteReader reader)
FieldType
skip
in class FieldType<T extends InetAddress>
reader
- byte inputpublic String toString(T addr)
FieldType
String
for later decoding by fromString()
.
Each of the characters in the returned String
must be one of the valid XML characters
(tab, newline, carriage return, \u0020 - \ud7ff
, and \ue000 - \fffdf
).
The implementation in FieldType
checks that value
is not null, then delegates to FieldType.toParseableString(T)
.
Subclasses that override this method should also override fromString()
.
toString
in class FieldType<T extends InetAddress>
addr
- actual value, never nullvalue
acceptable to fromString()
public T fromString(String string)
FieldType
toString(T)
.
The implementation in FieldType
creates a new ParseContext
based on string
,
delegates to FieldType.toParseableString(T)
to parse it, and verifies that all of string
was consumed
during the parse. Subclasses that override this method should also override toString(T)
.
fromString
in class FieldType<T extends InetAddress>
string
- non-null value previously encoded as a String
by toString(T)
public String toParseableString(T addr)
FieldType
String
for later decoding by fromParseableString()
.
The string value must be self-delimiting, i.e., decodable even when followed by arbitrary additional characters,
and must not start with whitespace or closing square bracket ("]"
).
In addition, each of the characters in the returned String
must be one of the valid XML characters
(tab, newline, carriage return, \u0020 - \ud7ff
, and \ue000 - \fffdf
).
toParseableString
in class FieldType<T extends InetAddress>
addr
- actual value (possibly null)value
acceptable to fromParseableString()
public T fromParseableString(ParseContext ctx)
FieldType
toParseableString()
as a self-delimited String
and positioned at the start of the given parsing context.fromParseableString
in class FieldType<T extends InetAddress>
ctx
- parse context starting with a string previously encoded via toParseableString()
public int compare(T addr1, T addr2)
FieldType
This method must provide a total ordering of all supported Java values that is consistent with the database ordering,
i.e., the unsigned lexicographical ordering of the corresponding byte[]
encoded field values.
If null is a supported Java value, then the returned Comparator
must accept null parameters without
throwing an exception (note, this is a stronger requirement than the Comparator
interface normally requires).
Note: by convention, null values usually sort last.
compare
in interface Comparator<T extends InetAddress>
compare
in class FieldType<T extends InetAddress>
Copyright © 2022. All rights reserved.