Ejemplo n.º 1
0
 @Override
 public void write(ByteWriter writer, T array) {
   Preconditions.checkArgument(array != null, "null array");
   final int length = this.getArrayLength(array);
   for (int i = 0; i < length; i++)
     LongEncoder.write(writer, this.integralType.upCast(this.getArrayElement(array, i)));
   writer.writeByte(END);
 }
Ejemplo n.º 2
0
 @Override
 public void skip(ByteReader reader) {
   while (true) {
     final int first = reader.peek();
     if (first == END) {
       reader.skip(1);
       break;
     }
     reader.skip(LongEncoder.decodeLength(first));
   }
 }
Ejemplo n.º 3
0
 @Override
 public T read(ByteReader reader) {
   final ArrayList<E> list = new ArrayList<>();
   while (true) {
     final int first = reader.peek();
     if (first == END) {
       reader.skip(1);
       break;
     }
     list.add(this.integralType.downCast(LongEncoder.read(reader)));
   }
   return this.createArray(list);
 }