Java Code Examples for java.io.ObjectOutputStream#writeBoolean()
The following examples show how to use
java.io.ObjectOutputStream#writeBoolean() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CategoryAxis.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * 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); } } }
Example 2
Source File: Booleans.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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(); } } }
Example 3
Source File: User.java From ebics-java-client with GNU Lesser General Public License v2.1 | 6 votes |
@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; }
Example 4
Source File: MemberBox.java From openbd-core with GNU General Public License v3.0 | 6 votes |
/** * 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()); } }
Example 5
Source File: CategoryAxis.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * 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); } } }
Example 6
Source File: BenchmarkRunSetup.java From ldbc_graphalytics with Apache License 2.0 | 5 votes |
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); }
Example 7
Source File: SerializableHttpCookie.java From enjoyshop with Apache License 2.0 | 5 votes |
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()); }
Example 8
Source File: StateDescriptor.java From flink with Apache License 2.0 | 5 votes |
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); } }
Example 9
Source File: DataSourceInstanceHolder.java From geoar-app with Apache License 2.0 | 5 votes |
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()); }
Example 10
Source File: SerializableHttpCookie.java From stynico with MIT License | 5 votes |
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()); }
Example 11
Source File: CustomObjTrees.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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); }
Example 12
Source File: StateDescriptor.java From flink with Apache License 2.0 | 5 votes |
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); } }
Example 13
Source File: SerializableCookie.java From Android-Basics-Codes with Artistic License 2.0 | 5 votes |
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()); }
Example 14
Source File: SetChangeableInstrParamsCommand.java From netbeans with Apache License 2.0 | 5 votes |
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); }
Example 15
Source File: EntityKey.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * 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() ); }
Example 16
Source File: SerializableCookie.java From tysq-android with GNU General Public License v3.0 | 5 votes |
/** 将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()); }
Example 17
Source File: SingleSignOnEntry.java From tomcatsrc with Apache License 2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); if (principal instanceof Serializable) { out.writeBoolean(true); out.writeObject(principal); } else { out.writeBoolean(false); } }
Example 18
Source File: PortletState.java From sakai with Educational Community License v2.0 | 5 votes |
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()); }
Example 19
Source File: Molecule.java From openchemlib-js with BSD 3-Clause "New" or "Revised" License | 4 votes |
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); }
Example 20
Source File: RefNode.java From barleydb with GNU Lesser General Public License v3.0 | 4 votes |
private void writeObject(ObjectOutputStream oos) throws IOException { LOG.trace("Serializing reference to {}", this); oos.writeUTF(entityType.getInterfaceName()); oos.writeBoolean(loaded); oos.writeObject(reference); }