Package io.permazen.encoding
Class ByteArrayEncoding
java.lang.Object
io.permazen.encoding.AbstractEncoding<T>
io.permazen.encoding.ArrayEncoding<T,E>
io.permazen.encoding.Base64ArrayEncoding<T,E>
io.permazen.encoding.IntegralArrayEncoding<byte[],Byte>
io.permazen.encoding.ByteArrayEncoding
- All Implemented Interfaces:
Encoding<byte[]>
,NaturalSortAware
,Serializable
,Comparator<byte[]>
byte[]
primitive array type. Does not support null arrays.- 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 TypeMethodDescriptionprotected byte[]
createArray
(List<Byte> elements) Create a new array instance containing the given elements.protected byte[]
decode
(DataInputStream input, int numBytes) protected void
encode
(byte[] array, DataOutputStream output) protected Byte
getArrayElement
(byte[] array, int index) Get an element from the given array.protected int
getArrayLength
(byte[] array) Get the length of the given array.Methods inherited from class io.permazen.encoding.IntegralArrayEncoding
hasPrefix0x00, hasPrefix0xff, read, skip, write
Methods inherited from class io.permazen.encoding.Base64ArrayEncoding
checkDecodeLength, fromString, toString, toString, useBase64Encoding
Methods inherited from class io.permazen.encoding.ArrayEncoding
compare, convert, equals, fromArrayString, getElementEncoding, getFixedWidth, hashCode, sortsNaturally, supportsNull, toArrayString
Methods inherited from class io.permazen.encoding.AbstractEncoding
getDefaultValue, getDefaultValueBytes, getEncodingId, getTypeToken, 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
decode, encode, getKeyRange, validate, validateAndWrite
-
Constructor Details
-
ByteArrayEncoding
public ByteArrayEncoding()
-
-
Method Details
-
getArrayLength
protected int getArrayLength(byte[] array) Description copied from class:ArrayEncoding
Get the length of the given array.- Specified by:
getArrayLength
in classArrayEncoding<byte[],
Byte> - Parameters:
array
- non-null array- Returns:
- array length
-
getArrayElement
Description copied from class:ArrayEncoding
Get an element from the given array.- Specified by:
getArrayElement
in classArrayEncoding<byte[],
Byte> - Parameters:
array
- non-null arrayindex
- index of target element inarray
- Returns:
- array element at index
index
-
createArray
Description copied from class:ArrayEncoding
Create a new array instance containing the given elements.- Specified by:
createArray
in classArrayEncoding<byte[],
Byte> - Parameters:
elements
- content for the new array- Returns:
- newly created array
-
encode
- Specified by:
encode
in classBase64ArrayEncoding<byte[],
Byte> - Throws:
IOException
-
decode
- Specified by:
decode
in classBase64ArrayEncoding<byte[],
Byte> - Throws:
IOException
-