Class Inet4AddressEncoding
- All Implemented Interfaces:
Encoding<Inet4Address>
,NaturalSortAware
,Serializable
,Comparator<Inet4Address>
Inet4Address
type. Null values are not supported by this class.
Binary encoding uses the binary value from InetAddress.getAddress()
.
- See Also:
-
Field Summary
Fields inherited from class io.permazen.encoding.AbstractEncoding
encodingId, typeToken
Fields inherited from interface io.permazen.encoding.Encoding
MAX_ARRAY_DIMENSIONS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compare
(Inet4Address addr1, Inet4Address addr2) Order two field values.fromString
(String string) Parse a non-null value previously encoded bytoString(T)
.protected int
getLength
(ByteReader reader) read
(ByteReader reader) Read a value from the given input.void
skip
(ByteReader reader) Read and discard abyte[]
encoded value from the given input.toString
(Inet4Address addr) Encode a non-null value as aString
for later decoding byfromString()
.withEncodingId
(EncodingId encodingId) Build an encoding that has the givenEncodingId
but is otherwise equivalent to this encoding.void
write
(ByteWriter writer, Inet4Address addr) Write a value to the given output.Methods inherited from class io.permazen.encoding.AbstractEncoding
equals, getDefaultValueObject, getEncodingId, getTypeToken, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface io.permazen.encoding.Encoding
convert, decode, encode, getDefaultValue, getKeyRange, hasPrefix0x00, hasPrefix0xff, sortsNaturally, supportsNull, validate, validateAndWrite
-
Field Details
-
LENGTH
public static final int LENGTH- See Also:
-
-
Constructor Details
-
Inet4AddressEncoding
-
-
Method Details
-
withEncodingId
Description copied from interface:Encoding
Build an encoding that has the givenEncodingId
but is otherwise equivalent to this encoding.If this encoding already has
encodingId
, then this method may (but is not required to) return this same instance.- Parameters:
encodingId
- new encoding'sEncodingId
, or null for an anonymized encoding- Returns:
- a version of this encoding with the given
EncodingId
-
getLength
-
read
Description copied from interface:Encoding
Read a value from the given input.- Parameters:
reader
- byte input- Returns:
- field value (possibly null)
-
write
Description copied from interface:Encoding
Write a value to the given output.- Parameters:
writer
- byte outputaddr
- value to write (possibly null)
-
skip
Description copied from interface:Encoding
Read and discard abyte[]
encoded value from the given input.- Parameters:
reader
- byte input
-
toString
Description copied from interface:Encoding
Encode a non-null value as aString
for later decoding byfromString()
.Each of the characters in the returned
String
must be one of the valid XML characters (tab, newline, carriage return,\u0020 - \ud7ff
, and\ue000 - \ufffd
).- Parameters:
addr
- actual value, never null- Returns:
- string encoding of
value
acceptable tofromString()
- See Also:
-
fromString
Description copied from interface:Encoding
Parse a non-null value previously encoded bytoString(T)
.- Parameters:
string
- non-null value previously encoded as aString
bytoString(T)
- Returns:
- actual value
-
compare
Description copied from interface:Encoding
Order two field values.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 this method 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.
-