本文整理了Java中java.io.ObjectOutputStream.writeBoolean()
方法的一些代码示例,展示了ObjectOutputStream.writeBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectOutputStream.writeBoolean()
方法的具体详情如下:
包路径:java.io.ObjectOutputStream
类名称:ObjectOutputStream
方法名:writeBoolean
[英]Writes a boolean to the target stream.
[中]将布尔值写入目标流。
代码示例来源:origin: jenkinsci/jenkins
private void writeObject(ObjectOutputStream oos) throws IOException {
Channel target = Channel.current();
if(channel!=null && channel!=target)
throw new IllegalStateException("Can't send a remote FilePath to a different remote channel");
oos.defaultWriteObject();
oos.writeBoolean(channel==null);
}
代码示例来源:origin: xalan/xalan
/**
* 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 {
os.defaultWriteObject();
if (_uriResolver instanceof Serializable) {
os.writeBoolean(true);
os.writeObject((Serializable) _uriResolver);
}
else {
os.writeBoolean(false);
}
}
代码示例来源:origin: hankcs/HanLP
private void writeObject(ObjectOutputStream out) throws IOException
{
loseWeight();
out.writeInt(size);
out.writeObject(data);
out.writeInt(linearExpandFactor);
out.writeBoolean(exponentialExpanding);
out.writeDouble(exponentialExpandFactor);
}
代码示例来源:origin: apache/geode
/**
* Override writeObject which is used in serialization. This class is serialized when JMX client
* acquires MBeanInfo for ConfigurationParameter MBean. Super class is not serializable.
*/
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.writeObject(this.name);
out.writeObject(this.description);
out.writeObject(this.value);
out.writeObject(this.type);
out.writeBoolean(this.userModifiable);
}
代码示例来源:origin: com.github.romix/java-concurrent-hash-trie-map
private void writeObject(ObjectOutputStream outputStream) throws IOException {
outputStream.defaultWriteObject();
final Map<K, V> ro = readOnlySnapshot();
outputStream.writeBoolean(isReadOnly());
outputStream.writeInt(ro.size());
for (Entry<K, V> e : ro.entrySet()) {
outputStream.writeObject(e.getKey());
outputStream.writeObject(e.getValue());
}
}
}
代码示例来源:origin: h2oai/h2o-2
private void writeObject(java.io.ObjectOutputStream s) throws IOException {
s.defaultWriteObject(); // Nothing to write
final NBSI nbsi = _nbsi; // The One Field is transient
final int len = _nbsi._bits.length<<6;
s.writeInt(len); // Write max element
for( int i=0; i<len; i++ )
s.writeBoolean( _nbsi.contains(i) );
}
代码示例来源:origin: oracle/opengrok
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeBoolean(projectName != null); // hasValue
out.writeUTF(projectName == null ? "" : projectName);
out.writeBoolean(tabSize != null); // hasValue
out.writeInt(tabSize == null ? 0 : tabSize);
out.writeBoolean(analyzerGuruVersion != null); // hasValue
out.writeLong(analyzerGuruVersion == null ? 0 : analyzerGuruVersion);
int analyzerCount = analyzersVersions.size();
out.writeInt(analyzerCount);
for (Map.Entry<String, Long> entry : analyzersVersions.entrySet()) {
out.writeUTF(entry.getKey());
out.writeLong(entry.getValue());
--analyzerCount;
}
if (analyzerCount != 0) {
throw new IllegalStateException("analyzersVersions were modified");
}
}
}
代码示例来源:origin: jeasonlzy/okhttp-OkGo
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());
}
代码示例来源:origin: postgresql/postgresql
protected void writeBaseObject(ObjectOutputStream out) throws IOException
{
out.writeObject(serverName);
out.writeObject(databaseName);
out.writeObject(user);
out.writeObject(password);
out.writeInt(portNumber);
out.writeInt(prepareThreshold);
out.writeInt(unknownLength);
out.writeInt(loginTimeout);
out.writeInt(socketTimeout);
out.writeBoolean(ssl);
out.writeObject(sslfactory);
out.writeBoolean(tcpKeepAlive);
out.writeObject(compatible);
out.writeInt(logLevel);
out.writeInt(protocolVersion);
out.writeObject(applicationName);
}
代码示例来源:origin: ehcache/ehcache3
@Override
public void close() throws IOException {
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File(directory, JOURNAL_FILENAME)))) {
oos.writeBoolean(true);
Map<TransactionId, SerializableEntry<K>> toSerialize = new HashMap<>();
for (Map.Entry<TransactionId, Entry<K>> entry : states.entrySet()) {
TransactionId key = entry.getKey();
Entry<K> value = entry.getValue();
toSerialize.put(key, new SerializableEntry<>(value, keySerializer));
}
oos.writeObject(toSerialize);
states.clear();
}
}
}
代码示例来源:origin: romix/java-concurrent-hash-trie-map
private void writeObject(ObjectOutputStream outputStream) throws IOException {
outputStream.defaultWriteObject();
final Map<K, V> ro = readOnlySnapshot();
outputStream.writeBoolean(isReadOnly());
outputStream.writeInt(ro.size());
for (Entry<K, V> e : ro.entrySet()) {
outputStream.writeObject(e.getKey());
outputStream.writeObject(e.getValue());
}
}
}
代码示例来源:origin: JCTools/JCTools
private void writeObject(java.io.ObjectOutputStream s) throws IOException {
s.defaultWriteObject(); // Nothing to write
final NBSI nbsi = _nbsi; // The One Field is transient
final int len = _nbsi._bits.length<<6;
s.writeInt(len); // Write max element
for( int i=0; i<len; i++ )
s.writeBoolean( _nbsi.contains(i) );
}
代码示例来源:origin: it.unimi.dsi/fastutil
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
s.defaultWriteObject();
for (int i = 0; i < size; i++)
s.writeBoolean(a[i]);
}
代码示例来源:origin: HdrHistogram/HdrHistogram
private void writeObject(final ObjectOutputStream o)
throws IOException
{
o.writeLong(lowestDiscernibleValue);
o.writeLong(highestTrackableValue);
o.writeInt(numberOfSignificantValueDigits);
o.writeInt(getNormalizingIndexOffset());
o.writeDouble(integerToDoubleValueConversionRatio);
o.writeLong(getTotalCount());
// Max Value is added to the serialized form because establishing max via scanning is "harder" during
// deserialization, as the counts array is not available at the subclass deserializing level, and we don't
// really want to have each subclass establish max on it's own...
o.writeLong(maxValue);
o.writeLong(minNonZeroValue);
o.writeLong(startTimeStampMsec);
o.writeLong(endTimeStampMsec);
o.writeBoolean(autoResize);
o.writeInt(wordSizeInBytes);
}
代码示例来源:origin: apache/shiro
/**
* Serialization write support.
* <p/>
* NOTE: Don't forget to change the serialVersionUID constant at the top of this class
* if you make any backwards-incompatible serialization changes!!!
* (use the JDK 'serialver' program for this)
*
* @param out output stream provided by Java serialization
* @throws IOException if there is a stream error
*/
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
boolean principalsExist = !CollectionUtils.isEmpty(realmPrincipals);
out.writeBoolean(principalsExist);
if (principalsExist) {
out.writeObject(realmPrincipals);
}
}
代码示例来源:origin: commons-beanutils/commons-beanutils
out.writeBoolean(false);
out.writeObject(clazz);
} else {
out.writeBoolean(true);
out.writeInt(primitiveType);
代码示例来源:origin: redisson/redisson
ObjectOutputStream out = new ObjectOutputStream(outs);
if (err != null) {
out.writeBoolean(false);
out.writeUTF(err.toString());
out.writeBoolean(true);
out.writeObject(rvalue);
代码示例来源:origin: hazelcast/hazelcast-jet
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
Address address = member.getAddress();
String host = address.getHost();
int port = address.getPort();
out.writeUTF(member.getUuid());
out.writeUTF(host);
out.writeInt(port);
out.writeBoolean(member.isLiteMember());
out.writeObject(member.getVersion());
}
代码示例来源:origin: apache/flink
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 {
// 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);
}
}
代码示例来源:origin: it.unimi.dsi/fastutil
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
s.defaultWriteObject();
for (int i = 0; i < size; i++) {
s.writeLong(key[i]);
s.writeBoolean(value[i]);
}
}
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
内容来源于网络,如有侵权,请联系作者删除!