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


Java ObjectOutputStream.writeBoolean方法代碼示例

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


在下文中一共展示了ObjectOutputStream.writeBoolean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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.writeBoolean(false);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readBoolean();
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:Booleans.java

示例2: serialize

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Custom serialization routine used during serialization of a
 * Session/PersistenceContext for increased performance.
 *
 * @param oos The stream to which we should write the serial data.
 *
 * @throws java.io.IOException If a stream error occurs
 */
public void serialize(ObjectOutputStream oos) throws IOException {
	Status previousStatus = getPreviousStatus();
	oos.writeObject( getEntityName() );
	oos.writeObject( id );
	oos.writeObject( getStatus().name() );
	oos.writeObject( (previousStatus == null ? "" : previousStatus.name()) );
	// todo : potentially look at optimizing these two arrays
	oos.writeObject( loadedState );
	oos.writeObject( getDeletedState() );
	oos.writeObject( version );
	oos.writeObject( getLockMode().toString() );
	oos.writeBoolean( isExistsInDatabase() );
	oos.writeBoolean( isBeingReplicated() );
	oos.writeBoolean( isLoadedWithLazyPropertiesUnfetched() );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:EntityEntry.java

示例3: writePaintMap

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Writes a map of (<code>Comparable</code>, <code>Paint</code>)
 * elements to a stream.
 * 
 * @param map  the map (<code>null</code> permitted).
 * 
 * @param out
 * @throws IOException
 * 
 * @see #readPaintMap(ObjectInputStream)
 */
private void writePaintMap(Map map, ObjectOutputStream out) 
        throws IOException {
    if (map == null) {
        out.writeBoolean(true);
    }
    else {
        out.writeBoolean(false);
        Set keys = map.keySet();
        int count = keys.size();
        out.writeInt(count);
        Iterator iterator = keys.iterator();
        while (iterator.hasNext()) {
            Comparable key = (Comparable) iterator.next();
            out.writeObject(key);
            SerialUtilities.writePaint((Paint) map.get(key), out);
        }
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:CategoryAxis.java

示例4: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.expiresAt());
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
    out.writeBoolean(cookie.persistent());
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:13,代碼來源:SerializableCookie.java

示例5: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookie.getName());
    out.writeObject(cookie.getValue());
    out.writeObject(cookie.getComment());
    out.writeObject(cookie.getDomain());
    out.writeObject(cookie.getExpiryDate());
    out.writeObject(cookie.getPath());
    out.writeInt(cookie.getVersion());
    out.writeBoolean(cookie.isSecure());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:SerializableCookie.java

示例6: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
	out.defaultWriteObject();
	if (principal instanceof Serializable) {
		out.writeBoolean(true);
		out.writeObject(principal);
	} else {
		out.writeBoolean(false);
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:10,代碼來源:SingleSignOnEntry.java

示例7: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.expiresAt());
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
    out.writeBoolean(cookie.persistent());
}
 
開發者ID:fodroid,項目名稱:XDroid-Databinding,代碼行數:12,代碼來源:SerializableHttpCookie.java

示例8: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException{
	out.writeObject(this._featureIntMap);
	out.writeObject(this._feature2rep);
	out.writeObject(this._weights);
	out.writeInt(this._size);
	out.writeInt(this._fixedFeaturesSize);
	out.writeBoolean(this._locked);
}
 
開發者ID:justhalf,項目名稱:weak-semi-crf-naacl2016,代碼行數:9,代碼來源:GlobalNetworkParam.java

示例9: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
}
 
開發者ID:qiaop,項目名稱:basicapp,代碼行數:11,代碼來源:SerializableCookie.java

示例10: writeObject

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

    for (int i = 0; i < classNames.length; i++) {
        out.writeUTF(classNames[i]);
    }

    out.writeBoolean(instrSpawnedThreads);
    out.writeBoolean(startProfilingPointsActive);
    out.writeObject(profilingPointIDs);
    out.writeObject(profilingPointHandlers);
    out.writeObject(profilingPointInfos);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:InitiateProfilingCommand.java

示例11: writeObject

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

    int count = keyCount;
    if (count != 0) {
        boolean hasIntValues = (ivaluesShift != 0);
        boolean hasObjectValues = (values != null);
        out.writeBoolean(hasIntValues);
        out.writeBoolean(hasObjectValues);

        for (int i = 0; count != 0; ++i) {
            int key = keys[i];
            if (key != EMPTY && key != DELETED) {
                --count;
                out.writeInt(key);
                if (hasIntValues) {
                    out.writeInt(keys[ivaluesShift + i]);
                }
                if (hasObjectValues) {
                    out.writeObject(values[i]);
                }
            }
        }
    }
}
 
開發者ID:middle2tw,項目名稱:whackpad,代碼行數:28,代碼來源:UintMap.java

示例12: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 *  This is to fix bugzilla bug 22438
 *  If the user defined class implements URIResolver and Serializable
 *  then we want it to get serialized
 */
private void writeObject(ObjectOutputStream os)
    throws IOException, ClassNotFoundException {
    if (_auxClasses != null) {
        //throw with the same message as when Hashtable was used for compatibility.
        throw new NotSerializableException(
                "com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable");
    }

    // Write serialized fields
    ObjectOutputStream.PutField pf = os.putFields();
    pf.put("_name", _name);
    pf.put("_bytecodes", _bytecodes);
    pf.put("_class", _class);
    pf.put("_transletIndex", _transletIndex);
    pf.put("_outputProperties", _outputProperties);
    pf.put("_indentNumber", _indentNumber);
    os.writeFields();

    if (_uriResolver instanceof Serializable) {
        os.writeBoolean(true);
        os.writeObject((Serializable) _uriResolver);
    }
    else {
        os.writeBoolean(false);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:TemplatesImpl.java

示例13: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream oos) throws IOException{
	oos.writeObject(this._param_g);
	oos.writeBoolean(this._cacheEnabled);
	oos.writeInt(this._numThreads);
}
 
開發者ID:justhalf,項目名稱:weak-semi-crf-naacl2016,代碼行數:6,代碼來源:FeatureManager.java

示例14: 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

示例15: 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


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