java.io.DataInput#readUTF ( )源码实例Demo

下面列出了java.io.DataInput#readUTF ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: coming   文件: Arja_0048_t.java
/**
 * 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");
    }
}
 
源代码2 项目: coming   文件: jKali_0040_s.java
/**
 * 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");
    }
}
 
源代码3 项目: flink-crawler   文件: SecondaryIndexMap.java
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;
    }
}
 
源代码4 项目: deep-spark   文件: AerospikeKey.java
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);
    }
}
 
源代码5 项目: coming   文件: JGenProg2017_00141_t.java
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);
}
 
源代码6 项目: mateplus   文件: WordEmbedding.java
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));
	}
}
 
@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;
}
 
源代码8 项目: flink   文件: HadoopInputSplitTest.java
@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();
	}
}
 
源代码9 项目: gemfirexd-oss   文件: VHDataSerializable.java
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);
  }
}
 
源代码10 项目: coming   文件: jMutRepair_0029_t.java
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);
}
 
源代码11 项目: coming   文件: Arja_00160_s.java
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);
}
 
源代码12 项目: lucene4ir   文件: WarcRecord.java
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();
}
 
@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());
}
 
源代码14 项目: sagetv   文件: TVEditorial.java
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);
}
 
源代码15 项目: waltz   文件: ReplicaId.java
/**
 * 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);
}
 
源代码16 项目: coming   文件: Nopol2017_0085_t.java
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);
}
 
源代码17 项目: Tomcat7.0.67   文件: ConstantUtf8.java
static ConstantUtf8 getInstance(DataInput input) throws IOException {
    return new ConstantUtf8(input.readUTF());
}
 
源代码18 项目: pravega   文件: WireCommands.java
public static WireCommand readFrom(DataInput in, int length) throws IOException {
    long requestId = in.readLong();
    String segment = in.readUTF();
    return new SegmentDeleted(requestId, segment);
}
 
源代码19 项目: suro   文件: Message.java
public void readFields(DataInput dataInput) throws IOException {
    routingKey = dataInput.readUTF();
    payload = new byte[dataInput.readInt()];
    dataInput.readFully(payload);
}
 
源代码20 项目: coming   文件: jMutRepair_0045_t.java
static Recurrence readFrom(DataInput in) throws IOException {
    return new Recurrence(OfYear.readFrom(in), in.readUTF(), (int)readMillis(in));
}