/** * Get a thread-local typed bytes writable output for the supplied * {@link DataOutput}. * * @param out * data output object * @return typed bytes writable output corresponding to the supplied * {@link DataOutput}. */ public static TypedBytesWritableOutput get(DataOutput out) { return get(TypedBytesOutput.get(out)); }
/** * Get a thread-local typed bytes record input for the supplied * {@link DataInput}. * * @param in * data input object * @return typed bytes record input corresponding to the supplied * {@link DataInput}. */ public static TypedBytesRecordInput get(DataInput in) { return get(TypedBytesInput.get(in)); }
/** * Get a thread-local typed bytes record output for the supplied * {@link DataOutput}. * * @param out * data output object * @return typed bytes record output corresponding to the supplied * {@link DataOutput}. */ public static TypedBytesRecordOutput get(DataOutput out) { return get(TypedBytesOutput.get(out)); }
/** * Get a thread-local typed bytes writable input for the supplied * {@link DataInput}. * * @param in * data input object * @return typed bytes writable input corresponding to the supplied * {@link DataInput}. */ public static TypedBytesWritableInput get(DataInput in) { return get(TypedBytesInput.get(in)); }
public String readString(String tag) throws IOException { in.skipType(); return in.readString(); }
public void writeArray(ArrayWritable aw) throws IOException { Writable[] writables = aw.get(); out.writeVectorHeader(writables.length); for (Writable writable : writables) { write(writable); } }
public MapWritable readMap(MapWritable mw) throws IOException { if (mw == null) { mw = new MapWritable(); } int length = in.readMapHeader(); for (int i = 0; i < length; i++) { Writable key = read(); Writable value = read(); mw.put(key, value); } return mw; }
public static Type getType(int code) { for (Type type : Type.values()) { if (type.code == code) { return type; } } return null; } }
@Override protected Object initialValue() { return new TypedBytesInput(); } };
@Override protected Object initialValue() { return new TypedBytesWritableInput(); } };
@Override protected Object initialValue() { return new TypedBytesWritableOutput(); } };
@Override protected Object initialValue() { return new TypedBytesOutput(); } };
@Override protected Object initialValue() { return new TypedBytesRecordInput(); } };
/** * Writes a bytes array as a typed bytes sequence. * * @param bytes * the bytes array to be written * @throws IOException */ public void writeBytes(byte[] bytes) throws IOException { writeBytes(bytes, Type.BYTES.code); }
@Override protected Object initialValue() { return new TypedBytesRecordOutput(); } };