/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
records[idx].serialize(rout); records[idx].serialize(rout); records[idx].deserialize(rin); records[idx].write(dout); records[idx].readFields(din);
private static void runCsvBench(String type, int numRecords, Times times) throws IOException { Record[] records = makeArray(type, numRecords, times); ByteArrayOutputStream bout = new ByteArrayOutputStream(); CsvRecordOutput rout = new CsvRecordOutput(bout); for(int idx = 0; idx < numRecords; idx++) { records[idx].serialize(rout); } bout.reset(); times.serialize = System.nanoTime(); for(int idx = 0; idx < numRecords; idx++) { records[idx].serialize(rout); } times.serialize = System.nanoTime() - times.serialize; byte[] serialized = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(serialized); CsvRecordInput rin = new CsvRecordInput(bin); times.deserialize = System.nanoTime(); for(int idx = 0; idx < numRecords; idx++) { records[idx].deserialize(rin); } times.deserialize = System.nanoTime() - times.deserialize; }
records[idx].serialize(rout); records[idx].serialize(rout); XmlRecordInput rin = new XmlRecordInput(bin); for(int idx = 0; idx < numRecords; idx++) { records[idx].deserialize(rin);
/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
/** * Serialize a record without a tag * @param rout Record output destination */ public void serialize(RecordOutput rout) throws IOException { this.serialize(rout, ""); }
/** * Deserialize a record without a tag * @param rin Record input source */ public void deserialize(RecordInput rin) throws IOException { this.deserialize(rin, ""); }
public String toString() { try { ByteArrayOutputStream s = new ByteArrayOutputStream(); CsvRecordOutput a = new CsvRecordOutput(s); this.serialize(a); return new String(s.toByteArray(), "UTF-8"); } catch (Throwable ex) { throw new RuntimeException(ex); } } }
@Override public void readFields(final DataInput din) throws java.io.IOException { BinaryRecordInput rin = BinaryRecordInput.get(din); this.deserialize(rin); }
@Override public void write(final DataOutput out) throws java.io.IOException { BinaryRecordOutput bout = BinaryRecordOutput.get(out); this.serialize(bout); }