@Override public byte readByte(String tag) throws IOException { return (byte) readLong(tag); }
@Override public float readFloat(String tag) throws IOException { return (float) readDouble(tag); }
@Override public boolean readBool(String tag) throws IOException { String sval = readField(tag); return "T".equals(sval) ? true : false; }
@Override public WEntry<Integer, Long> deserialiseCsvRecord( CsvRecordInput record) throws IOException { String statName = record.readString(null) ; Long v = record.readLong(null) ; Integer k = null; try { k = StatisticName.valueOf(statName).ordinal() ; } catch (Exception e) { Logger.getLogger(WDatabaseFactory.class).warn("Ignoring unknown statistic: " + statName) ; return null ; } return new WEntry<Integer, Long>(k,v) ; }
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; }
CsvRecordInput cri = new CsvRecordInput(new ByteArrayInputStream(line.getBytes("UTF8"))) ; currKeys[pass] = cri.readString(null) ; currValues[pass] = new DbLabel() ; currValues[pass].deserialize(cri) ; CsvRecordInput cri = new CsvRecordInput(new ByteArrayInputStream(line.getBytes("UTF8"))) ; currKeys[pass] = cri.readString(null) ; currValues[pass] = new DbLabel() ; currValues[pass].deserialize(cri) ;
@Override public KBEntry<String,DbLabel> deserialiseCsvRecord(CsvRecordInput record) throws IOException { String text = record.readString(null); DbLabel l = new DbLabel(); l.deserialize(record); return new KBEntry<String,DbLabel>(text, l); }
@Override public KBEntry<Integer, Long> deserialiseCsvRecord(CsvRecordInput record) throws IOException { String statName = record.readString(null); Long v = record.readLong(null); Integer k = null; try { k = StatisticName.valueOf(statName).ordinal(); } catch (Exception e) { LOGGER.warn("Ignoring unknown statistic: " + statName); return null; } return new KBEntry<>(k,v); } };
CsvRecordInput cri = new CsvRecordInput(new ByteArrayInputStream((line + "\n").getBytes("UTF-8"))); try { KBEntry<Integer,Record> entry = deserialiseCsvRecord(cri);
@Override public WEntry<String,DbLabel> deserialiseCsvRecord(CsvRecordInput record) throws IOException { String text = record.readString(null) ; DbLabel l = new DbLabel() ; l.deserialize(record) ; return new WEntry<String,DbLabel>(text, l) ; }
@Override public boolean readBool(String tag) throws IOException { String sval = readField(tag); return "T".equals(sval) ? true : false; }
@Override public int readInt(String tag) throws IOException { return (int) readLong(tag); }
@Override public float readFloat(String tag) throws IOException { return (float) readDouble(tag); }
CsvRecordInput cri = new CsvRecordInput(new ByteArrayInputStream((line + "\n").getBytes("UTF-8"))); KBEntry<Integer,Integer> entry = deserialiseCsvRecord(cri); if (entry != null) {
@Override public WEntry<Integer, DbIntList> deserialiseCsvRecord(CsvRecordInput record) throws IOException { Integer k = record.readInt(null) ; DbIntList v = new DbIntList() ; v.deserialize(record) ; return new WEntry<Integer, DbIntList>(k,v) ; }
public boolean readBool(String tag) throws IOException { String sval = readField(tag); return "T".equals(sval) ? true : false; }
@Override public int readInt(String tag) throws IOException { return (int) readLong(tag); }
@Override public float readFloat(String tag) throws IOException { return (float) readDouble(tag); }