當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectInputStream.readShort方法代碼示例

本文整理匯總了Java中java.io.ObjectInputStream.readShort方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectInputStream.readShort方法的具體用法?Java ObjectInputStream.readShort怎麽用?Java ObjectInputStream.readShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.ObjectInputStream的用法示例。


在下文中一共展示了ObjectInputStream.readShort方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doReps

import java.io.ObjectInputStream; //導入方法依賴的package包/類
/**
 * Run benchmark for given number of batches, with given number of cycles
 * for each batch.
 */
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
            StreamBuffer sbuf, int nbatches, int ncycles)
    throws Exception
{
    for (int i = 0; i < nbatches; i++) {
        sbuf.reset();
        for (int j = 0; j < ncycles; j++) {
            oout.writeShort(0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readShort();
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:Shorts.java

示例2: readObject

import java.io.ObjectInputStream; //導入方法依賴的package包/類
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:CustomObjTrees.java

示例3: readObject

import java.io.ObjectInputStream; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
/** Custom serialization */
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
    this.file = MappedArrayConstructor.randomFile(true);
    this.length = is.readInt();
    this.defaultValueAsLong = is.readLong();
    this.defaultZoneId = is.readShort();
    this.defaultValue = (ZonedDateTime)is.readObject();
    this.channel = new RandomAccessFile(file, "rw").getChannel();
    this.byteBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, BYTE_COUNT * length);
    for (int i=0; i<length; ++i) {
        final int byteIndex = i * BYTE_COUNT;
        final long epochMillis = is.readLong();
        final short zoneId = is.readShort();
        this.byteBuffer.putLong(byteIndex, epochMillis);
        this.byteBuffer.putShort(byteIndex + 8, zoneId);
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:19,代碼來源:MappedArrayOfZonedDateTimes.java

示例4: readObject

import java.io.ObjectInputStream; //導入方法依賴的package包/類
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    short version = ois.readShort();
    switch(version) {
        case 1:
            this.updateLocalVarsFromCpdsProp();
            this.setUpPropertyEvents();
            return;
        default:
            throw new IOException("Unsupported Serialized Version: " + version);
    }
}
 
開發者ID:tomoncle,項目名稱:JavaStudy,代碼行數:12,代碼來源:MineC3P0DataSource.java

示例5: deserialize

import java.io.ObjectInputStream; //導入方法依賴的package包/類
/**
 * See {@link GraphDBState#deserialize(String)}.
 */
public void deserialize(ObjectInputStream objectInputStream) throws IOException,
    ClassNotFoundException {
    size = objectInputStream.readInt();
    neighbourIds = new int[objectInputStream.readInt()];
    edgeTypes = new short[objectInputStream.readInt()];
    edgeIds = new long[objectInputStream.readInt()];
    for (int i = 0; i < size; i++) {
        neighbourIds[i] = objectInputStream.readInt();
        edgeTypes[i] = objectInputStream.readShort();
        edgeIds[i] = objectInputStream.readLong();
    }
}
 
開發者ID:graphflow,項目名稱:graphflow,代碼行數:16,代碼來源:SortedAdjacencyList.java

示例6: read

import java.io.ObjectInputStream; //導入方法依賴的package包/類
@Override
public final void read(ObjectInputStream is, int count) throws IOException {
    for (int i=0; i<count; ++i) {
        final long value = is.readLong();
        this.values.put(i, value);
        if (value != defaultValueAsLong) {
            final short zoneId = is.readShort();
            this.zoneIds.put(i, zoneId);
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:12,代碼來源:SparseArrayOfZonedDateTimes.java

示例7: read

import java.io.ObjectInputStream; //導入方法依賴的package包/類
@Override
public final void read(ObjectInputStream is, int count) throws IOException {
    for (int i=0; i<count; ++i) {
        final int byteIndex = i * BYTE_COUNT;
        final long epochMillis = is.readLong();
        final short zoneId = is.readShort();
        this.byteBuffer.putLong(byteIndex, epochMillis);
        this.byteBuffer.putShort(byteIndex + 8, zoneId);
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:11,代碼來源:MappedArrayOfZonedDateTimes.java

示例8: read

import java.io.ObjectInputStream; //導入方法依賴的package包/類
@Override
public final void read(ObjectInputStream is, int count) throws IOException {
    for (int i=0; i<count; ++i) {
        final long value = is.readLong();
        this.values[i] = value;
        if (value != defaultValueAsLong) {
            this.zoneIds[i] = is.readShort();
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:11,代碼來源:DenseArrayOfZonedDateTimes.java

示例9: readObject

import java.io.ObjectInputStream; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
/** Custom serialization */
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
    final int length = is.readInt();
    this.values = new long[length];
    this.zoneIds = new short[length];
    this.defaultValueAsLong = is.readLong();
    this.defaultValue = (ZonedDateTime)is.readObject();
    for (int i=0; i<length; ++i) {
        values[i] = is.readLong();
        zoneIds[i] = is.readShort();
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:14,代碼來源:DenseArrayOfZonedDateTimes.java

示例10: readObject

import java.io.ObjectInputStream; //導入方法依賴的package包/類
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    short version = ois.readShort();
    switch (version) {
        case 2:
            return;
        default:
            throw new IOException("Unsupported Serialized Version: " + version);
    }
}
 
開發者ID:shizicheng,項目名稱:spring_mvc_template,代碼行數:10,代碼來源:DataSource.java


注:本文中的java.io.ObjectInputStream.readShort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。