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


Java ObjectOutputStream.writeFloat方法代碼示例

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


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

示例1: doReps

import java.io.ObjectOutputStream; //導入方法依賴的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.writeFloat((float) 0.0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readFloat();
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:Floats.java

示例2: saveHistogramToFile

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
public void saveHistogramToFile(File file) throws IOException, FileNotFoundException {
    log.info("Saving histogram data to " + file.getName());
    FileOutputStream fos = new FileOutputStream(file);
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    oos.writeObject(histogram.length);
    oos.writeObject(histogram);
    oos.writeObject(bitmap);
    oos.writeFloat(threshold);
    oos.close();
    fos.close();
    log.info("histogram saved to file " + file.getPath());
    setFilePath(file.getPath());
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:14,代碼來源:Histogram2DFilter.java

示例3: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    out.writeLong(mCoordinates != null ? mCoordinates.first : -1);
    out.writeLong(mCoordinates != null ? mCoordinates.second : -1);

    out.writeUTF(mLocation != null ? mLocation.getProvider() : null);
    out.writeDouble(mLocation != null ? mLocation.getLatitude() : -1);
    out.writeDouble(mLocation != null ? mLocation.getLongitude() : -1);
    out.writeFloat(mLocation != null ? mLocation.getAccuracy() : -1);
    out.writeDouble(mLocation != null ? mLocation.getAltitude() : -1);
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:13,代碼來源:GameHarvest.java

示例4: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:CustomObjTrees.java

示例5: doWriteObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Replaces the superclass method to store the state of this class.
 * <p>
 * Serialization is not one of the JDK's nicest topics. Normal serialization will
 * initialise the superclass before the subclass. Sometimes however, this isn't
 * what you want, as in this case the <code>put()</code> method on read can be
 * affected by subclass state.
 * <p>
 * The solution adopted here is to serialize the state data of this class in
 * this protected method. This method must be called by the
 * <code>writeObject()</code> of the first serializable subclass.
 * <p>
 * Subclasses may override if they have a specific field that must be present
 * on read before this implementation will work. Generally, the read determines
 * what must be serialized here, if anything.
 * 
 * @param out  the output stream
 */
protected void doWriteObject(ObjectOutputStream out) throws IOException {
    out.writeInt(keyType);
    out.writeInt(valueType);
    out.writeBoolean(purgeValues);
    out.writeFloat(loadFactor);
    out.writeInt(data.length);
    for (MapIterator it = mapIterator(); it.hasNext();) {
        out.writeObject(it.next());
        out.writeObject(it.getValue());
    }
    out.writeObject(null);  // null terminate map
    // do not call super.doWriteObject() as code there doesn't work for reference map
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:32,代碼來源:AbstractReferenceMap.java

示例6: doWriteObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Writes the map data to the stream. This method must be overridden if a
 * subclass must be setup before <code>put()</code> is used.
 * <p>
 * Serialization is not one of the JDK's nicest topics. Normal serialization will
 * initialise the superclass before the subclass. Sometimes however, this isn't
 * what you want, as in this case the <code>put()</code> method on read can be
 * affected by subclass state.
 * <p>
 * The solution adopted here is to serialize the state data of this class in
 * this protected method. This method must be called by the
 * <code>writeObject()</code> of the first serializable subclass.
 * <p>
 * Subclasses may override if they have a specific field that must be present
 * on read before this implementation will work. Generally, the read determines
 * what must be serialized here, if anything.
 * 
 * @param out  the output stream
 */
protected void doWriteObject(ObjectOutputStream out) throws IOException {
    out.writeFloat(loadFactor);
    out.writeInt(data.length);
    out.writeInt(size);
    for (MapIterator it = mapIterator(); it.hasNext();) {
        out.writeObject(it.next());
        out.writeObject(it.getValue());
    }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:29,代碼來源:AbstractHashedMap.java

示例7: doWriteObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Replaces the superclass method to store the state of this class.
 * <p>
 * Serialization is not one of the JDK's nicest topics. Normal serialization will
 * initialise the superclass before the subclass. Sometimes however, this isn't
 * what you want, as in this case the <code>put()</code> method on read can be
 * affected by subclass state.
 * <p>
 * The solution adopted here is to serialize the state data of this class in
 * this protected method. This method must be called by the
 * <code>writeObject()</code> of the first serializable subclass.
 * <p>
 * Subclasses may override if they have a specific field that must be present
 * on read before this implementation will work. Generally, the read determines
 * what must be serialized here, if anything.
 *
 * @param out  the output stream
 * @throws IOException if an error occurs while writing to the stream
 */
@Override
protected void doWriteObject(final ObjectOutputStream out) throws IOException {
    out.writeInt(keyType.value);
    out.writeInt(valueType.value);
    out.writeBoolean(purgeValues);
    out.writeFloat(loadFactor);
    out.writeInt(data.length);
    for (final MapIterator<K, V> it = mapIterator(); it.hasNext();) {
        out.writeObject(it.next());
        out.writeObject(it.getValue());
    }
    out.writeObject(null);  // null terminate map
    // do not call super.doWriteObject() as code there doesn't work for reference map
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:34,代碼來源:AbstractReferenceMap.java

示例8: doWriteObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Writes the map data to the stream. This method must be overridden if a
 * subclass must be setup before <code>put()</code> is used.
 * <p>
 * Serialization is not one of the JDK's nicest topics. Normal serialization will
 * initialise the superclass before the subclass. Sometimes however, this isn't
 * what you want, as in this case the <code>put()</code> method on read can be
 * affected by subclass state.
 * <p>
 * The solution adopted here is to serialize the state data of this class in
 * this protected method. This method must be called by the
 * <code>writeObject()</code> of the first serializable subclass.
 * <p>
 * Subclasses may override if they have a specific field that must be present
 * on read before this implementation will work. Generally, the read determines
 * what must be serialized here, if anything.
 *
 * @param out  the output stream
 * @throws IOException if an error occurs while writing tothe stream
 */
protected void doWriteObject(final ObjectOutputStream out) throws IOException {
    out.writeFloat(loadFactor);
    out.writeInt(data.length);
    out.writeInt(size);
    for (final MapIterator<K, V> it = mapIterator(); it.hasNext();) {
        out.writeObject(it.next());
        out.writeObject(it.getValue());
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:30,代碼來源:AbstractHashedMap.java


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