avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [33/43] avro git commit: AVRO-1828: Add EditorConfig file and cleanup of whitespace violations
Date Sat, 14 May 2016 23:44:06 GMT
http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
index 9417b22..6133d6b 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
@@ -43,7 +43,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
   private final GenericData data;
   private Schema actual;
   private Schema expected;
-  
+
   private ResolvingDecoder creatorResolver = null;
   private final Thread creator;
 
@@ -115,7 +115,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
     ResolvingDecoder resolver;
     if (currThread == creator && creatorResolver != null) {
       return creatorResolver;
-    } 
+    }
 
     Map<Schema,ResolvingDecoder> cache = RESOLVER_CACHE.get().get(actual);
     if (cache == null) {
@@ -128,7 +128,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
           Schema.applyAliases(actual, expected), expected, null);
       cache.put(expected, resolver);
     }
-    
+
     if (currThread == creator){
       creatorResolver = resolver;
     }
@@ -145,7 +145,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
     resolver.drain();
     return result;
   }
-  
+
   /** Called to read data.*/
   protected Object read(Object old, Schema expected,
       ResolvingDecoder in) throws IOException {
@@ -215,11 +215,11 @@ public class GenericDatumReader<D> implements DatumReader<D> {
 
   /** Called to read a record instance. May be overridden for alternate record
    * representations.*/
-  protected Object readRecord(Object old, Schema expected, 
+  protected Object readRecord(Object old, Schema expected,
       ResolvingDecoder in) throws IOException {
     Object r = data.newRecord(old, expected);
     Object state = data.getRecordState(r, expected);
-    
+
     for (Field f : in.readFieldOrder()) {
       int pos = f.pos();
       String name = f.name();
@@ -232,14 +232,14 @@ public class GenericDatumReader<D> implements DatumReader<D> {
 
     return r;
   }
-  
-  /** Called to read a single field of a record. May be overridden for more 
+
+  /** Called to read a single field of a record. May be overridden for more
    * efficient or alternate implementations.*/
   protected void readField(Object r, Field f, Object oldDatum,
     ResolvingDecoder in, Object state) throws IOException {
     data.setField(r, f.name(), f.pos(), read(oldDatum, f.schema(), in), state);
   }
-  
+
   /** Called to read an enum value. May be overridden for alternate enum
    * representations.  By default, returns a GenericEnumSymbol. */
   protected Object readEnum(Schema expected, Decoder in) throws IOException {
@@ -299,7 +299,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
   protected void addToArray(Object array, long pos, Object e) {
     ((Collection) array).add(e);
   }
-  
+
   /** Called to read a map instance.  May be overridden for alternate map
    * representations.*/
   protected Object readMap(Object old, Schema expected,
@@ -341,7 +341,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
   protected void addToMap(Object map, Object key, Object value) {
     ((Map) map).put(key, value);
   }
-  
+
   /** Called to read a fixed value. May be overridden for alternate fixed
    * representations.  By default, returns {@link GenericFixed}. */
   protected Object readFixed(Object old, Schema expected, Decoder in)
@@ -350,11 +350,11 @@ public class GenericDatumReader<D> implements DatumReader<D> {
     in.readFixed(fixed.bytes(), 0, expected.getFixedSize());
     return fixed;
   }
-  
-  /** 
+
+  /**
    * Called to create an fixed value. May be overridden for alternate fixed
    * representations.  By default, returns {@link GenericFixed}.
-   * @deprecated As of Avro 1.6.0 this method has been moved to 
+   * @deprecated As of Avro 1.6.0 this method has been moved to
    * {@link GenericData#createFixed(Object, Schema)}
    */
   @Deprecated
@@ -362,17 +362,17 @@ public class GenericDatumReader<D> implements DatumReader<D> {
     return data.createFixed(old, schema);
   }
 
-  /** 
+  /**
    * Called to create an fixed value. May be overridden for alternate fixed
    * representations.  By default, returns {@link GenericFixed}.
-   * @deprecated As of Avro 1.6.0 this method has been moved to 
+   * @deprecated As of Avro 1.6.0 this method has been moved to
    * {@link GenericData#createFixed(Object, byte[], Schema)}
    */
   @Deprecated
   protected Object createFixed(Object old, byte[] bytes, Schema schema) {
     return data.createFixed(old, bytes, schema);
   }
-  
+
   /**
    * Called to create new record instances. Subclasses may override to use a
    * different record implementation. The returned instance must conform to the
@@ -380,7 +380,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
    * schema, they should either be removed from the old object, or it should
    * create a new instance that conforms to the schema. By default, this returns
    * a {@link GenericData.Record}.
-   * @deprecated As of Avro 1.6.0 this method has been moved to 
+   * @deprecated As of Avro 1.6.0 this method has been moved to
    * {@link GenericData#newRecord(Object, Schema)}
    */
   @Deprecated
@@ -421,7 +421,7 @@ public class GenericDatumReader<D> implements DatumReader<D> {
     if (stringClass == CharSequence.class)
       return readString(old, in);
     return newInstanceFromString(stringClass, in.readString());
-  }                  
+  }
 
   /** Called to read strings.  Subclasses may override to use a different
    * string representation.  By default, this calls {@link

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
index 7cfa022..63fa025 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
@@ -143,10 +143,10 @@ public class GenericDatumWriter<D> implements DatumWriter<D> {
       writeField(datum, f, out, state);
     }
   }
-  
-  /** Called to write a single field of a record. May be overridden for more 
+
+  /** Called to write a single field of a record. May be overridden for more
    * efficient or alternate implementations.*/
-  protected void writeField(Object datum, Field f, Encoder out, Object state) 
+  protected void writeField(Object datum, Field f, Encoder out, Object state)
       throws IOException {
     Object value = data.getField(datum, f.name(), f.pos(), state);
     try {
@@ -155,7 +155,7 @@ public class GenericDatumWriter<D> implements DatumWriter<D> {
       throw npe(e, " in field " + f.name());
     }
   }
-  
+
   /** Called to write an enum value.  May be overridden for alternate enum
    * representations.*/
   protected void writeEnum(Schema schema, Object datum, Encoder out)
@@ -164,7 +164,7 @@ public class GenericDatumWriter<D> implements DatumWriter<D> {
       throw new AvroTypeException("Not an enum: "+datum);
     out.writeEnum(schema.getEnumOrdinal(datum.toString()));
   }
-  
+
   /** Called to write a array.  May be overridden for alternate array
    * representations.*/
   protected void writeArray(Schema schema, Object datum, Encoder out)
@@ -205,7 +205,7 @@ public class GenericDatumWriter<D> implements DatumWriter<D> {
   protected Iterator<? extends Object> getArrayElements(Object array) {
     return ((Collection) array).iterator();
   }
-  
+
   /** Called to write a map.  May be overridden for alternate map
    * representations.*/
   protected void writeMap(Schema schema, Object datum, Encoder out)
@@ -241,7 +241,7 @@ public class GenericDatumWriter<D> implements DatumWriter<D> {
   protected Iterable<Map.Entry<Object,Object>> getMapEntries(Object map) {
     return ((Map) map).entrySet();
   }
-  
+
   /** Called to write a string.  May be overridden for alternate string
    * representations.*/
   protected void writeString(Schema schema, Object datum, Encoder out)
@@ -266,7 +266,7 @@ public class GenericDatumWriter<D> implements DatumWriter<D> {
     throws IOException {
     out.writeFixed(((GenericFixed)datum).bytes(), 0, schema.getFixedSize());
   }
-  
+
   private void error(Schema schema, Object datum) {
     throw new AvroTypeException("Not a "+schema+": "+datum);
   }

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
index 2137104..22a49f5 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
@@ -29,7 +29,7 @@ import org.apache.avro.generic.GenericData.Record;
  * for fields if they are not specified.  */
 public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   private final GenericData.Record record;
-  
+
   /**
    * Creates a GenericRecordBuilder for building Record instances.
    * @param schema the schema associated with the record class.
@@ -38,7 +38,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
     super(schema, GenericData.get());
     record = new GenericData.Record(schema);
   }
-  
+
   /**
    * Creates a GenericRecordBuilder by copying an existing GenericRecordBuilder.
    * @param other the GenericRecordBuilder to copy.
@@ -47,7 +47,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
     super(other, GenericData.get());
     record = new GenericData.Record(other.record, /* deepCopy = */ true);
   }
-  
+
   /**
    * Creates a GenericRecordBuilder by copying an existing record instance.
    * @param other the record instance to copy.
@@ -55,18 +55,18 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public GenericRecordBuilder(Record other) {
     super(other.getSchema(), GenericData.get());
     record = new GenericData.Record(other, /* deepCopy = */ true);
-    
+
     // Set all fields in the RecordBuilder that are set in the record
     for (Field f : schema().getFields()) {
       Object value = other.get(f.pos());
-      // Only set the value if it is not null, if the schema type is null, 
+      // Only set the value if it is not null, if the schema type is null,
       // or if the schema type is a union that accepts nulls.
       if (isValidValue(f, value)) {
         set(f, data().deepCopy(f.schema(), value));
       }
     }
   }
-  
+
   /**
    * Gets the value of a field.
    * @param fieldName the name of the field to get.
@@ -75,7 +75,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public Object get(String fieldName) {
     return get(schema().getField(fieldName));
   }
-  
+
   /**
    * Gets the value of a field.
    * @param field the field to get.
@@ -84,7 +84,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public Object get(Field field) {
     return get(field.pos());
   }
-  
+
   /**
    * Gets the value of a field.
    * @param pos the position of the field to get.
@@ -93,7 +93,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   protected Object get(int pos) {
     return record.get(pos);
   }
-  
+
   /**
    * Sets the value of a field.
    * @param fieldName the name of the field to set.
@@ -103,7 +103,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public GenericRecordBuilder set(String fieldName, Object value) {
     return set(schema().getField(fieldName), value);
   }
-  
+
   /**
    * Sets the value of a field.
    * @param field the field to set.
@@ -113,7 +113,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public GenericRecordBuilder set(Field field, Object value) {
     return set(field, field.pos(), value);
   }
-  
+
   /**
    * Sets the value of a field.
    * @param pos the field to set.
@@ -123,7 +123,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   protected GenericRecordBuilder set(int pos, Object value) {
     return set(fields()[pos], pos, value);
   }
-  
+
   /**
    * Sets the value of a field.
    * @param field the field to set.
@@ -137,7 +137,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
     fieldSetFlags()[pos] = true;
     return this;
   }
-  
+
   /**
    * Checks whether a field has been set.
    * @param fieldName the name of the field to check.
@@ -146,7 +146,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public boolean has(String fieldName) {
     return has(schema().getField(fieldName));
   }
-  
+
   /**
    * Checks whether a field has been set.
    * @param field the field to check.
@@ -155,7 +155,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public boolean has(Field field) {
     return has(field.pos());
   }
-  
+
   /**
    * Checks whether a field has been set.
    * @param pos the position of the field to check.
@@ -164,7 +164,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   protected boolean has(int pos) {
     return fieldSetFlags()[pos];
   }
-  
+
   /**
    * Clears the value of the given field.
    * @param fieldName the name of the field to clear.
@@ -173,7 +173,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public GenericRecordBuilder clear(String fieldName) {
     return clear(schema().getField(fieldName));
   }
-  
+
   /**
    * Clears the value of the given field.
    * @param field the field to clear.
@@ -182,7 +182,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
   public GenericRecordBuilder clear(Field field) {
     return clear(field.pos());
   }
-  
+
   /**
    * Clears the value of the given field.
    * @param pos the position of the field to clear.
@@ -193,7 +193,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
     fieldSetFlags()[pos] = false;
     return this;
   }
-  
+
   @Override
   public Record build() {
     Record record;
@@ -202,7 +202,7 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
     } catch (Exception e) {
       throw new AvroRuntimeException(e);
     }
-    
+
     for (Field field : fields()) {
       Object value;
       try {
@@ -214,22 +214,22 @@ public class GenericRecordBuilder extends RecordBuilderBase<Record> {
         record.put(field.pos(), value);
       }
     }
-    
+
     return record;
   }
-  
+
   /**
    * Gets the value of the given field.
    * If the field has been set, the set value is returned (even if it's null).
-   * If the field hasn't been set and has a default value, the default value 
+   * If the field hasn't been set and has a default value, the default value
    * is returned.
    * @param field the field whose value should be retrieved.
-   * @return the value set for the given field, the field's default value, 
+   * @return the value set for the given field, the field's default value,
    * or null.
    * @throws IOException
    */
   private Object getWithDefault(Field field) throws IOException {
-    return fieldSetFlags()[field.pos()] ? 
+    return fieldSetFlags()[field.pos()] ?
         record.get(field.pos()) : defaultValue(field);
   }
 

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
index 18cbf8a..3d4f79c 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
@@ -35,7 +35,7 @@ public class BinaryData {
        this.d1 = new BinaryDecoder(new byte[0], 0, 0);
        this.d2 = new BinaryDecoder(new byte[0], 0, 0);
     }
-    public void set(byte[] data1, int off1, int len1, 
+    public void set(byte[] data1, int off1, int len1,
                     byte[] data2, int off2, int len2) {
       d1.setBuf(data1, off1, len1);
       d2.setBuf(data2, off2, len2);
@@ -283,7 +283,7 @@ public class BinaryData {
     byte[] bytes = data.decoder.getBuf();
     int start = data.decoder.getPos();
     int end = start+len;
-    if (rev) 
+    if (rev)
       for (int i = end-1; i >= start; i--)
         hashCode = hashCode*31 + bytes[i];
     else
@@ -333,7 +333,7 @@ public class BinaryData {
           }
         }
       }
-    } 
+    }
     buf[pos++] = (byte) n;
     return pos - start;
   }
@@ -395,7 +395,7 @@ public class BinaryData {
   public static int encodeFloat(float f, byte[] buf, int pos) {
     int len = 1;
     int bits = Float.floatToRawIntBits(f);
-    // hotspot compiler works well with this variant 
+    // hotspot compiler works well with this variant
     buf[pos]         = (byte)((bits       ) & 0xFF);
     buf[pos + len++] = (byte)((bits >>>  8) & 0xFF);
     buf[pos + len++] = (byte)((bits >>> 16) & 0xFF);

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
index 7877002..3711d2b 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
@@ -33,7 +33,7 @@ import org.apache.avro.util.Utf8;
  * required to serve its read methods.
  * The number of unused bytes in the buffer can be accessed by
  * inputStream().remaining(), if the BinaryDecoder is not 'direct'.
- * 
+ *
  * @see Encoder
  */
 
@@ -191,7 +191,7 @@ public class BinaryDecoder extends Decoder {
     }
     return (l >>> 1) ^ -(l & 1); // back to two's-complement
   }
-  
+
   // splitting readLong up makes it faster because of the JVM does more
   // optimizations on small methods
   private long innerLongDecode(long l) throws IOException {
@@ -264,7 +264,7 @@ public class BinaryDecoder extends Decoder {
     }
     return result;
   }
-  
+
   private final Utf8 scratchUtf8 = new Utf8();
 
   @Override
@@ -325,7 +325,7 @@ public class BinaryDecoder extends Decoder {
 
   /**
    * Reads <tt>length</tt> bytes into <tt>bytes</tt> starting at <tt>start</tt>.
-   * 
+   *
    * @throws EOFException
    *           If there are not enough number of bytes in the source.
    * @throws IOException
@@ -354,7 +354,7 @@ public class BinaryDecoder extends Decoder {
    * Returns the number of items to follow in the current array or map. Returns
    * 0 if there are no more items in the current array and the array/map has
    * ended.
-   * 
+   *
    * @throws IOException
    */
   protected long doReadItemCount() throws IOException {
@@ -372,7 +372,7 @@ public class BinaryDecoder extends Decoder {
    * more items left in the array or map. If items cannot be skipped (because
    * byte count to skip is not found in the stream) return the count of the
    * items found. The client needs to skip the items individually.
-   * 
+   *
    * @return Zero if there are no more items to skip and end of array/map is
    *         reached. Positive number if some items are found that cannot be
    *         skipped and the client needs to skip them individually.
@@ -476,10 +476,10 @@ public class BinaryDecoder extends Decoder {
 
   /**
    * Returns an {@link java.io.InputStream} that is aware of any buffering that
-   * may occur in this BinaryDecoder. Readers that need to interleave decoding 
+   * may occur in this BinaryDecoder. Readers that need to interleave decoding
    * Avro data with other reads must access this InputStream to do so unless
    * the implementation is 'direct' and does not read beyond the minimum bytes
-   * necessary from the source.  
+   * necessary from the source.
    */
   public InputStream inputStream() {
     return source;
@@ -624,7 +624,7 @@ public class BinaryDecoder extends Decoder {
     /**
      * Skips length bytes from the source. If length bytes cannot be skipped due
      * to end of file/stream/channel/etc an EOFException is thrown
-     * 
+     *
      * @param length
      *          the number of bytes to attempt to skip
      * @throws IOException
@@ -639,7 +639,7 @@ public class BinaryDecoder extends Decoder {
      * actual number of bytes skipped. This method must attempt to skip as many
      * bytes as possible up to <i>skipLength</i> bytes. Skipping 0 bytes signals
      * end of stream/channel/file/etc
-     * 
+     *
      * @param skipLength
      *          the number of bytes to attempt to skip
      * @return the count of actual bytes skipped.
@@ -650,7 +650,7 @@ public class BinaryDecoder extends Decoder {
      * Reads raw from the source, into a byte[]. Used for reads that are larger
      * than the buffer, or otherwise unbuffered. This is a mandatory read -- if
      * there is not enough bytes in the source, EOFException is thrown.
-     * 
+     *
      * @throws IOException
      *           if an error occurs
      * @throws EOFException
@@ -666,7 +666,7 @@ public class BinaryDecoder extends Decoder {
      * <p/>
      * This method must attempt to read as much as possible from the source.
      * Returns 0 when at the end of stream/channel/file/etc.
-     * 
+     *
      * @throws IOException
      *           if an error occurs reading
      **/
@@ -677,9 +677,9 @@ public class BinaryDecoder extends Decoder {
      * If this source buffers, compacts the buffer by placing the
      * <i>remaining</i> bytes starting at <i>pos</i> at <i>minPos</i>. This may
      * be done in the current buffer, or may replace the buffer with a new one.
-     * 
+     *
      * The end result must be a buffer with at least 16 bytes of remaining space.
-     * 
+     *
      * @param pos
      * @param minPos
      * @param remaining
@@ -876,7 +876,7 @@ public class BinaryDecoder extends Decoder {
   /**
    * This byte source is special. It will avoid copying data by using the
    * source's byte[] as a buffer in the decoder.
-   * 
+   *
    */
   private static class ByteArrayByteSource extends ByteSource {
     private byte[] data;

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
index 7be0390..9e21a65 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java
@@ -26,7 +26,7 @@ import org.apache.avro.util.Utf8;
  * An abstract {@link Encoder} for Avro's binary encoding.
  * <p/>
  * To construct and configure instances, use {@link EncoderFactory}
- * 
+ *
  * @see EncoderFactory
  * @see BufferedBinaryEncoder
  * @see DirectBinaryEncoder
@@ -35,15 +35,15 @@ import org.apache.avro.util.Utf8;
  * @see Decoder
  */
 public abstract class BinaryEncoder extends Encoder {
-  
+
   @Override
   public void writeNull() throws IOException {}
-  
+
   @Override
   public void writeString(Utf8 utf8) throws IOException {
     this.writeBytes(utf8.getBytes(), 0, utf8.getByteLength());
   }
-  
+
   @Override
   public void writeString(String string) throws IOException {
     if (0 == string.length()) {
@@ -65,7 +65,7 @@ public abstract class BinaryEncoder extends Encoder {
       writeFixed(bytes);
     }
   }
-  
+
   @Override
   public void writeBytes(byte[] bytes, int start, int len) throws IOException {
     if (0 == len) {
@@ -75,7 +75,7 @@ public abstract class BinaryEncoder extends Encoder {
     this.writeInt(len);
     this.writeFixed(bytes, start, len);
   }
-  
+
   @Override
   public void writeEnum(int e) throws IOException {
     this.writeInt(e);
@@ -90,7 +90,7 @@ public abstract class BinaryEncoder extends Encoder {
       this.writeLong(itemCount);
     }
   }
-  
+
   @Override
   public void startItem() throws IOException {}
 
@@ -111,10 +111,10 @@ public abstract class BinaryEncoder extends Encoder {
   public void writeIndex(int unionIndex) throws IOException {
     writeInt(unionIndex);
   }
-  
+
   /** Write a zero byte to the underlying output. **/
   protected abstract void writeZero() throws IOException;
-  
+
   /**
    * Returns the number of bytes currently buffered by this encoder. If this
    * Encoder does not buffer, this will always return zero.
@@ -122,6 +122,6 @@ public abstract class BinaryEncoder extends Encoder {
    * Call {@link #flush()} to empty the buffer to the underlying output.
    */
   public abstract int bytesBuffered();
-  
+
 }
 

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java
index e8b6c33..96a055d 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java
@@ -37,7 +37,7 @@ import org.apache.avro.Schema;
  * {@link #flush()} is called.
  * <p/>
  * BlockingBinaryEncoder is not thread-safe
- * 
+ *
  * @see BinaryEncoder
  * @see EncoderFactory
  * @see Encoder
@@ -100,7 +100,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
 
     /** The state of this BlockedValue */
     public State state;
-    
+
     /** The location in the buffer where this blocked value starts */
     public int start;
 
@@ -109,7 +109,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
      * is the first item, this is same as {@link #start}.
      */
     public int lastFullItem;
-    
+
     /**
      * Number of items in this blocked value that are stored
      * in the buffer.
@@ -126,7 +126,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
       this.start = this.lastFullItem = 0;
       this.items = 1; // Makes various assertions work out
     }
-    
+
     /**
      * Check invariants of <code>this</code> and also the
      * <code>BlockedValue</code> containing <code>this</code>.
@@ -167,12 +167,12 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
    * stream.
    */
   private byte[] buf;
-  
+
   /**
    * Index into the location in {@link #buf}, where next byte can be written.
    */
   private int pos;
-  
+
   /**
    * The state stack.
    */
@@ -232,11 +232,11 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
     if (null == buf || buf.length != blockBufferSize) {
       buf = new byte[blockBufferSize];
     }
-    
+
     assert check();
     return this;
   }
-  
+
   @Override
   public void flush() throws IOException {
       BlockedValue bv = blockStack[stackTop];
@@ -270,7 +270,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
     ensureBounds(10);
     pos += BinaryData.encodeLong(n, buf, pos);
   }
-    
+
   @Override
   public void writeFloat(float f) throws IOException {
     ensureBounds(4);
@@ -287,7 +287,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
   public void writeFixed(byte[] bytes, int start, int len) throws IOException {
     doWriteBytes(bytes, start, len);
   }
-  
+
   @Override
   protected void writeZero() throws IOException {
     ensureBounds(1);
@@ -318,7 +318,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
 
     assert check();
   }
-  
+
   @Override
   public void startItem() throws IOException {
     if (blockStack[stackTop].state == BlockedValue.State.OVERFLOW) {
@@ -371,7 +371,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
       throw new AvroTypeException("Failed to read write expected number of array elements.");
     }
     endBlockedValue();
-    
+
     assert check();
   }
 
@@ -385,7 +385,7 @@ public class BlockingBinaryEncoder extends BufferedBinaryEncoder {
   public int bytesBuffered() {
     return pos + super.bytesBuffered();
   }
-  
+
   private void endBlockedValue() throws IOException {
     for (; ;) {
       assert check();

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java
index cb0758c..82a36f9 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java
@@ -38,7 +38,7 @@ import org.apache.avro.AvroRuntimeException;
  * To construct or reconfigure, use
  * {@link EncoderFactory#binaryEncoder(OutputStream, BinaryEncoder)}.
  * <p/>
- * To change the buffer size, configure the factory instance used to 
+ * To change the buffer size, configure the factory instance used to
  * create instances with {@link EncoderFactory#configureBufferSize(int)}
  *  @see Encoder
  *  @see EncoderFactory
@@ -54,7 +54,7 @@ public class BufferedBinaryEncoder extends BinaryEncoder {
   BufferedBinaryEncoder(OutputStream out, int bufferSize) {
     configure(out, bufferSize);
   }
-  
+
   BufferedBinaryEncoder configure(OutputStream out, int bufferSize) {
     if (null == out)
       throw new NullPointerException("OutputStream cannot be null!");
@@ -85,7 +85,7 @@ public class BufferedBinaryEncoder extends BinaryEncoder {
     sink.innerFlush();
   }
 
-  /** Flushes the internal buffer to the underlying output. 
+  /** Flushes the internal buffer to the underlying output.
    * Does not flush the underlying output.
    */
   private void flushBuffer() throws IOException {
@@ -154,7 +154,7 @@ public class BufferedBinaryEncoder extends BinaryEncoder {
     System.arraycopy(bytes, start, buf, pos, len);
     pos += len;
   }
-  
+
   @Override
   public void writeFixed(ByteBuffer bytes) throws IOException {
     if (!bytes.hasArray() && bytes.remaining() > bulkLimit) {
@@ -169,7 +169,7 @@ public class BufferedBinaryEncoder extends BinaryEncoder {
   protected void writeZero() throws IOException {
     writeByte(0);
   }
-  
+
   private void writeByte(int b) throws IOException {
     if (pos == buf.length) {
       flushBuffer();
@@ -195,13 +195,13 @@ public class BufferedBinaryEncoder extends BinaryEncoder {
     protected ByteSink() {}
     /** Write data from bytes, starting at off, for len bytes **/
     protected abstract void innerWrite(byte[] bytes, int off, int len) throws IOException;
-    
+
     protected abstract void innerWrite(ByteBuffer buff) throws IOException;
-    
+
     /** Flush the underlying output, if supported **/
     protected abstract void innerFlush() throws IOException;
   }
-  
+
   static class OutputStreamSink extends ByteSink {
     private final OutputStream out;
     private final WritableByteChannel channel;

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java
index e924de5..46d3e9e 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java
@@ -88,14 +88,14 @@ public abstract class Decoder {
    *           is not the type of the next value to be read
    */
   public abstract double readDouble() throws IOException;
-    
+
   /**
    * Reads a char-string written by {@link Encoder#writeString}.
    * @throws AvroTypeException If this is a stateful reader and
    * char-string is not the type of the next value to be read
    */
   public abstract Utf8 readString(Utf8 old) throws IOException;
-    
+
   /**
    * Reads a char-string written by {@link Encoder#writeString}.
    * @throws AvroTypeException If this is a stateful reader and
@@ -125,7 +125,7 @@ public abstract class Decoder {
    *          byte-string is not the type of the next value to be read
    */
   public abstract void skipBytes() throws IOException;
-  
+
   /**
    * Reads fixed sized binary object.
    * @param bytes The buffer to store the contents being read.
@@ -149,7 +149,7 @@ public abstract class Decoder {
   public void readFixed(byte[] bytes) throws IOException {
     readFixed(bytes, 0, bytes.length);
   }
-  
+
   /**
    * Discards fixed sized binary object.
    * @param length  The size of the binary object to be skipped.
@@ -168,7 +168,7 @@ public abstract class Decoder {
    * @throws IOException
    */
   public abstract int readEnum() throws IOException;
-  
+
   /**
    * Reads and returns the size of the first block of an array.  If
    * this method returns non-zero, then the caller should read the

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java b/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java
index c777614..2e874ad 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java
@@ -28,7 +28,7 @@ import org.apache.avro.Schema;
  * Factories are thread-safe, and are generally cached by applications for
  * performance reasons. Multiple instances are only required if multiple
  * concurrent configurations are needed.
- * 
+ *
  * @see Decoder
  */
 
@@ -50,7 +50,7 @@ public class DecoderFactory {
   public static DecoderFactory defaultFactory() {
     return get();
   }
-  
+
   /**
    * Returns an immutable static DecoderFactory configured with default settings
    * All mutating methods throw IllegalArgumentExceptions. All creator methods
@@ -64,7 +64,7 @@ public class DecoderFactory {
    * Configures this factory to use the specified buffer size when creating
    * Decoder instances that buffer their input. The default buffer size is
    * 8192 bytes.
-   * 
+   *
    * @param size The preferred buffer size. Valid values are in the range [32,
    *          16*1024*1024]. Values outside this range are rounded to the nearest
    *          value in the range. Values less than 512 or greater than 1024*1024
@@ -82,7 +82,7 @@ public class DecoderFactory {
     this.binaryDecoderBufferSize = size;
     return this;
   }
-  
+
   /**
    * Returns this factory's configured preferred buffer size.  Used when creating
    * Decoder instances that buffer. See {@link #configureDecoderBufferSize}
@@ -91,14 +91,14 @@ public class DecoderFactory {
   public int getConfiguredBufferSize() {
     return this.binaryDecoderBufferSize;
   }
-  
+
   /** @deprecated use the equivalent
    *  {@link #binaryDecoder(InputStream, BinaryDecoder)} instead */
   @Deprecated
   public BinaryDecoder createBinaryDecoder(InputStream in, BinaryDecoder reuse) {
     return binaryDecoder(in, reuse);
   }
-  
+
   /**
    * Creates or reinitializes a {@link BinaryDecoder} with the input stream
    * provided as the source of data. If <i>reuse</i> is provided, it will be
@@ -113,7 +113,7 @@ public class DecoderFactory {
    * {@link BinaryDecoder#inputStream()} provides a view on the data that is
    * buffer-aware, for users that need to interleave access to data
    * with the Decoder API.
-   * 
+   *
    * @param in
    *          The InputStream to initialize to
    * @param reuse
@@ -135,7 +135,7 @@ public class DecoderFactory {
       return ((BinaryDecoder)reuse).configure(in, binaryDecoderBufferSize);
     }
   }
-  
+
   /**
    * Creates or reinitializes a {@link BinaryDecoder} with the input stream
    * provided as the source of data. If <i>reuse</i> is provided, it will be
@@ -149,7 +149,7 @@ public class DecoderFactory {
    * A "direct" BinaryDecoder does not read ahead from an InputStream or other data source
    * that cannot be rewound.  From the perspective of a client, a "direct" decoder
    * must never read beyond the minimum necessary bytes to service a {@link BinaryDecoder}
-   * API read request.  
+   * API read request.
    * <p/>
    * In the case that the improved performance of a buffering implementation does not outweigh the
    * inconvenience of its buffering semantics, a "direct" decoder can be
@@ -187,7 +187,7 @@ public class DecoderFactory {
       return reuse.configure(bytes, offset, length);
     }
   }
-  
+
   /**
    * Creates or reinitializes a {@link BinaryDecoder} with the byte array
    * provided as the source of data. If <i>reuse</i> is provided, it will
@@ -197,7 +197,7 @@ public class DecoderFactory {
    * {@link BinaryDecoder#inputStream()} provides a view on the data that is
    * buffer-aware and can provide a view of the data not yet read by Decoder API
    * methods.
-   * 
+   *
    * @param bytes The byte array to initialize to
    * @param offset The offset to start reading from
    * @param length The maximum number of bytes to read from the byte array
@@ -223,7 +223,7 @@ public class DecoderFactory {
   public BinaryDecoder createBinaryDecoder(byte[] bytes, BinaryDecoder reuse) {
     return binaryDecoder(bytes, 0, bytes.length, reuse);
   }
-  
+
   /**
    * This method is shorthand for
    * <pre>
@@ -238,7 +238,7 @@ public class DecoderFactory {
    * Creates a {@link JsonDecoder} using the InputStrim provided for reading
    * data that conforms to the Schema provided.
    * <p/>
-   * 
+   *
    * @param schema
    *          The Schema for data read from this JsonEncoder. Cannot be null.
    * @param input
@@ -250,12 +250,12 @@ public class DecoderFactory {
       throws IOException {
     return new JsonDecoder(schema, input);
   }
-  
+
   /**
    * Creates a {@link JsonDecoder} using the String provided for reading data
    * that conforms to the Schema provided.
    * <p/>
-   * 
+   *
    * @param schema
    *          The Schema for data read from this JsonEncoder. Cannot be null.
    * @param input
@@ -272,7 +272,7 @@ public class DecoderFactory {
    * Creates a {@link ValidatingDecoder} wrapping the Decoder provided. This
    * ValidatingDecoder will ensure that operations against it conform to the
    * schema provided.
-   * 
+   *
    * @param schema
    *          The Schema to validate against. Cannot be null.
    * @param wrapped
@@ -290,7 +290,7 @@ public class DecoderFactory {
    * Creates a {@link ResolvingDecoder} wrapping the Decoder provided. This
    * ResolvingDecoder will resolve input conforming to the <i>writer</i> schema
    * from the wrapped Decoder, and present it as the <i>reader</i> schema.
-   * 
+   *
    * @param writer
    *          The Schema that the source data is in. Cannot be null.
    * @param reader
@@ -306,7 +306,7 @@ public class DecoderFactory {
       Decoder wrapped) throws IOException {
     return new ResolvingDecoder(writer, reader, wrapped);
   }
-  
+
   private static class DefaultDecoderFactory extends DecoderFactory {
     @Override
     public DecoderFactory configureDecoderBufferSize(int bufferSize) {

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java
index 5bc1760..07c6199 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java
@@ -54,11 +54,11 @@ class DirectBinaryDecoder extends BinaryDecoder {
 
   private class ReuseByteReader extends ByteReader {
     private final ByteBufferInputStream bbi;
-    
+
     public ReuseByteReader(ByteBufferInputStream bbi) {
       this.bbi = bbi;
     }
-    
+
     @Override
     public ByteBuffer read(ByteBuffer old, int length) throws IOException {
       if (old != null) {
@@ -67,7 +67,7 @@ class DirectBinaryDecoder extends BinaryDecoder {
         return bbi.readBuffer(length);
       }
     }
-    
+
   }
 
   private ByteReader byteReader;
@@ -111,7 +111,7 @@ class DirectBinaryDecoder extends BinaryDecoder {
       shift += 7;
     } while (shift < 32);
     throw new IOException("Invalid int encoding");
-    
+
   }
 
   @Override
@@ -119,7 +119,7 @@ class DirectBinaryDecoder extends BinaryDecoder {
     long n = 0;
     int b;
     int shift = 0;
-    do { 
+    do {
       b = in.read();
       if (b >= 0) {
          n |= (b & 0x7FL) << shift;

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java
index 1126742..ff5b52c 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java
@@ -43,7 +43,7 @@ public class DirectBinaryEncoder extends BinaryEncoder {
   private final byte[] buf = new byte[12];
 
   /** Create a writer that sends its output to the underlying stream
-   *  <code>out</code>. 
+   *  <code>out</code>.
    **/
   DirectBinaryEncoder(OutputStream out) {
     configure(out);
@@ -84,7 +84,7 @@ public class DirectBinaryEncoder extends BinaryEncoder {
   }
 
   /* buffering is slower for writeLong when the number is small enough to
-   * fit in an int. 
+   * fit in an int.
    * (Sun JRE 1.6u22, x64 -server) */
   @Override
   public void writeLong(long n) throws IOException {
@@ -101,7 +101,7 @@ public class DirectBinaryEncoder extends BinaryEncoder {
     int len = BinaryData.encodeLong(n, buf, 0);
     out.write(buf, 0, len);
   }
-  
+
   @Override
   public void writeFloat(float f) throws IOException {
     int len = BinaryData.encodeFloat(f, buf, 0);
@@ -124,7 +124,7 @@ public class DirectBinaryEncoder extends BinaryEncoder {
   protected void writeZero() throws IOException {
     out.write(0);
   }
-  
+
   @Override
   public int bytesBuffered() {
     return 0;

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java
index c3647c0..4148afb 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java
@@ -40,7 +40,7 @@ import org.apache.avro.util.Utf8;
  * (See {@link #writeArrayStart} for details on these methods.)
  * <p/>
  * {@link EncoderFactory} contains Encoder construction and configuration
- * facilities.  
+ * facilities.
  *  @see EncoderFactory
  *  @see Decoder
  */
@@ -53,7 +53,7 @@ public abstract class Encoder implements Flushable {
    *         null is not expected
    */
   public abstract void writeNull() throws IOException;
-  
+
   /**
    * Write a boolean value.
    * @throws AvroTypeException If this is a stateful writer and a
@@ -74,9 +74,9 @@ public abstract class Encoder implements Flushable {
    * long is not expected
    */
   public abstract void writeLong(long n) throws IOException;
-  
+
   /** Write a float.
-   * @throws IOException 
+   * @throws IOException
    * @throws AvroTypeException If this is a stateful writer and a
    * float is not expected
    */
@@ -98,7 +98,7 @@ public abstract class Encoder implements Flushable {
 
   /**
    * Write a Unicode character string.  The default implementation converts
-   * the String to a {@link org.apache.avro.util.Utf8}.  Some Encoder 
+   * the String to a {@link org.apache.avro.util.Utf8}.  Some Encoder
    * implementations may want to do something different as a performance optimization.
    * @throws AvroTypeException If this is a stateful writer and a
    * char-string is not expected
@@ -120,25 +120,25 @@ public abstract class Encoder implements Flushable {
     else
       writeString(charSequence.toString());
   }
-  
+
   /**
    * Write a byte string.
    * @throws AvroTypeException If this is a stateful writer and a
    *         byte-string is not expected
    */
   public abstract void writeBytes(ByteBuffer bytes) throws IOException;
-  
+
   /**
    * Write a byte string.
    * @throws AvroTypeException If this is a stateful writer and a
    * byte-string is not expected
    */
   public abstract void writeBytes(byte[] bytes, int start, int len) throws IOException;
-  
+
   /**
    * Writes a byte string.
    * Equivalent to <tt>writeBytes(bytes, 0, bytes.length)</tt>
-   * @throws IOException 
+   * @throws IOException
    * @throws AvroTypeException If this is a stateful writer and a
    * byte-string is not expected
    */
@@ -165,7 +165,7 @@ public abstract class Encoder implements Flushable {
   public void writeFixed(byte[] bytes) throws IOException {
     writeFixed(bytes, 0, bytes.length);
   }
-  
+
   /** Writes a fixed from a ByteBuffer. */
   public void writeFixed(ByteBuffer bytes) throws IOException {
     int pos = bytes.position();
@@ -225,12 +225,12 @@ public abstract class Encoder implements Flushable {
    * to {@link #startItem()} must be equal to the count specified
    * in {@link #setItemCount}. Once a batch is completed you
    * can start another batch with {@link #setItemCount}.
-   * 
+   *
    * @param itemCount The number of {@link #startItem()} calls to follow.
    * @throws IOException
    */
   public abstract void setItemCount(long itemCount) throws IOException;
-  
+
   /**
    * Start a new item of an array or map.
    * See {@link #writeArrayStart} for usage information.

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java b/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java
index 679daa7..9ba1acc 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java
@@ -30,7 +30,7 @@ import org.codehaus.jackson.JsonGenerator;
  * Factory methods that create Encoder instances are thread-safe.
  * Multiple instances with different configurations can be cached
  * by an application.
- * 
+ *
  * @see Encoder
  * @see BinaryEncoder
  * @see JsonEncoder
@@ -46,9 +46,9 @@ public class EncoderFactory {
   private static final int MIN_BLOCK_BUFFER_SIZE = 64;
   private static final int MAX_BLOCK_BUFFER_SIZE = 1024 * 1024 * 1024;
 
-  private static final EncoderFactory DEFAULT_FACTORY = 
+  private static final EncoderFactory DEFAULT_FACTORY =
     new DefaultEncoderFactory();
-  
+
   protected int binaryBufferSize = DEFAULT_BUFFER_SIZE;
   protected int binaryBlockSize = DEFAULT_BLOCK_BUFFER_SIZE;
 
@@ -59,12 +59,12 @@ public class EncoderFactory {
   public static EncoderFactory get() {
     return DEFAULT_FACTORY;
   }
-  
+
   /**
    * Configures this factory to use the specified buffer size when creating
    * Encoder instances that buffer their output. The default buffer size is 2048
    * bytes.
-   * 
+   *
    * @param size
    *          The buffer size to configure new instances with. Valid values are
    *          in the range [32, 16*1024*1024]. Values outside this range are set
@@ -86,7 +86,7 @@ public class EncoderFactory {
     this.binaryBufferSize = size;
     return this;
   }
-  
+
   /**
    * Returns this factory's configured default buffer size.  Used when creating
    * Encoder instances that buffer writes.
@@ -101,7 +101,7 @@ public class EncoderFactory {
   /**
    * Configures this factory to construct blocking BinaryEncoders with the
    * specified block buffer size. The default buffer size is 64 * 1024 bytes.
-   * 
+   *
    * @param size
    *          The preferred block size for array blocking. Arrays larger than
    *          this size will be segmented into blocks according to the Avro
@@ -115,7 +115,7 @@ public class EncoderFactory {
    * @see #blockingBinaryEncoder(OutputStream, BinaryEncoder)
    */
   public EncoderFactory configureBlockSize(int size) {
-    if (size < MIN_BLOCK_BUFFER_SIZE) 
+    if (size < MIN_BLOCK_BUFFER_SIZE)
       size = MIN_BLOCK_BUFFER_SIZE;
     if (size > MAX_BLOCK_BUFFER_SIZE)
       size = MAX_BLOCK_BUFFER_SIZE;
@@ -124,7 +124,7 @@ public class EncoderFactory {
   }
 
   /**
-   * Returns this factory's configured default block buffer size.  
+   * Returns this factory's configured default block buffer size.
    * {@link BinaryEncoder} instances created with
    * #blockingBinaryEncoder(OutputStream, BinaryEncoder)
    * will have block buffers of this size.
@@ -136,7 +136,7 @@ public class EncoderFactory {
   public int getBlockSize() {
     return this.binaryBlockSize;
   }
-  
+
   /**
    * Creates or reinitializes a {@link BinaryEncoder} with the OutputStream
    * provided as the destination for written data. If <i>reuse</i> is provided,
@@ -147,11 +147,11 @@ public class EncoderFactory {
    * Data may not appear on the underlying OutputStream until
    * {@link Encoder#flush()} is called.  The buffer size is configured with
    * {@link #configureBufferSize(int)}.
-   * </p>  If buffering is not desired, and lower performance is acceptable, use 
+   * </p>  If buffering is not desired, and lower performance is acceptable, use
    * {@link #directBinaryEncoder(OutputStream, BinaryEncoder)}
    * <p/>
    * {@link BinaryEncoder} instances returned by this method are not thread-safe
-   * 
+   *
    * @param out
    *          The OutputStream to write to.  Cannot be null.
    * @param reuse
@@ -163,7 +163,7 @@ public class EncoderFactory {
    *         <i>reuse</i> is null, this will be a new instance. If <i>reuse</i>
    *         is not null, then the returned instance may be a new instance or
    *         <i>reuse</i> reconfigured to use <i>out</i>.
-   * @throws IOException 
+   * @throws IOException
    * @see BufferedBinaryEncoder
    * @see Encoder
    */
@@ -193,7 +193,7 @@ public class EncoderFactory {
    * would not be useful.
    * <p/>
    * {@link BinaryEncoder} instances returned by this method are not thread-safe.
-   * 
+   *
    * @param out
    *          The OutputStream to initialize to. Cannot be null.
    * @param reuse
@@ -215,7 +215,7 @@ public class EncoderFactory {
       return ((DirectBinaryEncoder)reuse).configure(out);
     }
   }
-  
+
   /**
    * Creates or reinitializes a {@link BinaryEncoder} with the OutputStream
    * provided as the destination for written data. If <i>reuse</i> is provided,
@@ -230,10 +230,10 @@ public class EncoderFactory {
    * delimited with byte sizes for Arrays and Maps.  This allows for some decoders
    * to skip over large Arrays or Maps without decoding the contents, but adds
    * some overhead.  The default block size is configured with
-   * {@link #configureBlockSize(int)} 
+   * {@link #configureBlockSize(int)}
    * <p/>
    * {@link BinaryEncoder} instances returned by this method are not thread-safe.
-   * 
+   *
    * @param out
    *          The OutputStream to initialize to. Cannot be null.
    * @param reuse
@@ -269,7 +269,7 @@ public class EncoderFactory {
    * underlying OutputStream until {@link Encoder#flush()} is called.
    * <p/>
    * {@link JsonEncoder} is not thread-safe.
-   * 
+   *
    * @param schema
    *          The Schema for data written to this JsonEncoder. Cannot be null.
    * @param out
@@ -290,7 +290,7 @@ public class EncoderFactory {
    * underlying OutputStream until {@link Encoder#flush()} is called.
    * <p/>
    * {@link JsonEncoder} is not thread-safe.
-   * 
+   *
    * @param schema
    *          The Schema for data written to this JsonEncoder. Cannot be null.
    * @param out
@@ -313,7 +313,7 @@ public class EncoderFactory {
    * underlying output until {@link Encoder#flush()} is called.
    * <p/>
    * {@link JsonEncoder} is not thread-safe.
-   * 
+   *
    * @param schema
    *          The Schema for data written to this JsonEncoder. Cannot be null.
    * @param gen
@@ -327,7 +327,7 @@ public class EncoderFactory {
       throws IOException {
     return new JsonEncoder(schema, gen);
   }
-  
+
   /**
    * Creates a {@link ValidatingEncoder} that wraps the Encoder provided.
    * This ValidatingEncoder will ensure that operations against it conform
@@ -337,7 +337,7 @@ public class EncoderFactory {
    * underlying output until {@link Encoder#flush()} is called.
    * <p/>
    * {@link ValidatingEncoder} is not thread-safe.
-   * 
+   *
    * @param schema
    *          The Schema to validate operations against. Cannot be null.
    * @param encoder
@@ -350,7 +350,7 @@ public class EncoderFactory {
       throws IOException {
     return new ValidatingEncoder(schema, encoder);
   }
-  
+
   // default encoder is not mutable
   private static class DefaultEncoderFactory extends EncoderFactory {
     @Override

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java
index 8206181..8045199 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java
@@ -43,7 +43,7 @@ import org.codehaus.jackson.JsonStreamContext;
 import org.codehaus.jackson.JsonToken;
 import org.codehaus.jackson.ObjectCodec;
 
-/** A {@link Decoder} for Avro's JSON data encoding. 
+/** A {@link Decoder} for Avro's JSON data encoding.
  * </p>
  * Construct using {@link DecoderFactory}.
  * </p>
@@ -54,20 +54,20 @@ public class JsonDecoder extends ParsingDecoder
   private JsonParser in;
   private static JsonFactory jsonFactory = new JsonFactory();
   Stack<ReorderBuffer> reorderBuffers = new Stack<ReorderBuffer>();
-  ReorderBuffer currentReorderBuffer; 
-  
+  ReorderBuffer currentReorderBuffer;
+
   private static class ReorderBuffer {
     public Map<String, List<JsonElement>> savedFields = new HashMap<String, List<JsonElement>>();
-    public JsonParser origParser = null; 
+    public JsonParser origParser = null;
   }
-  
+
   static final String CHARSET = "ISO-8859-1";
 
   private JsonDecoder(Symbol root, InputStream in) throws IOException {
     super(root);
     configure(in);
   }
-  
+
   private JsonDecoder(Symbol root, String in) throws IOException {
     super(root);
     configure(in);
@@ -76,11 +76,11 @@ public class JsonDecoder extends ParsingDecoder
   JsonDecoder(Schema schema, InputStream in) throws IOException {
     this(getSymbol(schema), in);
   }
-  
+
   JsonDecoder(Schema schema, String in) throws IOException {
     this(getSymbol(schema), in);
   }
-  
+
   private static Symbol getSymbol(Schema schema) {
     if (null == schema) {
       throw new NullPointerException("Schema cannot be null!");
@@ -109,7 +109,7 @@ public class JsonDecoder extends ParsingDecoder
     this.in.nextToken();
     return this;
   }
-  
+
   /**
    * Reconfigures this JsonDecoder to use the String provided for input.
    * <p/>
@@ -152,7 +152,7 @@ public class JsonDecoder extends ParsingDecoder
   @Override
   public boolean readBoolean() throws IOException {
     advance(Symbol.BOOLEAN);
-    JsonToken t = in.getCurrentToken(); 
+    JsonToken t = in.getCurrentToken();
     if (t == JsonToken.VALUE_TRUE || t == JsonToken.VALUE_FALSE) {
       in.nextToken();
       return t == JsonToken.VALUE_TRUE;
@@ -172,7 +172,7 @@ public class JsonDecoder extends ParsingDecoder
       throw error("int");
     }
   }
-    
+
   @Override
   public long readLong() throws IOException {
     advance(Symbol.LONG);
@@ -208,7 +208,7 @@ public class JsonDecoder extends ParsingDecoder
       throw error("double");
     }
   }
-    
+
   @Override
   public Utf8 readString(Utf8 old) throws IOException {
     return new Utf8(readString());
@@ -284,7 +284,7 @@ public class JsonDecoder extends ParsingDecoder
         top.size + " but received " + size + " bytes.");
     }
   }
-    
+
   @Override
   public void readFixed(byte[] bytes, int start, int len) throws IOException {
     checkFixed(len);
@@ -377,7 +377,7 @@ public class JsonDecoder extends ParsingDecoder
     if (in.getCurrentToken() == JsonToken.START_ARRAY) {
       in.skipChildren();
       in.nextToken();
-      advance(Symbol.ARRAY_END);    
+      advance(Symbol.ARRAY_END);
     } else {
       throw error("array-start");
     }
@@ -417,7 +417,7 @@ public class JsonDecoder extends ParsingDecoder
     if (in.getCurrentToken() == JsonToken.START_OBJECT) {
       in.skipChildren();
       in.nextToken();
-      advance(Symbol.MAP_END);    
+      advance(Symbol.MAP_END);
     } else {
       throw error("map-start");
     }
@@ -428,7 +428,7 @@ public class JsonDecoder extends ParsingDecoder
   public int readIndex() throws IOException {
     advance(Symbol.UNION);
     Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol();
-    
+
     String label;
     if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
       label = "null";
@@ -514,12 +514,12 @@ public class JsonDecoder extends ParsingDecoder
       this.token = t;
       this.value = value;
     }
-    
+
     public JsonElement(JsonToken t) {
       this(t, null);
     }
   }
-  
+
   private static List<JsonElement> getVaueAsTree(JsonParser in) throws IOException {
     int level = 0;
     List<JsonElement> result = new ArrayList<JsonElement>();
@@ -685,7 +685,7 @@ public class JsonDecoder extends ParsingDecoder
         throws IOException {
         throw new UnsupportedOperationException();
       }
-      
+
       @Override
       public JsonToken getCurrentToken() {
         return elements.get(pos).token;

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java
index 9d413e6..2c2b0c1 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java
@@ -34,7 +34,7 @@ import org.codehaus.jackson.JsonGenerator;
 import org.codehaus.jackson.util.DefaultPrettyPrinter;
 import org.codehaus.jackson.util.MinimalPrettyPrinter;
 
-/** An {@link Encoder} for Avro's JSON data encoding. 
+/** An {@link Encoder} for Avro's JSON data encoding.
  * </p>
  * Construct using {@link EncoderFactory}.
  * </p>
@@ -79,7 +79,7 @@ public class JsonEncoder extends ParsingEncoder implements Parser.ActionHandler
   private static JsonGenerator getJsonGenerator(OutputStream out, boolean pretty)
       throws IOException {
     if (null == out)
-      throw new NullPointerException("OutputStream cannot be null"); 
+      throw new NullPointerException("OutputStream cannot be null");
     JsonGenerator g
       = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
     if (pretty) {
@@ -99,7 +99,7 @@ public class JsonEncoder extends ParsingEncoder implements Parser.ActionHandler
     }
     return g;
   }
-  
+
   /**
    * Reconfigures this JsonEncoder to use the output stream provided.
    * <p/>
@@ -108,7 +108,7 @@ public class JsonEncoder extends ParsingEncoder implements Parser.ActionHandler
    * Otherwise, this JsonEncoder will flush its current output and then
    * reconfigure its output to use a default UTF8 JsonGenerator that writes
    * to the provided OutputStream.
-   * 
+   *
    * @param out
    *          The OutputStream to direct output to. Cannot be null.
    * @throws IOException
@@ -118,7 +118,7 @@ public class JsonEncoder extends ParsingEncoder implements Parser.ActionHandler
     this.configure(getJsonGenerator(out, false));
     return this;
   }
-  
+
   /**
    * Reconfigures this JsonEncoder to output to the JsonGenerator provided.
    * <p/>
@@ -126,7 +126,7 @@ public class JsonEncoder extends ParsingEncoder implements Parser.ActionHandler
    * <p/>
    * Otherwise, this JsonEncoder will flush its current output and then
    * reconfigure its output to use the provided JsonGenerator.
-   * 
+   *
    * @param generator
    *          The JsonGenerator to direct output to. Cannot be null.
    * @throws IOException
@@ -184,8 +184,8 @@ public class JsonEncoder extends ParsingEncoder implements Parser.ActionHandler
   public void writeString(Utf8 utf8) throws IOException {
     writeString(utf8.toString());
   }
-  
-  @Override 
+
+  @Override
   public void writeString(String str) throws IOException {
     parser.advance(Symbol.STRING);
     if (parser.topSymbol() == Symbol.MAP_KEY_MARKER) {

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java
index db1790e..39e8aa3 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java
@@ -35,7 +35,7 @@ public abstract class ParsingDecoder extends Decoder
   }
 
   protected abstract void skipFixed() throws IOException;
-  
+
   @Override
   public void skipAction() throws IOException {
     parser.popSymbol();
@@ -72,6 +72,6 @@ public abstract class ParsingDecoder extends Decoder
       skipMap();
     }
   }
-  
+
 }
 

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java
index b6fe369..53a7833 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java
@@ -30,7 +30,7 @@ public abstract class ParsingEncoder extends Encoder {
    * the collections (array or map).
    */
   private long[] counts = new long[10];
-  
+
   protected int pos = -1;
 
   @Override
@@ -54,7 +54,7 @@ public abstract class ParsingEncoder extends Encoder {
     }
     counts[pos] = 0;
   }
-  
+
   protected final void pop() {
     if (counts[pos] != 0) {
       throw new AvroTypeException("Incorrect number of items written. " +
@@ -62,7 +62,7 @@ public abstract class ParsingEncoder extends Encoder {
     }
     pos--;
   }
-  
+
   protected final int depth() {
     return pos;
   }

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java
index 2d7eba2..02cad1f 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java
@@ -43,12 +43,12 @@ import org.apache.avro.util.Utf8;
 public class ResolvingDecoder extends ValidatingDecoder {
 
   private Decoder backup;
-  
+
   ResolvingDecoder(Schema writer, Schema reader, Decoder in)
     throws IOException {
     this(resolve(writer, reader), in);
   }
-  
+
   /**
    * Constructs a <tt>ResolvingDecoder</tt> using the given resolver.
    * The resolver must have been returned by a previous call to
@@ -68,7 +68,7 @@ public class ResolvingDecoder extends ValidatingDecoder {
    * returned Object is immutable and hence can be simultaneously used
    * in many ResolvingDecoders. This method is reasonably expensive, the
    * users are encouraged to cache the result.
-   * 
+   *
    * @param writer  The writer's schema. Cannot be null.
    * @param reader  The reader's schema. Cannot be null.
    * @return  The opaque reolver.
@@ -124,20 +124,20 @@ public class ResolvingDecoder extends ValidatingDecoder {
    * field values.)
    *
    * @throws AvroTypeException If we're not starting a new record
-   *                               
+   *
    */
   public final Schema.Field[] readFieldOrder() throws IOException {
     return ((Symbol.FieldOrderAction) parser.advance(Symbol.FIELD_ACTION)).
       fields;
   }
-  
+
   /**
    * Consume any more data that has been written by the writer but not
    * needed by the reader so that the the underlying decoder is in proper
    * shape for the next record. This situation happens when, for example,
    * the writer writes a record with two fields and the reader needs only the
    * first field.
-   * 
+   *
    * This function should be called after completely decoding an object but
    * before next object can be decoded from the same underlying decoder
    * either directly or through another resolving decoder. If the same resolving
@@ -175,7 +175,7 @@ public class ResolvingDecoder extends ValidatingDecoder {
       return (float) in.readFloat();
     }
   }
-  
+
   @Override
   public double readDouble() throws IOException {
     Symbol actual = parser.advance(Symbol.DOUBLE);
@@ -190,7 +190,7 @@ public class ResolvingDecoder extends ValidatingDecoder {
       return in.readDouble();
     }
   }
-  
+
   @Override
   public Utf8 readString(Utf8 old) throws IOException {
     Symbol actual = parser.advance(Symbol.STRING);
@@ -261,7 +261,7 @@ public class ResolvingDecoder extends ValidatingDecoder {
       throw new AvroTypeException((String) o);
     }
   }
-    
+
   @Override
   public int readIndex() throws IOException {
     parser.advance(Symbol.UNION);

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java
index ec4275c..3963dcf 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java
@@ -50,7 +50,7 @@ public class ValidatingDecoder extends ParsingDecoder
   ValidatingDecoder(Schema schema, Decoder in) throws IOException {
     this(getSymbol(schema), in);
   }
-  
+
   private static Symbol getSymbol(Schema schema) {
     if (null == schema) {
       throw new NullPointerException("Schema cannot be null");
@@ -70,7 +70,7 @@ public class ValidatingDecoder extends ParsingDecoder
     parser.advance(Symbol.NULL);
     in.readNull();
   }
-    
+
   @Override
   public boolean readBoolean() throws IOException {
     parser.advance(Symbol.BOOLEAN);
@@ -82,7 +82,7 @@ public class ValidatingDecoder extends ParsingDecoder
     parser.advance(Symbol.INT);
     return in.readInt();
   }
-    
+
   @Override
   public long readLong() throws IOException {
     parser.advance(Symbol.LONG);
@@ -100,7 +100,7 @@ public class ValidatingDecoder extends ParsingDecoder
     parser.advance(Symbol.DOUBLE);
     return in.readDouble();
   }
-    
+
   @Override
   public Utf8 readString(Utf8 old) throws IOException {
     parser.advance(Symbol.STRING);
@@ -140,7 +140,7 @@ public class ValidatingDecoder extends ParsingDecoder
         top.size + " but received " + size + " bytes.");
     }
   }
-    
+
   @Override
   public void readFixed(byte[] bytes, int start, int len) throws IOException {
     checkFixed(len);
@@ -201,7 +201,7 @@ public class ValidatingDecoder extends ParsingDecoder
         parser.skipRepeater();
       }
     }
-    parser.advance(Symbol.ARRAY_END);    
+    parser.advance(Symbol.ARRAY_END);
     return 0;
   }
 
@@ -245,7 +245,7 @@ public class ValidatingDecoder extends ParsingDecoder
     parser.pushSymbol(top.getSymbol(result));
     return result;
   }
-  
+
   @Override
   public Symbol doAction(Symbol input, Symbol top) throws IOException {
     return null;

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java
index 275df18..7d2777f 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java
@@ -39,7 +39,7 @@ import org.apache.avro.util.Utf8;
  * @see Encoder
  * @see EncoderFactory
  */
-public class ValidatingEncoder extends ParsingEncoder 
+public class ValidatingEncoder extends ParsingEncoder
   implements Parser.ActionHandler {
   protected Encoder out;
   protected final Parser parser;
@@ -70,7 +70,7 @@ public class ValidatingEncoder extends ParsingEncoder
     this.out = encoder;
     return this;
   }
-  
+
   @Override
   public void writeNull() throws IOException {
     parser.advance(Symbol.NULL);
@@ -112,13 +112,13 @@ public class ValidatingEncoder extends ParsingEncoder
     parser.advance(Symbol.STRING);
     out.writeString(utf8);
   }
-  
+
   @Override
   public void writeString(String str) throws IOException {
     parser.advance(Symbol.STRING);
     out.writeString(str);
   }
-  
+
   @Override
   public void writeString(CharSequence charSequence) throws IOException {
     parser.advance(Symbol.STRING);

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java
index 796de3e..867e514 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java
@@ -101,7 +101,7 @@ public class Parser {
       }
     }
   }
-  
+
   /**
    * Performs any implicit actions at the top the stack, expanding any
    * production (other than the root) that may be encountered.
@@ -124,12 +124,12 @@ public class Parser {
   }
 
   /**
-   * Performs any "trailing" implicit actions at the top the stack. 
+   * Performs any "trailing" implicit actions at the top the stack.
    */
   public final void processTrailingImplicitActions() throws IOException {
     while (pos >= 1) {
       Symbol top = stack[pos - 1];
-      if (top.kind == Symbol.Kind.IMPLICIT_ACTION 
+      if (top.kind == Symbol.Kind.IMPLICIT_ACTION
         && ((Symbol.ImplicitAction) top).isTrailing) {
         pos--;
         symbolHandler.doAction(null, top);
@@ -160,14 +160,14 @@ public class Parser {
   public Symbol popSymbol() {
     return stack[--pos];
   }
-  
+
   /**
    * Returns the top symbol from the stack.
    */
   public Symbol topSymbol() {
     return stack[pos - 1];
   }
-  
+
   /**
    * Pushes <tt>sym</tt> on to the stack.
    */
@@ -177,7 +177,7 @@ public class Parser {
     }
     stack[pos++] = sym;
   }
-  
+
   /**
    * Returns the depth of the stack.
    */

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java
index 31f38de..cc028cf 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java
@@ -39,29 +39,29 @@ import org.codehaus.jackson.JsonNode;
 public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
   /**
    * Resolves the writer schema <tt>writer</tt> and the reader schema
-   * <tt>reader</tt> and returns the start symbol for the grammar generated. 
+   * <tt>reader</tt> and returns the start symbol for the grammar generated.
    * @param writer    The schema used by the writer
    * @param reader    The schema used by the reader
    * @return          The start symbol for the resolving grammar
-   * @throws IOException 
+   * @throws IOException
    */
   public final Symbol generate(Schema writer, Schema reader)
     throws IOException {
     return Symbol.root(generate(writer, reader, new HashMap<LitS, Symbol>()));
   }
-  
+
   /**
    * Resolves the writer schema <tt>writer</tt> and the reader schema
    * <tt>reader</tt> and returns the start symbol for the grammar generated.
    * If there is already a symbol in the map <tt>seen</tt> for resolving the
    * two schemas, then that symbol is returned. Otherwise a new symbol is
-   * generated and returnd. 
+   * generated and returnd.
    * @param writer    The schema used by the writer
    * @param reader    The schema used by the reader
    * @param seen      The &lt;reader-schema, writer-schema&gt; to symbol
    * map of start symbols of resolving grammars so far.
    * @return          The start symbol for the resolving grammar
-   * @throws IOException 
+   * @throws IOException
    */
   public Symbol generate(Schema writer, Schema reader,
                                 Map<LitS, Symbol> seen) throws IOException
@@ -108,7 +108,7 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
                 generate(writer.getElementType(),
                 reader.getElementType(), seen)),
             Symbol.ARRAY_START);
-      
+
       case MAP:
         return Symbol.seq(Symbol.repeat(Symbol.MAP_END,
                 generate(writer.getValueType(),
@@ -125,7 +125,7 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
       if (writerType == Schema.Type.UNION) {
         return resolveUnion(writer, reader, seen);
       }
-  
+
       switch (readerType) {
       case LONG:
         switch (writerType) {
@@ -133,7 +133,7 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
           return Symbol.resolve(super.generate(writer, seen), Symbol.LONG);
         }
         break;
-  
+
       case FLOAT:
         switch (writerType) {
         case INT:
@@ -141,7 +141,7 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
           return Symbol.resolve(super.generate(writer, seen), Symbol.FLOAT);
         }
         break;
-  
+
       case DOUBLE:
         switch (writerType) {
         case INT:
@@ -150,21 +150,21 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
           return Symbol.resolve(super.generate(writer, seen), Symbol.DOUBLE);
         }
         break;
-  
+
       case BYTES:
         switch (writerType) {
         case STRING:
           return Symbol.resolve(super.generate(writer, seen), Symbol.BYTES);
         }
         break;
-  
+
       case STRING:
         switch (writerType) {
         case BYTES:
           return Symbol.resolve(super.generate(writer, seen), Symbol.STRING);
         }
         break;
-  
+
       case UNION:
         int j = bestBranch(reader, writer, seen);
         if (j >= 0) {
@@ -308,7 +308,7 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator {
     e.flush();
     return out.toByteArray();
   }
-  
+
   /**
    * Encodes the given Json node <tt>n</tt> on to the encoder <tt>e</tt>
    * according to the schema <tt>s</tt>.

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java
index 5afbe60..baf4e94 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java
@@ -39,7 +39,7 @@ public class SkipParser extends Parser {
      */
     void skipTopSymbol() throws IOException;
   }
-  
+
   private final SkipHandler skipHandler;
 
   public SkipParser(Symbol root, ActionHandler symbolHandler,

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java
index 80ae644..178aa0b 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java
@@ -60,7 +60,7 @@ public abstract class Symbol {
    * the symbols that forms the production for this symbol. The
    * sequence is in the reverse order of production. This is useful
    * for easy copying onto parsing stack.
-   * 
+   *
    * Please note that this is a final. So the production for a symbol
    * should be known before that symbol is constructed. This requirement
    * cannot be met for those symbols which are recursive (e.g. a record that
@@ -77,8 +77,8 @@ public abstract class Symbol {
   protected Symbol(Kind kind) {
     this(kind, null);
   }
-    
-    
+
+
   protected Symbol(Kind kind, Symbol[] production) {
     this.production = production;
     this.kind = kind;
@@ -120,7 +120,7 @@ public abstract class Symbol {
   static Symbol error(String e) {
     return new ErrorAction(e);
   }
-  
+
   /**
    * A convenience method to construct a ResolvingAction.
    * @param w The writer symbol
@@ -129,32 +129,32 @@ public abstract class Symbol {
   static Symbol resolve(Symbol w, Symbol r) {
     return new ResolvingAction(w, r);
   }
-  
+
   private static class Fixup {
     public final Symbol[] symbols;
     public final int pos;
-    
+
     public Fixup(Symbol[] symbols, int pos) {
       this.symbols = symbols;
       this.pos = pos;
     }
   }
-  
+
   public Symbol flatten(Map<Sequence, Sequence> map,
       Map<Sequence, List<Fixup>> map2) {
     return this;
   }
-  
+
   public int flattenedSize() {
     return 1;
   }
-  
+
   /**
    * Flattens the given sub-array of symbols into an sub-array of symbols. Every
    * <tt>Sequence</tt> in the input are replaced by its production recursively.
    * Non-<tt>Sequence</tt> symbols, they internally have other symbols
    * those internal symbols also get flattened.
-   * 
+   *
    * The algorithm does a few tricks to handle recursive symbol definitions.
    * In order to avoid infinite recursion with recursive symbols, we have a map
    * of Symbol->Symbol. Before fully constructing a flattened symbol for a
@@ -168,7 +168,7 @@ public abstract class Symbol {
    * has not not be fully constructed yet, we copy a bunch of <tt>null</tt>s.
    * Fix-up remembers all those <tt>null</tt> patches. The fix-ups gets finally
    * filled when we know the symbols to occupy those patches.
-   *  
+   *
    * @param in  The array of input symbols to flatten
    * @param start The position where the input sub-array starts.
    * @param out The output that receives the flattened list of symbols. The
@@ -246,7 +246,7 @@ public abstract class Symbol {
 
   public static class ImplicitAction extends Symbol {
     /**
-     * Set to <tt>true</tt> if and only if this implicit action is 
+     * Set to <tt>true</tt> if and only if this implicit action is
      * a trailing action. That is, it is an action that follows
      * real symbol. E.g {@link Symbol#DEFAULT_END_ACTION}.
      */
@@ -255,13 +255,13 @@ public abstract class Symbol {
     private ImplicitAction() {
       this(false);
     }
-    
+
     private ImplicitAction(boolean isTrailing) {
       super(Kind.IMPLICIT_ACTION);
       this.isTrailing = isTrailing;
     }
   }
-  
+
   protected static class Root extends Symbol {
     private Root(Symbol... symbols) {
       super(Kind.ROOT, makeProduction(symbols));
@@ -276,7 +276,7 @@ public abstract class Symbol {
       return result;
     }
   }
-  
+
   protected static class Sequence extends Symbol implements Iterable<Symbol> {
     private Sequence(Symbol[] productions) {
       super(Kind.SEQUENCE, productions);
@@ -285,19 +285,19 @@ public abstract class Symbol {
     public Symbol get(int index) {
       return production[index];
     }
-    
+
     public int size() {
       return production.length;
     }
-    
+
     public Iterator<Symbol> iterator() {
       return new Iterator<Symbol>() {
         private int pos = production.length;
-        
+
         public boolean hasNext() {
           return 0 < pos;
         }
-        
+
         public Symbol next() {
           if (0 < pos) {
             return production[--pos];
@@ -305,7 +305,7 @@ public abstract class Symbol {
             throw new NoSuchElementException();
           }
         }
-        
+
         public void remove() {
           throw new UnsupportedOperationException();
         }
@@ -320,7 +320,7 @@ public abstract class Symbol {
         map.put(this, result);
         List<Fixup> l = new ArrayList<Fixup>();
         map2.put(result, l);
-        
+
         flatten(production, 0,
             result.production, 0, map, map2);
         for (Fixup f : l) {
@@ -340,19 +340,19 @@ public abstract class Symbol {
 
   public static class Repeater extends Symbol {
     public final Symbol end;
-   
+
     private Repeater(Symbol end, Symbol... sequenceToRepeat) {
       super(Kind.REPEATER, makeProduction(sequenceToRepeat));
       this.end = end;
       production[0] = this;
     }
-    
+
     private static Symbol[] makeProduction(Symbol[] p) {
       Symbol[] result = new Symbol[p.length + 1];
       System.arraycopy(p, 0, result, 1, p.length);
       return result;
     }
-    
+
     @Override
     public Repeater flatten(Map<Sequence, Sequence> map,
         Map<Sequence, List<Fixup>> map2) {
@@ -363,9 +363,9 @@ public abstract class Symbol {
     }
 
   }
-  
+
   /**
-   * Returns true if the Parser contains any Error symbol, indicating that it may fail 
+   * Returns true if the Parser contains any Error symbol, indicating that it may fail
    * for some inputs.
    */
   public static boolean hasErrors(Symbol symbol) {
@@ -388,7 +388,7 @@ public abstract class Symbol {
       throw new RuntimeException("unknown symbol kind: " + symbol.kind);
     }
   }
-  
+
   private static boolean hasErrors(Symbol root, Symbol[] symbols) {
     if(null != symbols) {
       for(Symbol s: symbols) {
@@ -402,7 +402,7 @@ public abstract class Symbol {
     }
     return false;
   }
-    
+
   public static class Alternative extends Symbol {
     public final Symbol[] symbols;
     public final String[] labels;
@@ -411,15 +411,15 @@ public abstract class Symbol {
       this.symbols = symbols;
       this.labels = labels;
     }
-    
+
     public Symbol getSymbol(int index) {
       return symbols[index];
     }
-    
+
     public String getLabel(int index) {
       return labels[index];
     }
-    
+
     public int size() {
       return symbols.length;
     }
@@ -468,7 +468,7 @@ public abstract class Symbol {
   public static EnumAdjustAction enumAdjustAction(int rsymCount, Object[] adj) {
     return new EnumAdjustAction(rsymCount, adj);
   }
-  
+
   public static class EnumAdjustAction extends IntCheckAction {
     public final Object[] adjustments;
     @Deprecated public EnumAdjustAction(int rsymCount, Object[] adjustments) {
@@ -492,7 +492,7 @@ public abstract class Symbol {
       this.writer = writer;
       this.reader = reader;
     }
-    
+
     @Override
     public ResolvingAction flatten(Map<Sequence, Sequence> map,
         Map<Sequence, List<Fixup>> map2) {
@@ -501,7 +501,7 @@ public abstract class Symbol {
     }
 
   }
-  
+
   public static SkipAction skipAction(Symbol symToSkip) {
     return new SkipAction(symToSkip);
   }
@@ -512,7 +512,7 @@ public abstract class Symbol {
       super(true);
       this.symToSkip = symToSkip;
     }
-    
+
     @Override
     public SkipAction flatten(Map<Sequence, Sequence> map,
         Map<Sequence, List<Fixup>> map2) {
@@ -524,7 +524,7 @@ public abstract class Symbol {
   public static FieldAdjustAction fieldAdjustAction(int rindex, String fname) {
     return new FieldAdjustAction(rindex, fname);
   }
-  
+
   public static class FieldAdjustAction extends ImplicitAction {
     public final int rindex;
     public final String fname;
@@ -533,7 +533,7 @@ public abstract class Symbol {
       this.fname = fname;
     }
   }
-  
+
   public static FieldOrderAction fieldOrderAction(Schema.Field[] fields) {
     return new FieldOrderAction(fields);
   }
@@ -567,13 +567,13 @@ public abstract class Symbol {
       this.rindex = rindex;
       this.symToParse = symToParse;
     }
-    
+
     @Override
     public UnionAdjustAction flatten(Map<Sequence, Sequence> map,
         Map<Sequence, List<Fixup>> map2) {
       return new UnionAdjustAction(rindex, symToParse.flatten(map, map2));
     }
-    
+
   }
 
   /** For JSON. */
@@ -587,11 +587,11 @@ public abstract class Symbol {
       super(symbols.size());
       this.symbols = symbols;
     }
-    
+
     public String getLabel(int n) {
       return symbols.get(n);
     }
-    
+
     public int findLabel(String l) {
       if (l != null) {
         for (int i = 0; i < symbols.size(); i++) {
@@ -633,7 +633,7 @@ public abstract class Symbol {
   public static final Symbol RECORD_END = new ImplicitAction(true);
   public static final Symbol UNION_END = new ImplicitAction(true);
   public static final Symbol FIELD_END = new ImplicitAction(true);
-  
+
   public static final Symbol DEFAULT_END_ACTION = new ImplicitAction(true);
   public static final Symbol MAP_KEY_MARKER =
     new Symbol.Terminal("map-key-marker");

http://git-wip-us.apache.org/repos/asf/avro/blob/ade55151/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java
index 6bd1b26..962fc10 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java
@@ -101,7 +101,7 @@ public class ValidatingGrammarGenerator {
       List<Schema> subs = sc.getTypes();
       Symbol[] symbols = new Symbol[subs.size()];
       String[] labels = new String[subs.size()];
-      
+
       int i = 0;
       for (Schema b : sc.getTypes()) {
         symbols[i] = generate(b, seen);
@@ -119,7 +119,7 @@ public class ValidatingGrammarGenerator {
   static class LitS {
     public final Schema actual;
     public LitS(Schema actual) { this.actual = actual; }
-    
+
     /**
      * Two LitS are equal if and only if their underlying schema is
      * the same (not merely equal).
@@ -128,7 +128,7 @@ public class ValidatingGrammarGenerator {
       if (! (o instanceof LitS)) return false;
       return actual == ((LitS)o).actual;
     }
-    
+
     public int hashCode() {
       return actual.hashCode();
     }


Mime
View raw message