Package org.apache.avro.generic

Examples of org.apache.avro.generic.GenericFixed


    /**
     * Called to read a fixed value. Overridden to read a pig byte array.
     */
    @Override
    protected Object readFixed(Object old, Schema expected, Decoder in) throws IOException {
        GenericFixed fixed = (GenericFixed) super.readFixed(old, expected, in);
        DataByteArray byteArray = new DataByteArray(fixed.bytes());
        return byteArray;
     }
View Full Code Here


    }
    return map;
  }

  protected Object readFixed(Schema expected, Decoder in) throws IOException {
    GenericFixed fixed = (GenericFixed) data.createFixed(null, expected);
    if (bytesAsBase64) {
      ByteBuffer
          .wrap(fixed.bytes(), 0, expected.getFixedSize())
          .put(Base64.decodeBase64(in.readString()));
    } else {
      in.readFixed(fixed.bytes(), 0, expected.getFixedSize());
    }
    return fixed;
  }
View Full Code Here

    List<Integer> integerArray = Arrays.asList(1, 2, 3);
    GenericData.Array<Integer> genericIntegerArray = new GenericData.Array<Integer>(
        Schema.createArray(Schema.create(Schema.Type.INT)), integerArray);

    GenericFixed genericFixed = new GenericData.Fixed(
        Schema.createFixed("fixed", null, null, 1), new byte[] { (byte) 65 });

    List<Integer> emptyArray = new ArrayList<Integer>();
    ImmutableMap emptyMap = new ImmutableMap.Builder<String, Integer>().build();
View Full Code Here

      case UNION: {
        record.put(fieldName, normalizeUtf8(datum));
        break;
      }
      case FIXED: {
        GenericFixed fixed = (GenericFixed) datum;
        record.put(fieldName, fixed.bytes());
        break;
      }
      case BYTES: {
        ByteBuffer buf = (ByteBuffer) datum;
        int pos = buf.position();
View Full Code Here

        int index = GenericData.get().resolveUnion(schema, datum);
        flatten(datum, schema.getTypes().get(index), list);
        break;
      }
      case FIXED: {
        GenericFixed fixed = (GenericFixed) datum;
        list.add(fixed.bytes());
        break;
      }
      case BYTES: {
        ByteBuffer buf = (ByteBuffer) datum;
        int pos = buf.position();
View Full Code Here

        String prefix2 = prefix;
        extractTree(datum, schema.getTypes().get(index), outputRecord, prefix2);
        break;
      }
      case FIXED: {
        GenericFixed fixed = (GenericFixed) datum;
        outputRecord.put(prefix, fixed.bytes());
        //outputRecord.put(prefix, utf8toString(fixed.bytes()));
        break;
      }
      case BYTES: {
        ByteBuffer buf = (ByteBuffer) datum;
View Full Code Here

      case UNION: {
        record.put(fieldName, normalizeUtf8(datum));
        break;
      }
      case FIXED: {
        GenericFixed fixed = (GenericFixed) datum;
        record.put(fieldName, fixed.bytes());
        break;
      }
      case BYTES: {
        ByteBuffer buf = (ByteBuffer) datum;
        int pos = buf.position();
View Full Code Here

        int index = GenericData.get().resolveUnion(schema, datum);
        flatten(datum, schema.getTypes().get(index), list);
        break;
      }
      case FIXED: {
        GenericFixed fixed = (GenericFixed) datum;
        list.add(fixed.bytes());
        break;
      }
      case BYTES: {
        ByteBuffer buf = (ByteBuffer) datum;
        int pos = buf.position();
View Full Code Here

        String prefix2 = prefix;
        extractTree(datum, schema.getTypes().get(index), outputRecord, prefix2);
        break;
      }
      case FIXED: {
        GenericFixed fixed = (GenericFixed) datum;
        outputRecord.put(prefix, fixed.bytes());
        //outputRecord.put(prefix, utf8toString(fixed.bytes()));
        break;
      }
      case BYTES: {
        ByteBuffer buf = (ByteBuffer) datum;
View Full Code Here

    /**
     * Called to read a fixed value. Overridden to read a pig byte array.
     */
    @Override
    protected Object readFixed(Object old, Schema expected, Decoder in) throws IOException {
        GenericFixed fixed = (GenericFixed) super.readFixed(old, expected, in);
        DataByteArray byteArray = new DataByteArray(fixed.bytes());
        return byteArray;
     }
View Full Code Here

TOP

Related Classes of org.apache.avro.generic.GenericFixed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.