java.io.ObjectOutputStream#writeBoolean ( )源码实例Demo

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

源代码1 项目: ccu-historian   文件: CategoryAxis.java
/**
 * 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);
        }
    }
}
 
源代码2 项目: openbd-core   文件: MemberBox.java
/**
 * Writes a Constructor or Method object.
 *
 * Methods and Constructors are not serializable, so we must serialize
 * information about the class, the name, and the parameters and
 * recreate upon deserialization.
 */
private static void writeMember(ObjectOutputStream out, Member member)
    throws IOException
{
    if (member == null) {
        out.writeBoolean(false);
        return;
    }
    out.writeBoolean(true);
    if (!(member instanceof Method || member instanceof Constructor))
        throw new IllegalArgumentException("not Method or Constructor");
    out.writeBoolean(member instanceof Method);
    out.writeObject(member.getName());
    out.writeObject(member.getDeclaringClass());
    if (member instanceof Method) {
        writeParameters(out, ((Method) member).getParameterTypes());
    } else {
        writeParameters(out, ((Constructor<?>) member).getParameterTypes());
    }
}
 
源代码3 项目: ECG-Viewer   文件: CategoryAxis.java
/**
 * 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);
        }
    }
}
 
源代码4 项目: ebics-java-client   文件: User.java
@Override
public void save(ObjectOutputStream oos) throws IOException {
  oos.writeUTF(userId);
  oos.writeUTF(name);
  oos.writeUTF(dn);
  oos.writeBoolean(isInitialized);
  oos.writeBoolean(isInitializedHIA);
  oos.writeObject(a005Certificate);
  oos.writeObject(e002Certificate);
  oos.writeObject(x002Certificate);
  oos.writeObject(a005PrivateKey);
  oos.writeObject(e002PrivateKey);
  oos.writeObject(x002PrivateKey);
  oos.flush();
  oos.close();
  needSave = false;
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: Booleans.java
/**
 * 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();
        }
    }
}
 
源代码6 项目: openjdk-8   文件: CustomObjTrees.java
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);
}
 
源代码7 项目: sakai   文件: PortletState.java
private void writeObject(ObjectOutputStream out) throws IOException
{
	log.debug("Serializing PortletState [action={}]", action);

	out.writeObject(id);
	out.writeBoolean(action);
	out.writeBoolean(secure);
	out.writeObject(parameters);
	out.writeObject(portletMode.toString());
	out.writeObject(windowState.toString());
}
 
源代码8 项目: tomcatsrc   文件: SingleSignOnEntry.java
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    if (principal instanceof Serializable) {
        out.writeBoolean(true);
        out.writeObject(principal);
    } else {
        out.writeBoolean(false);
    }
}
 
源代码9 项目: tysq-android   文件: SerializableCookie.java
/** 将cookie写到对象流中 */
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(this.cookie.name());
    out.writeObject(this.cookie.value());
    out.writeLong(this.cookie.expiresAt());
    out.writeObject(this.cookie.domain());
    out.writeObject(this.cookie.path());
    out.writeBoolean(this.cookie.secure());
    out.writeBoolean(this.cookie.httpOnly());
    out.writeBoolean(this.cookie.hostOnly());
    out.writeBoolean(this.cookie.persistent());
}
 
源代码10 项目: cacheonix-core   文件: EntityKey.java
/**
 * 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 IOException
 */
void serialize(ObjectOutputStream oos) throws IOException {
	oos.writeObject( identifier );
	oos.writeObject( rootEntityName );
	oos.writeObject( entityName );
	oos.writeObject( identifierType );
	oos.writeBoolean( isBatchLoadable );
	oos.writeObject( entityMode.toString() );
}
 
源代码11 项目: netbeans   文件: SetChangeableInstrParamsCommand.java
void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(lockContentionMonitoringEnabled);
    out.writeInt(nProfiledThreadsLimit);
    out.writeInt(stackDepthLimit);
    out.writeInt(samplingInterval);
    out.writeInt(objAllocStackSamplingInterval);
    out.writeInt(objAllocStackSamplingDepth);
    out.writeBoolean(runGCOnGetResultsInMemoryProfiling);
    out.writeBoolean(waitTrackingEnabled);
    out.writeBoolean(sleepTrackingEnabled);
    out.writeBoolean(threadsSamplingEnabled);
    out.writeInt(threadsSamplingFrequency);
}
 
源代码12 项目: Android-Basics-Codes   文件: SerializableCookie.java
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());
}
 
源代码13 项目: flink   文件: StateDescriptor.java
private void writeObject(final ObjectOutputStream out) throws IOException {
	// write all the non-transient fields
	out.defaultWriteObject();

	// write the non-serializable default value field
	if (defaultValue == null) {
		// we don't have a default value
		out.writeBoolean(false);
	} else {
		TypeSerializer<T> serializer = serializerAtomicReference.get();
		checkNotNull(serializer, "Serializer not initialized.");

		// we have a default value
		out.writeBoolean(true);

		byte[] serializedDefaultValue;
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
				DataOutputViewStreamWrapper outView = new DataOutputViewStreamWrapper(baos)) {

			TypeSerializer<T> duplicateSerializer = serializer.duplicate();
			duplicateSerializer.serialize(defaultValue, outView);

			outView.flush();
			serializedDefaultValue = baos.toByteArray();
		}
		catch (Exception e) {
			throw new IOException("Unable to serialize default value of type " +
					defaultValue.getClass().getSimpleName() + ".", e);
		}

		out.writeInt(serializedDefaultValue.length);
		out.write(serializedDefaultValue);
	}
}
 
源代码14 项目: ldbc_graphalytics   文件: BenchmarkRunSetup.java
private void writeObject(ObjectOutputStream stream) throws IOException {

        stream.writeObject(logDir.toAbsolutePath().toString());
        stream.writeObject(outputDir.toAbsolutePath().toString());
        stream.writeObject(validationDir.toAbsolutePath().toString());

        stream.writeBoolean(outputRequired);
        stream.writeBoolean(validationRequired);
    }
 
源代码15 项目: stynico   文件: SerializableHttpCookie.java
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());
}
 
源代码16 项目: geoar-app   文件: DataSourceInstanceHolder.java
public void saveState(ObjectOutputStream objectOutputStream)
		throws IOException {

	// Store filter, serializable
	objectOutputStream.writeObject(currentFilter);

	// Store data source instance settings using settings framework
	SettingsHelper.storeSettings(objectOutputStream, this.dataSource);

	objectOutputStream.writeBoolean(isChecked());
}
 
源代码17 项目: flink   文件: StateDescriptor.java
private void writeObject(final ObjectOutputStream out) throws IOException {
	// write all the non-transient fields
	out.defaultWriteObject();

	// write the non-serializable default value field
	if (defaultValue == null) {
		// we don't have a default value
		out.writeBoolean(false);
	} else {
		TypeSerializer<T> serializer = serializerAtomicReference.get();
		checkNotNull(serializer, "Serializer not initialized.");

		// we have a default value
		out.writeBoolean(true);

		byte[] serializedDefaultValue;
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
				DataOutputViewStreamWrapper outView = new DataOutputViewStreamWrapper(baos)) {

			TypeSerializer<T> duplicateSerializer = serializer.duplicate();
			duplicateSerializer.serialize(defaultValue, outView);

			outView.flush();
			serializedDefaultValue = baos.toByteArray();
		}
		catch (Exception e) {
			throw new IOException("Unable to serialize default value of type " +
					defaultValue.getClass().getSimpleName() + ".", e);
		}

		out.writeInt(serializedDefaultValue.length);
		out.write(serializedDefaultValue);
	}
}
 
源代码18 项目: enjoyshop   文件: SerializableHttpCookie.java
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());
}
 
源代码19 项目: openchemlib-js   文件: Molecule.java
private void writeObject(ObjectOutputStream stream) throws IOException {		
stream.writeInt(mAllAtoms);
stream.writeInt(mAllBonds);
stream.writeBoolean(mIsFragment);
for (int atom=0; atom<mAllAtoms; atom++) {
	stream.writeInt(mAtomicNo[atom]);
	stream.writeInt(mAtomCharge[atom]);
	stream.writeInt(mAtomMass[atom]);
	stream.writeInt(mAtomFlags[atom] & ~cAtomFlagsHelper);
	stream.writeInt(mAtomQueryFeatures[atom]);
	stream.writeDouble(mCoordinates[atom].x);	// for compatibility with earlier double based coords
	stream.writeDouble(mCoordinates[atom].y);
	stream.writeDouble(mCoordinates[atom].z);
	stream.writeInt(mAtomMapNo[atom]);

	if (mAtomList != null && mAtomList[atom] != null) {
		stream.writeInt(mAtomList[atom].length);
		for (int i=0; i<mAtomList[atom].length; i++)
			stream.writeInt(mAtomList[atom][i]);
		}
	else
		stream.writeInt(0);

	if (mAtomCustomLabel != null && mAtomCustomLabel[atom] != null) {
		stream.writeInt(mAtomCustomLabel[atom].length);
		for (int i=0; i<mAtomCustomLabel[atom].length; i++)
			stream.writeByte(mAtomCustomLabel[atom][i]);
		}
	else
		stream.writeInt(0);
	}
for (int bond=0; bond<mAllBonds;bond++) {
	stream.writeInt(mBondAtom[0][bond]);
	stream.writeInt(mBondAtom[1][bond]);
	stream.writeInt(mBondType[bond]);
	stream.writeInt(mBondFlags[bond]);
	stream.writeInt(mBondQueryFeatures[bond]);
	}

stream.writeObject(mName);
}
 
源代码20 项目: barleydb   文件: RefNode.java
private void writeObject(ObjectOutputStream oos) throws IOException {
    LOG.trace("Serializing reference to {}", this);
    oos.writeUTF(entityType.getInterfaceName());
    oos.writeBoolean(loaded);
    oos.writeObject(reference);
}