Class AbstractEncoder<T>

java.lang.Object
org.apache.accumulo.core.client.lexicoder.AbstractEncoder<T>
All Implemented Interfaces:
Encoder<T>, org.apache.accumulo.core.iterators.TypedValueCombiner.Encoder<T>
Direct Known Subclasses:
org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder

public abstract class AbstractEncoder<T>
extends Object
implements Encoder<T>
AbstractEncoder is an Encoder that implements all of Encoder's methods validating the input, but has those methods defer logic to to a new method, decodeUnchecked(byte[], int, int).
Since:
1.7.0
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractEncoder()  
  • Method Summary

    Modifier and Type Method Description
    T decode​(byte[] b)  
    T decode​(byte[] b, int offset, int len)
    Checks if the byte array is null, or if parameters exceed the bounds of the byte array, then calls decodeUnchecked(byte[], int, int).
    protected abstract T decodeUnchecked​(byte[] b, int offset, int len)
    Decodes a byte array without checking if the offset and len exceed the bounds of the actual array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.accumulo.core.iterators.TypedValueCombiner.Encoder

    encode
  • Constructor Details

  • Method Details

    • decodeUnchecked

      protected abstract T decodeUnchecked​(byte[] b, int offset, int len) throws org.apache.accumulo.core.iterators.ValueFormatException
      Decodes a byte array without checking if the offset and len exceed the bounds of the actual array.
      Throws:
      org.apache.accumulo.core.iterators.ValueFormatException
    • decode

      public T decode​(byte[] b)
      Specified by:
      decode in interface org.apache.accumulo.core.iterators.TypedValueCombiner.Encoder<T>
    • decode

      public T decode​(byte[] b, int offset, int len)
      Checks if the byte array is null, or if parameters exceed the bounds of the byte array, then calls decodeUnchecked(byte[], int, int).
      Throws:
      NullPointerException - if b is null
      IllegalArgumentException - if offset + len exceeds the length of b