java.io.ObjectInputStream.readBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中java.io.ObjectInputStream.readBoolean()方法的一些代码示例,展示了ObjectInputStream.readBoolean()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.readBoolean()方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:readBoolean

ObjectInputStream.readBoolean介绍

[英]Reads a boolean from the source stream.
[中]从源流中读取布尔值。

代码示例

代码示例来源:origin: hankcs/HanLP

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
  size = in.readInt();
  data = (int[]) in.readObject();
  linearExpandFactor = in.readInt();
  exponentialExpanding = in.readBoolean();
  exponentialExpandFactor = in.readDouble();
}

代码示例来源:origin: apache/shiro

/**
   * Serialization read support - reads in the Map principals collection if it exists in the
   * input stream.
   * <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 in input stream provided by
   * @throws IOException            if there is an input/output problem
   * @throws ClassNotFoundException if the underlying Map implementation class is not available to the classloader.
   */
  private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    boolean principalsExist = in.readBoolean();
    if (principalsExist) {
      this.realmPrincipals = (Map<String, Set>) in.readObject();
    }
  }
}

代码示例来源:origin: oracle/opengrok

private void readObject(ObjectInputStream in) throws ClassNotFoundException,
    IOException {
  boolean hasValue = in.readBoolean();
  String vstring = in.readUTF();
  projectName = hasValue ? vstring : null;
  hasValue = in.readBoolean();
  int vint = in.readInt();
  tabSize = hasValue ? vint : null;
  hasValue = in.readBoolean();
  long vlong = in.readLong();
  analyzerGuruVersion = hasValue ? vlong : null;
  /**
   * De-serialization circumvents normal construction, so the following
   * field could be null.
   */
  if (analyzersVersions == null) {
    analyzersVersions = new HashMap<>();
  }
  int analyzerCount = in.readInt();
  for (int i = 0; i < analyzerCount; ++i) {
    vstring = in.readUTF();
    vlong = in.readLong();
    analyzersVersions.put(vstring, vlong);
  }
}

代码示例来源:origin: apache/geode

/**
 * Override readObject which is used in serialization. Customize serialization of this exception
 * to avoid escape of InternalRole which is not Serializable.
 */
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 String inName = (String) in.readObject();
 String inDescription = (String) in.readObject();
 Object inValue = in.readObject();
 Class inClass = (Class) in.readObject();
 boolean inUserModifiable = in.readBoolean();
 this.deserialized = true;
 this.name = inName;
 setInternalState(inDescription, inValue, inClass, inUserModifiable);
}

代码示例来源:origin: dcm4che/dcm4che-core

private void readObject(ObjectInputStream s) throws IOException,
ClassNotFoundException {
  s.defaultReadObject();
  tag = s.readInt();
  vr = VR.valueOf(s.readUnsignedShort());
  bigEndian = s.readBoolean();
  int n = s.readInt();
  items = new ArrayList<Object>(n);
  for (int i = 0; i < n; ++i) {
    items.add(s.readObject());
  }
}

代码示例来源:origin: apache/flink

private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    // read the non-transient fields
    in.defaultReadObject();

    // read the default value field
    boolean hasDefaultValue = in.readBoolean();
    if (hasDefaultValue) {
      int size = in.readInt();

      byte[] buffer = new byte[size];

      in.readFully(buffer);

      try (ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
          DataInputViewStreamWrapper inView = new DataInputViewStreamWrapper(bais)) {

        defaultValue = serializer.deserialize(inView);
      }
      catch (Exception e) {
        throw new IOException("Unable to deserialize default value.", e);
      }
    } else {
      defaultValue = null;
    }
  }
}

代码示例来源:origin: jenkinsci/jenkins

private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  Channel channel = Channel.current();
  assert channel!=null;
  ois.defaultReadObject();
  if(ois.readBoolean()) {
    this.channel = channel;
    this.filter = null;
  } else {
    this.channel = null;
    // If the remote channel wants us to create a FilePath that points to a local file,
    // we need to make sure the access control takes place.
    // This covers the immediate case of FileCallables taking FilePath into reference closure implicitly,
    // but it also covers more general case of FilePath sent as a return value or argument.
    this.filter = SoloFilePathFilter.wrap(FilePathFilter.current());
  }
}

代码示例来源:origin: commons-beanutils/commons-beanutils

if (in.readBoolean()) {
  switch (in.readInt()) {
  return ((Class<?>) in.readObject());

代码示例来源:origin: xalan/xalan

/**
 *  Overrides the default readObject implementation since we decided
 *  it would be cleaner not to serialize the entire tranformer
 *  factory.  [ ref bugzilla 12317 ]
 *  We need to check if the user defined class for URIResolver also
 *  implemented Serializable
 *  if yes then we need to deserialize the URIResolver
 *  Fix for bugzilla bug 22438
 */
private void  readObject(ObjectInputStream is) 
 throws IOException, ClassNotFoundException 
{
is.defaultReadObject();
  if (is.readBoolean()) {
    _uriResolver = (URIResolver) is.readObject();
  }
_tfactory = new TransformerFactoryImpl();
}

代码示例来源:origin: ehcache/ehcache3

@Override
public void open() throws IOException {
 File file = new File(directory, JOURNAL_FILENAME);
 if (file.isFile()) {
  try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) {
   boolean valid = ois.readBoolean();
   states.clear();
   if (valid) {
    Map<TransactionId, SerializableEntry<K>> readStates = uncheckedCast(ois.readObject());
    for (Map.Entry<TransactionId, SerializableEntry<K>> entry : readStates.entrySet()) {
     SerializableEntry<K> value = entry.getValue();
     states.put(entry.getKey(), new Entry<>(value.state, value.heuristic, value.deserializeKeys(keySerializer)));
    }
   }
  } catch (IOException ioe) {
   LOGGER.warn("Cannot read XA journal, truncating it", ioe);
  } catch (ClassNotFoundException cnfe) {
   LOGGER.warn("Cannot deserialize XA journal contents, truncating it", cnfe);
  } finally {
   try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) {
    oos.writeObject(false);
   }
  }
 }
}

代码示例来源:origin: hazelcast/hazelcast-jet

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();

    String uuid = in.readUTF();
    String host = in.readUTF();
    int port = in.readInt();
    boolean liteMember = in.readBoolean();
    MemberVersion version = (MemberVersion) in.readObject();

    member = new MemberImpl(new Address(host, port), version, false, uuid, null, liteMember);
  }
}

代码示例来源:origin: h2oai/h2o-2

private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException  {
 s.defaultReadObject();      // Read nothing
 final int len = s.readInt(); // Read max element
 _nbsi = new NBSI(len, new ConcurrentAutoTable(), this);
 for( int i=0; i<len; i++ )  // Read all bits
  if( s.readBoolean() )
   _nbsi.add(i);
}

代码示例来源:origin: it.unimi.dsi/fastutil

private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
    s.defaultReadObject();
    a = new boolean[size];
    for (int i = 0; i < size; i++)
      a[i] = s.readBoolean();
  }
}

代码示例来源:origin: HdrHistogram/HdrHistogram

private void readObject(final ObjectInputStream o)
    throws IOException, ClassNotFoundException {
  final long lowestDiscernibleValue = o.readLong();
  final long highestTrackableValue = o.readLong();
  final int numberOfSignificantValueDigits = o.readInt();
  final int normalizingIndexOffset = o.readInt();
  final double integerToDoubleValueConversionRatio = o.readDouble();
  final long indicatedTotalCount = o.readLong();
  final long indicatedMaxValue = o.readLong();
  final long indicatedMinNonZeroValue = o.readLong();
  final long indicatedStartTimeStampMsec = o.readLong();
  final long indicatedEndTimeStampMsec = o.readLong();
  final boolean indicatedAutoResize = o.readBoolean();
  final int indicatedwordSizeInBytes = o.readInt();
  init(lowestDiscernibleValue, highestTrackableValue, numberOfSignificantValueDigits,
      integerToDoubleValueConversionRatio, normalizingIndexOffset);
  // Set internalTrackingValues (can't establish them from array yet, because it's not yet read...)
  setTotalCount(indicatedTotalCount);
  maxValue = indicatedMaxValue;
  minNonZeroValue = indicatedMinNonZeroValue;
  startTimeStampMsec = indicatedStartTimeStampMsec;
  endTimeStampMsec = indicatedEndTimeStampMsec;
  autoResize = indicatedAutoResize;
  wordSizeInBytes = indicatedwordSizeInBytes;
}

代码示例来源:origin: wildfly/wildfly

if (in.readBoolean()) {
  switch (in.readInt()) {
  return ((Class<?>) in.readObject());

代码示例来源:origin: jeasonlzy/okhttp-OkGo

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  String name = (String) in.readObject();
  String value = (String) in.readObject();
  long expiresAt = in.readLong();
  String domain = (String) in.readObject();
  String path = (String) in.readObject();
  boolean secure = in.readBoolean();
  boolean httpOnly = in.readBoolean();
  boolean hostOnly = in.readBoolean();
  boolean persistent = in.readBoolean();
  Cookie.Builder builder = new Cookie.Builder();
  builder = builder.name(name);
  builder = builder.value(value);
  builder = builder.expiresAt(expiresAt);
  builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain);
  builder = builder.path(path);
  builder = secure ? builder.secure() : builder;
  builder = httpOnly ? builder.httpOnly() : builder;
  clientCookie = builder.build();
}

代码示例来源:origin: hibernate/hibernate-orm

return new ImmutableEntityEntry(
    persistenceContext.getSession().getFactory(),
    (String) ois.readObject(),
    (Serializable) ois.readObject(),
    Status.valueOf( (String) ois.readObject() ),
    ( previousStatusString = (String) ois.readObject() ).length() == 0
        ? null
    ois.readObject(),
    LockMode.valueOf( (String) ois.readObject() ),
    ois.readBoolean(),
    ois.readBoolean(),
    null
);

代码示例来源:origin: com.hazelcast/hazelcast-all

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();

    String uuid = in.readUTF();
    String host = in.readUTF();
    int port = in.readInt();
    boolean liteMember = in.readBoolean();
    MemberVersion version = (MemberVersion) in.readObject();

    member = new MemberImpl(new Address(host, port), version, false, uuid, null, liteMember);
  }
}

代码示例来源:origin: JCTools/JCTools

private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException  {
 s.defaultReadObject();      // Read nothing
 final int len = s.readInt(); // Read max element
 _nbsi = new NBSI(len, new ConcurrentAutoTable(), this);
 for( int i=0; i<len; i++ )  // Read all bits
  if( s.readBoolean() )
   _nbsi.add(i);
}

代码示例来源:origin: it.unimi.dsi/fastutil

private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
    s.defaultReadObject();
    a = new boolean[size];
    for (int i = 0; i < size; i++)
      a[i] = s.readBoolean();
  }
}

相关文章

ObjectInputStream类方法