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, typeTokenFields inherited from interface io.permazen.encoding.Encoding
MAX_ARRAY_DIMENSIONS -
Constructor Summary
Constructors -
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 voidencode(byte[] array, DataOutputStream output) protected BytegetArrayElement(byte[] array, int index) Get an element from the given array.protected intgetArrayLength(byte[] array) Get the length of the given array.Methods inherited from class io.permazen.encoding.IntegralArrayEncoding
hasPrefix0x00, hasPrefix0xff, read, skip, writeMethods inherited from class io.permazen.encoding.Base64ArrayEncoding
checkDecodeLength, fromString, toString, toString, useBase64EncodingMethods inherited from class io.permazen.encoding.ArrayEncoding
compare, convert, equals, fromArrayString, getElementEncoding, getFixedWidth, hashCode, sortsNaturally, supportsNull, toArrayStringMethods inherited from class io.permazen.encoding.AbstractEncoding
getDefaultValue, getDefaultValueBytes, getEncodingId, getTypeToken, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface io.permazen.encoding.Encoding
decode, encode, validate, validateAndWrite
-
Constructor Details
-
ByteArrayEncoding
public ByteArrayEncoding()
-
-
Method Details
-
getArrayLength
protected int getArrayLength(byte[] array) Description copied from class:ArrayEncodingGet the length of the given array.- Specified by:
getArrayLengthin classArrayEncoding<byte[],Byte> - Parameters:
array- non-null array- Returns:
- array length
-
getArrayElement
Description copied from class:ArrayEncodingGet an element from the given array.- Specified by:
getArrayElementin classArrayEncoding<byte[],Byte> - Parameters:
array- non-null arrayindex- index of target element inarray- Returns:
- array element at index
index
-
createArray
Description copied from class:ArrayEncodingCreate a new array instance containing the given elements.- Specified by:
createArrayin classArrayEncoding<byte[],Byte> - Parameters:
elements- content for the new array- Returns:
- newly created array
-
encode
- Specified by:
encodein classBase64ArrayEncoding<byte[],Byte> - Throws:
IOException
-
decode
- Specified by:
decodein classBase64ArrayEncoding<byte[],Byte> - Throws:
IOException
-