List of usage examples for java.io DataInput readFully
void readFully(byte b[]) throws IOException;
From source file:org.kalypso.shape.dbf.DBFField.java
@Override public Object readValue(final DataInput input, final Charset charset) throws IOException, DBaseException { final byte[] value = new byte[m_fieldLength]; input.readFully(value); final String asString = new String(value, charset).trim(); return m_formatter.fromString(asString); }
From source file:org.kalypso.shape.dbf.DBFField.java
public static IDBFField read(final DataInput input, final Charset charset) throws IOException, DBaseException { final byte[] columnNameBytes = new byte[MAX_COLUMN_NAME_LENGTH]; input.readFully(columnNameBytes); final int columNameLength = findColumnNameLength(columnNameBytes); final String columnName = new String(columnNameBytes, 0, columNameLength, charset); final char columnType = (char) input.readByte(); input.skipBytes(4);//w w w . j a v a 2 s . c om // get field length and precision final short fieldLength = DataUtils.fixByte(input.readByte()); final short decimalCount = DataUtils.fixByte(input.readByte()); input.skipBytes(14); final FieldType fieldType = FieldType.valueOf("" + columnType); return new DBFField(columnName, fieldType, fieldLength, decimalCount); }
From source file:org.kiji.schema.mapreduce.KijiDelete.java
/** {@inheritDoc} */ @Override//from ww w . j a v a 2 s. co m public void readFields(DataInput in) throws IOException { // EntityId. final byte[] bytes = new byte[in.readInt()]; in.readFully(bytes); mEntityId = new HBaseEntityId(bytes); // Family/Qualifier/Timestamp. mFamily = (String) readOptionalValue(in, String.class); mQualifier = (String) readOptionalValue(in, String.class); mTimestamp = (Long) readOptionalValue(in, Long.class); mOperation = (KijiDeleteOperation) readOptionalValue(in, KijiDeleteOperation.class); }
From source file:org.kiji.schema.mapreduce.KijiIncrement.java
/** {@inheritDoc} */ @Override/* ww w. j a va 2s. c o m*/ public void readFields(DataInput in) throws IOException { // EntityId. final byte[] bytes = new byte[in.readInt()]; in.readFully(bytes); mEntityId = new RawEntityId(bytes); // Family/Qualifier/Timestamp. mFamily = in.readUTF(); mQualifier = in.readUTF(); mAmount = in.readLong(); }
From source file:org.kiji.schema.mapreduce.KijiPut.java
/** {@inheritDoc} */ @Override/*from w w w. j a v a 2 s . co m*/ public void readFields(DataInput in) throws IOException { // EntityId. final byte[] bytes = new byte[in.readInt()]; in.readFully(bytes); mEntityId = new HBaseEntityId(bytes); // Family/Qualifier/Timestamp. mFamily = in.readUTF(); mQualifier = in.readUTF(); mTimestamp = in.readLong(); // Avro. final Schema schema = new Schema.Parser().parse(in.readUTF()); final KijiCellDecoderFactory decoderFactory = new SpecificCellDecoderFactory(null); final KijiCellDecoder<?> decoder = decoderFactory.create(schema, KijiCellFormat.NONE); final byte[] cellData = new byte[in.readInt()]; in.readFully(cellData); mCell = decoder.decode(cellData, null); }
From source file:org.lealone.cluster.utils.ByteBufferUtil.java
public static ByteBuffer read(DataInput in, int length) throws IOException { if (length == 0) return EMPTY_BYTE_BUFFER; byte[] buff = new byte[length]; in.readFully(buff); return ByteBuffer.wrap(buff); }
From source file:org.lwes.MapEvent.java
@Override public void deserialize(DataInput stream, int length) throws IOException, EventSystemException { final byte[] bytes = new byte[length]; stream.readFully(bytes); deserialize(bytes);/*ww w. ja v a2 s . com*/ }
From source file:org.mrgeo.utils.StringUtils.java
public static String read(DataInput in) throws IOException { int len = in.readInt(); if (len == -1) { return null; } else {//w w w .jav a 2 s . c o m byte[] data = new byte[len]; in.readFully(data); return new String(data, "UTF-8"); } }
From source file:uk.bl.wa.hadoop.indexer.WritableSolrRecord.java
@Override public void readFields(DataInput input) throws IOException { int length = input.readInt(); byte[] bytes = new byte[length]; input.readFully(bytes); if (this.sr == null) { this.sr = SolrRecordFactory.createFactory(null).createRecord(); }/*ww w. j a v a2 s.co m*/ this.sr.setSolrDocument((SolrInputDocument) SerializationUtils.deserialize(bytes)); }