/** Called by the default implementation of {@link #readMap} to read a * key value. The default implementation returns delegates to * {@link #readString(Object, org.apache.avro.io.Decoder)}.*/ protected Object readMapKey(Object old, Schema expected, Decoder in) throws IOException{ return readString(old, expected, in); }
/** Called by the default implementation of {@link #readMap} to read a * key value. The default implementation returns delegates to * {@link #readString(Object, org.apache.avro.io.Decoder)}.*/ protected Object readMapKey(Object old, Schema expected, Decoder in) throws IOException{ return readString(old, expected, in); }
/** Called to read strings. Subclasses may override to use a different * string representation. By default, this calls {@link * #readString(Object,Decoder)}.*/ protected Object readString(Object old, Schema expected, Decoder in) throws IOException { Class stringClass = getStringClass(expected); if (stringClass == String.class) return in.readString(); 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 * #readString(Object,Decoder)}.*/ protected Object readString(Object old, Schema expected, Decoder in) throws IOException { Class stringClass = getStringClass(expected); if (stringClass == String.class) return in.readString(); if (stringClass == CharSequence.class) return readString(old, in); return newInstanceFromString(stringClass, in.readString()); }
protected Object readWithoutConversion(Object old, Schema expected, ResolvingDecoder in) throws IOException { switch (expected.getType()) { case RECORD: return readRecord(old, expected, in); case ENUM: return readEnum(expected, in); case ARRAY: return readArray(old, expected, in); case MAP: return readMap(old, expected, in); case UNION: return read(old, expected.getTypes().get(in.readIndex()), in); case FIXED: return readFixed(old, expected, in); case STRING: return readString(old, expected, in); case BYTES: return readBytes(old, expected, in); case INT: return readInt(old, expected, in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case BOOLEAN: return in.readBoolean(); case NULL: in.readNull(); return null; default: throw new AvroRuntimeException("Unknown type: " + expected); } }
protected Object readWithoutConversion(Object old, Schema expected, ResolvingDecoder in) throws IOException { switch (expected.getType()) { case RECORD: return readRecord(old, expected, in); case ENUM: return readEnum(expected, in); case ARRAY: return readArray(old, expected, in); case MAP: return readMap(old, expected, in); case UNION: return read(old, expected.getTypes().get(in.readIndex()), in); case FIXED: return readFixed(old, expected, in); case STRING: return readString(old, expected, in); case BYTES: return readBytes(old, expected, in); case INT: return readInt(old, expected, in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case BOOLEAN: return in.readBoolean(); case NULL: in.readNull(); return null; default: throw new AvroRuntimeException("Unknown type: " + expected); } }
/** Called by the default implementation of {@link #readMap} to read a * key value. The default implementation returns delegates to * {@link #readString(Object, org.apache.avro.io.Decoder)}.*/ protected Object readMapKey(Object old, Schema expected, Decoder in) throws IOException{ return readString(old, expected, in); }
/** Called to read strings. Subclasses may override to use a different * string representation. By default, this calls {@link * #readString(Object,Decoder)}.*/ protected Object readString(Object old, Schema expected, Decoder in) throws IOException { return readString(old, in); } /** Called to read strings. Subclasses may override to use a different
/** Called by the default implementation of {@link #readMap} to read a * key value. The default implementation returns delegates to * {@link #readString(Object, org.apache.avro.io.Decoder)}.*/ protected Object readMapKey(Object old, Schema expected, Decoder in) throws IOException{ return readString(old, expected, in); }
/** Called to read strings. Subclasses may override to use a different * string representation. By default, this calls {@link * #readString(Object,Decoder)}.*/ protected Object readString(Object old, Schema expected, Decoder in) throws IOException { return readString(old, in); } /** Called to read strings. Subclasses may override to use a different
@Override protected Object readString(Object old, Decoder in) throws IOException { // super.readString returns an Utf8 object. Calling toString() to turn it into a String. return super.readString(old, in).toString(); }
@Override protected Object readString(Object old, Decoder in) throws IOException { // super.readString returns an Utf8 object. Calling toString() to turn it into a String. return super.readString(old, in).toString(); }
/** Called to read strings. Subclasses may override to use a different * string representation. By default, this calls {@link * #readString(Object,Decoder)}.*/ protected Object readString(Object old, Schema expected, Decoder in) throws IOException { Class stringClass = getStringClass(expected); if (stringClass == String.class) return in.readString(); 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 * #readString(Object,Decoder)}.*/ protected Object readString(Object old, Schema expected, Decoder in) throws IOException { Class stringClass = getStringClass(expected); if (stringClass == String.class) return in.readString(); if (stringClass == CharSequence.class) return readString(old, in); return newInstanceFromString(stringClass, in.readString()); }
/** Called to read a map instance. May be overridden for alternate map * representations.*/ protected Object readMap(Object old, Schema expected, ResolvingDecoder in) throws IOException { Schema eValue = expected.getValueType(); long l = in.readMapStart(); Object map = newMap(old, (int) l); if (l > 0) { do { for (int i = 0; i < l; i++) { addToMap(map, readString(null, in), read(null, eValue, in)); } } while ((l = in.mapNext()) > 0); } return map; }
protected Object readWithoutConversion(Object old, Schema expected, ResolvingDecoder in) throws IOException { switch (expected.getType()) { case RECORD: return readRecord(old, expected, in); case ENUM: return readEnum(expected, in); case ARRAY: return readArray(old, expected, in); case MAP: return readMap(old, expected, in); case UNION: return read(old, expected.getTypes().get(in.readIndex()), in); case FIXED: return readFixed(old, expected, in); case STRING: return readString(old, expected, in); case BYTES: return readBytes(old, expected, in); case INT: return readInt(old, expected, in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case BOOLEAN: return in.readBoolean(); case NULL: in.readNull(); return null; default: throw new AvroRuntimeException("Unknown type: " + expected); } }
/** Called to read data.*/ protected Object read(Object old, Schema expected, ResolvingDecoder in) throws IOException { switch (expected.getType()) { case RECORD: return readRecord(old, expected, in); case ENUM: return readEnum(expected, in); case ARRAY: return readArray(old, expected, in); case MAP: return readMap(old, expected, in); case UNION: return read(old, expected.getTypes().get(in.readIndex()), in); case FIXED: return readFixed(old, expected, in); case STRING: return readString(old, expected, in); case BYTES: return readBytes(old, in); case INT: return readInt(old, expected, in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case BOOLEAN: return in.readBoolean(); case NULL: in.readNull(); return null; default: throw new AvroRuntimeException("Unknown type: " + expected); } }
/** Called to read data.*/ protected Object read(Object old, Schema expected, ResolvingDecoder in) throws IOException { switch (expected.getType()) { case RECORD: return readRecord(old, expected, in); case ENUM: return readEnum(expected, in); case ARRAY: return readArray(old, expected, in); case MAP: return readMap(old, expected, in); case UNION: return read(old, expected.getTypes().get(in.readIndex()), in); case FIXED: return readFixed(old, expected, in); case STRING: return readString(old, expected, in); case BYTES: return readBytes(old, expected, in); case INT: return readInt(old, expected, in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case BOOLEAN: return in.readBoolean(); case NULL: in.readNull(); return null; default: throw new AvroRuntimeException("Unknown type: " + expected); } }
/** Called to read a map instance. May be overridden for alternate map * representations.*/ protected Object readMap(Object old, Schema expected, ResolvingDecoder in) throws IOException { Schema eValue = expected.getValueType(); long l = in.readMapStart(); Object map = newMap(old, (int) l); if (l > 0) { do { for (int i = 0; i < l; i++) { addToMap(map, readString(null, in), read(null, eValue, in)); } } while ((l = in.mapNext()) > 0); } return map; }
/** Called to read data.*/ protected Object read(Object old, Schema expected, ResolvingDecoder in) throws IOException { switch (expected.getType()) { case RECORD: return readRecord(old, expected, in); case ENUM: return readEnum(expected, in); case ARRAY: return readArray(old, expected, in); case MAP: return readMap(old, expected, in); case UNION: return read(old, expected.getTypes().get(in.readIndex()), in); case FIXED: return readFixed(old, expected, in); case STRING: return readString(old, expected, in); case BYTES: return readBytes(old, in); case INT: return readInt(old, expected, in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case BOOLEAN: return in.readBoolean(); case NULL: in.readNull(); return null; default: throw new AvroRuntimeException("Unknown type: " + expected); } }