List of usage examples for java.io DataInput readFully
void readFully(byte b[], int off, int len) throws IOException;
From source file:org.lilyproject.repository.impl.id.AbsoluteRecordIdImpl.java
public static AbsoluteRecordId fromBytes(byte[] bytes, IdGenerator idGenerator) { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); DataInput dataInput = new DataInputStream(byteArrayInputStream); byte[] tableBytes; byte[] recordIdBytes; try {/*from w w w .j a va2s. co m*/ tableBytes = new byte[dataInput.readInt()]; dataInput.readFully(tableBytes, 0, tableBytes.length); recordIdBytes = new byte[dataInput.readInt()]; dataInput.readFully(recordIdBytes, 0, recordIdBytes.length); } catch (IOException ioe) { throw new RuntimeException("Error while deserializing AbsoluteRecordId", ioe); } return new AbsoluteRecordIdImpl(new String(tableBytes), idGenerator.fromBytes(recordIdBytes)); }
From source file:org.lwes.ArrayEvent.java
@Override public void deserialize(DataInput stream, int length) throws IOException { this.length = length; stream.readFully(bytes, 0, length); resetCaches();/*from w w w . j a v a 2 s .c o m*/ }
From source file:StorageEngineClient.MultiFormatStorageSplit.java
@Override public void readFields(DataInput in) throws IOException { len = in.readInt();/*from w w w . jav a 2 s .co m*/ if (path == null) { path = new Path[(int) len]; } for (int i = 0; i < len; i++) { short strLen = in.readShort(); if (strLen > 0) { byte[] buf = new byte[strLen]; in.readFully(buf, 0, strLen); String string = new String(buf); path[i] = new Path(string); } } }
From source file:wikiduper.wikipedia.WikipediaPage.java
/** * Serializes this object./*from ww w.j av a 2 s . c o m*/ */ public void readFields(DataInput in) throws IOException { int length = WritableUtils.readVInt(in); byte[] bytes = new byte[length]; in.readFully(bytes, 0, length); WikipediaPage.readPage(this, new String(bytes, "UTF-8")); language = in.readUTF(); }