Java Code Examples for java.io.DataInput#readUTF()
The following examples show how to use
java.io.DataInput#readUTF() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Arja_0048_t.java From coming with MIT License | 6 votes |
/** * Decodes a built DateTimeZone from the given stream, as encoded by * writeTo. * * @param in input stream to read encoded DateTimeZone from. * @param id time zone id to assign */ public static DateTimeZone readFrom(DataInput in, String id) throws IOException { switch (in.readUnsignedByte()) { case 'F': DateTimeZone fixed = new FixedDateTimeZone (id, in.readUTF(), (int)readMillis(in), (int)readMillis(in)); if (fixed.equals(DateTimeZone.UTC)) { fixed = DateTimeZone.UTC; } return fixed; case 'C': return CachedDateTimeZone.forZone(PrecalculatedZone.readFrom(in, id)); case 'P': return PrecalculatedZone.readFrom(in, id); default: throw new IOException("Invalid encoding"); } }
Example 2
Source File: AerospikeKey.java From deep-spark with Apache License 2.0 | 6 votes |
public void readFields(DataInput in) throws IOException { try { namespace = in.readUTF(); setName = in.readUTF(); int digestLen = in.readInt(); digest = new byte[digestLen]; in.readFully(digest); if (in.readBoolean()) { int buflen = in.readInt(); byte[] buff = new byte[buflen]; in.readFully(buff); ObjectUnpacker unpack = new ObjectUnpacker(buff, 0, buff.length); userKey = Value.get(unpack.unpackObject()); } } catch (Exception ex) { throw new IOException(ex); } }
Example 3
Source File: SecondaryIndexMap.java From flink-crawler with Apache License 2.0 | 6 votes |
public void read(DataInput in) throws IOException { int version = in.readInt(); if (version != SERIALIZED_VERSION) { throw new IOException(String.format("Invalid version, expected %d, got %d", SERIALIZED_VERSION, version)); } int numEntries = in.readInt(); _secondaryIndexUrls = new String[numEntries]; _secondaryIndex = new SecondaryIndex[numEntries]; for (int i = 0; i < numEntries; i++) { _secondaryIndexUrls[i] = in.readUTF(); } for (int i = 0; i < numEntries; i++) { SecondaryIndex si = new SecondaryIndex(); si.read(in); _secondaryIndex[i] = si; } }
Example 4
Source File: jKali_0040_s.java From coming with MIT License | 6 votes |
/** * Decodes a built DateTimeZone from the given stream, as encoded by * writeTo. * * @param in input stream to read encoded DateTimeZone from. * @param id time zone id to assign */ public static DateTimeZone readFrom(DataInput in, String id) throws IOException { switch (in.readUnsignedByte()) { case 'F': DateTimeZone fixed = new FixedDateTimeZone (id, in.readUTF(), (int)readMillis(in), (int)readMillis(in)); if (fixed.equals(DateTimeZone.UTC)) { fixed = DateTimeZone.UTC; } return fixed; case 'C': return CachedDateTimeZone.forZone(PrecalculatedZone.readFrom(in, id)); case 'P': return PrecalculatedZone.readFrom(in, id); default: throw new IOException("Invalid encoding"); } }
Example 5
Source File: TradeTxHistoryHdfsDataVerifier.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { oid=in.readInt(); cid= in.readInt(); sid = in.readInt(); tid=in.readInt(); qty=in.readInt(); type=in.readUTF(); price=new BigDecimal(in.readUTF()); orderTime=new Timestamp(in.readLong()); type=type.equals(" ")?null:type; orderTime=orderTime.equals(new Timestamp(1000))?null:orderTime; }
Example 6
Source File: HadoopInputSplitTest.java From flink with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { file = new Path(in.readUTF()); start = in.readLong(); length = in.readLong(); int size = in.readInt(); hosts = new String[size]; for (int i = 0; i < size; i++) { hosts[i] = in.readUTF(); } }
Example 7
Source File: VHDataSerializable.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static void myFromData(BaseValueHolder vh, DataInput in) throws IOException { vh.myVersion = in.readUTF(); vh.myValue = readObject(in); vh.extraObject = readObject(in); // read modVal String aStr = in.readUTF(); if (aStr.equals("null")) { vh.modVal = null; } else { vh.modVal = Integer.valueOf(aStr); } }
Example 8
Source File: jMutRepair_0029_t.java From coming with MIT License | 5 votes |
static PrecalculatedZone readFrom(DataInput in, String id) throws IOException { // Read string pool. int poolSize = in.readUnsignedShort(); String[] pool = new String[poolSize]; for (int i=0; i<poolSize; i++) { pool[i] = in.readUTF(); } int size = in.readInt(); long[] transitions = new long[size]; int[] wallOffsets = new int[size]; int[] standardOffsets = new int[size]; String[] nameKeys = new String[size]; for (int i=0; i<size; i++) { transitions[i] = readMillis(in); wallOffsets[i] = (int)readMillis(in); standardOffsets[i] = (int)readMillis(in); try { int index; if (poolSize < 256) { index = in.readUnsignedByte(); } else { index = in.readUnsignedShort(); } nameKeys[i] = pool[index]; } catch (ArrayIndexOutOfBoundsException e) { throw new IOException("Invalid encoding"); } } DSTZone tailZone = null; if (in.readBoolean()) { tailZone = DSTZone.readFrom(in, id); } return new PrecalculatedZone (id, transitions, wallOffsets, standardOffsets, nameKeys, tailZone); }
Example 9
Source File: Arja_00160_s.java From coming with MIT License | 5 votes |
static PrecalculatedZone readFrom(DataInput in, String id) throws IOException { // Read string pool. int poolSize = in.readUnsignedShort(); String[] pool = new String[poolSize]; for (int i=0; i<poolSize; i++) { pool[i] = in.readUTF(); } int size = in.readInt(); long[] transitions = new long[size]; int[] wallOffsets = new int[size]; int[] standardOffsets = new int[size]; String[] nameKeys = new String[size]; for (int i=0; i<size; i++) { transitions[i] = readMillis(in); wallOffsets[i] = (int)readMillis(in); standardOffsets[i] = (int)readMillis(in); try { int index; if (poolSize < 256) { index = in.readUnsignedByte(); } else { index = in.readUnsignedShort(); } nameKeys[i] = pool[index]; } catch (ArrayIndexOutOfBoundsException e) { throw new IOException("Invalid encoding"); } } DSTZone tailZone = null; if (in.readBoolean()) { tailZone = DSTZone.readFrom(in, id); } return new PrecalculatedZone (id, transitions, wallOffsets, standardOffsets, nameKeys, tailZone); }
Example 10
Source File: WarcRecord.java From lucene4ir with Apache License 2.0 | 5 votes |
public void readFields(DataInput in) throws IOException { contentType=in.readUTF(); UUID=in.readUTF(); dateString=in.readUTF(); recordType=in.readUTF(); metadata.clear(); int numMetaItems=in.readInt(); for (int i=0; i < numMetaItems; i++) { String thisKey=in.readUTF(); String thisValue=in.readUTF(); metadata.put(thisKey, thisValue); } contentLength=in.readInt(); }
Example 11
Source File: TradeNetworthHdfsDataVerifierV2.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { cid = in.readInt(); tid=in.readInt(); cash=new BigDecimal(in.readUTF()); securities=new BigDecimal(in.readUTF()); loanLimit=in.readInt(); availLoan=new BigDecimal(in.readUTF()); }
Example 12
Source File: TVEditorial.java From sagetv with Apache License 2.0 | 5 votes |
TVEditorial(DataInput in, byte ver, Map<Integer, Integer> idMap) throws IOException { super(in, ver, idMap); showID = readID(in, idMap); title = Wizard.getInstance().getTitleForID(readID(in, idMap)); network = Wizard.getInstance().getNetworkForID(readID(in, idMap)); airdate = in.readUTF(); description = in.readUTF(); imageURL = in.readUTF(); setMediaMask(MEDIA_MASK_TV); }
Example 13
Source File: WordEmbedding.java From mateplus with GNU General Public License v2.0 | 5 votes |
private void read(DataInput input) throws IOException { String foo = input.readUTF(); if (!foo.equals(MAGIC_STRING)) throw new Error( "Error reading word embedding. Magic string not found."); int entries = input.readInt(); for (int i = 0; i < entries; ++i) { String str = input.readUTF(); double[] entry = new double[DEF_DIMENSIONALITY]; for (int j = 0; j < entry.length; j++) entry[j] = input.readDouble(); map.put(str, new EmbeddingEntry(entry)); } }
Example 14
Source File: ReplicaId.java From waltz with Apache License 2.0 | 5 votes |
/** * Reads replica Id metadata via the {@link DataInput} provided. * @param in The interface that reads bytes from a binary stream and converts it * to the data of required type. * @return Returns the {@code ReplicaId}. * @throws IOException thrown if the read fails. */ public static ReplicaId readFrom(DataInput in) throws IOException { byte version = in.readByte(); if (version != VERSION) { throw new IOException("unsupported version"); } int partitionId = in.readInt(); String storageNodeConnectString = in.readUTF(); return new ReplicaId(partitionId, storageNodeConnectString); }
Example 15
Source File: JGenProg2017_00141_t.java From coming with MIT License | 5 votes |
static PrecalculatedZone readFrom(DataInput in, String id) throws IOException { // Read string pool. int poolSize = in.readUnsignedShort(); String[] pool = new String[poolSize]; for (int i=0; i<poolSize; i++) { pool[i] = in.readUTF(); } int size = in.readInt(); long[] transitions = new long[size]; int[] wallOffsets = new int[size]; int[] standardOffsets = new int[size]; String[] nameKeys = new String[size]; for (int i=0; i<size; i++) { transitions[i] = readMillis(in); wallOffsets[i] = (int)readMillis(in); standardOffsets[i] = (int)readMillis(in); try { int index; if (poolSize < 256) { index = in.readUnsignedByte(); } else { index = in.readUnsignedShort(); } nameKeys[i] = pool[index]; } catch (ArrayIndexOutOfBoundsException e) { throw new IOException("Invalid encoding"); } } DSTZone tailZone = null; if (in.readBoolean()) { tailZone = DSTZone.readFrom(in, id); } return new PrecalculatedZone (id, transitions, wallOffsets, standardOffsets, nameKeys, tailZone); }
Example 16
Source File: Nopol2017_0085_t.java From coming with MIT License | 5 votes |
static PrecalculatedZone readFrom(DataInput in, String id) throws IOException { // Read string pool. int poolSize = in.readUnsignedShort(); String[] pool = new String[poolSize]; for (int i=0; i<poolSize; i++) { pool[i] = in.readUTF(); } int size = in.readInt(); long[] transitions = new long[size]; int[] wallOffsets = new int[size]; int[] standardOffsets = new int[size]; String[] nameKeys = new String[size]; for (int i=0; i<size; i++) { transitions[i] = readMillis(in); wallOffsets[i] = (int)readMillis(in); standardOffsets[i] = (int)readMillis(in); try { int index; if (poolSize < 256) { index = in.readUnsignedByte(); } else { index = in.readUnsignedShort(); } nameKeys[i] = pool[index]; } catch (ArrayIndexOutOfBoundsException e) { throw new IOException("Invalid encoding"); } } DSTZone tailZone = null; if (in.readBoolean()) { tailZone = DSTZone.readFrom(in, id); } return new PrecalculatedZone (id, transitions, wallOffsets, standardOffsets, nameKeys, tailZone); }
Example 17
Source File: ConstantUtf8.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
static ConstantUtf8 getInstance(DataInput input) throws IOException { return new ConstantUtf8(input.readUTF()); }
Example 18
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(DataInput in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); return new SegmentDeleted(requestId, segment); }
Example 19
Source File: Message.java From suro with Apache License 2.0 | 4 votes |
public void readFields(DataInput dataInput) throws IOException { routingKey = dataInput.readUTF(); payload = new byte[dataInput.readInt()]; dataInput.readFully(payload); }
Example 20
Source File: jMutRepair_0045_t.java From coming with MIT License | 4 votes |
static Recurrence readFrom(DataInput in) throws IOException { return new Recurrence(OfYear.readFrom(in), in.readUTF(), (int)readMillis(in)); }