Java Code Examples for java.io.ObjectInputStream#readBoolean()

The following examples show how to use java.io.ObjectInputStream#readBoolean() . These examples are extracted from open source projects. 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
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    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;
    clientCookies =builder.build();
}
 
Example 2
Source Project: XDroidMvp   File: SerializableHttpCookie.java    License: MIT License 6 votes vote down vote up
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    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();

}
 
Example 3
/**
 * Reads a <code>Point2D</code> object that has been serialised by the
 * {@link #writePoint2D(Point2D, ObjectOutputStream)} method.
 *
 * @param stream  the input stream (<code>null</code> not permitted).
 *
 * @return The point object (possibly <code>null</code>).
 *
 * @throws IOException  if there is an I/O problem.
 */
public static Point2D readPoint2D(ObjectInputStream stream)
    throws IOException {

    if (stream == null) {
        throw new IllegalArgumentException("Null 'stream' argument.");
    }
    Point2D result = null;
    boolean isNull = stream.readBoolean();
    if (!isNull) {
        double x = stream.readDouble();
        double y = stream.readDouble();
        result = new Point2D.Double(x, y);
    }
    return result;

}
 
Example 4
Source Project: hottub   File: Booleans.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 5
Source Project: SIMVA-SoS   File: CategoryAxis.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Reads a <code>Map</code> of (<code>Comparable</code>, <code>Paint</code>)
 * elements from a stream.
 *
 * @param in  the input stream.
 *
 * @return The map.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 *
 * @see #writePaintMap(Map, ObjectOutputStream)
 */
private Map readPaintMap(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
    boolean isNull = in.readBoolean();
    if (isNull) {
        return null;
    }
    Map result = new HashMap();
    int count = in.readInt();
    for (int i = 0; i < count; i++) {
        Comparable category = (Comparable) in.readObject();
        Paint paint = SerialUtilities.readPaint(in);
        result.put(category, paint);
    }
    return result;
}
 
Example 6
/**
 * Reads a <code>Point2D</code> object that has been serialised by the
 * {@link #writePoint2D(Point2D, ObjectOutputStream)} method.
 *
 * @param stream  the input stream (<code>null</code> not permitted).
 *
 * @return The point object (possibly <code>null</code>).
 *
 * @throws IOException  if there is an I/O problem.
 */
public static Point2D readPoint2D(final ObjectInputStream stream)
    throws IOException {

    if (stream == null) {
        throw new IllegalArgumentException("Null 'stream' argument.");
    }
    Point2D result = null;
    final boolean isNull = stream.readBoolean();
    if (!isNull) {
        final double x = stream.readDouble();
        final double y = stream.readDouble();
        result = new Point2D.Double(x, y);
    }
    return result;

}
 
Example 7
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    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();

}
 
Example 8
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 9
void readObject(ObjectInputStream in) throws IOException {
    instrType = in.readInt();

    int len = in.readInt();
    classNames = new String[len];

    for (int i = 0; i < len; i++) {
        classNames[i] = in.readUTF().intern(); // Interning is important, since checks are through '=='
    }

    instrSpawnedThreads = in.readBoolean();
    startProfilingPointsActive = in.readBoolean();

    try {
        profilingPointIDs = (int[]) in.readObject();
        profilingPointHandlers = (String[]) in.readObject();
        profilingPointInfos = (String[]) in.readObject();
    } catch (ClassNotFoundException e) {
        IOException ioe = new IOException();
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 10
Source Project: FastWebView   File: SerializableCookie.java    License: MIT License 6 votes vote down vote up
/**
 * 从对象流中构建cookie对象
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    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();

    Cookie.Builder builder = new Cookie.Builder()
            .name(name)
            .value(value)
            .expiresAt(expiresAt)
            .path(path);
    builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain);
    builder = secure ? builder.secure() : builder;
    builder = httpOnly ? builder.httpOnly() : builder;
    this.clientCookie = builder.build();
}
 
Example 11
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 12
/**
 *  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
{
    SecurityManager security = System.getSecurityManager();
    if (security != null){
        String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET);
        if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR);
            throw new UnsupportedOperationException(err.toString());
        }
    }

    is.defaultReadObject();
    if (is.readBoolean()) {
        _uriResolver = (URIResolver) is.readObject();
    }

    _tfactory = new TransformerFactoryImpl();
}
 
Example 13
Source Project: morpheus-core   File: ArrayBase.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
/** Custom serialization */
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
    this.type = (Class<T>)is.readObject();
    this.style = ArrayStyle.valueOf(is.readUTF());
    this.parallel = is.readBoolean();
}
 
Example 14
Source Project: ph-css   File: CSSDataURL.java    License: Apache License 2.0 5 votes vote down vote up
private void readObject (@Nonnull final ObjectInputStream in) throws IOException, ClassNotFoundException
{
  m_aMimeType = (IMimeType) in.readObject ();
  m_bBase64Encoded = in.readBoolean ();
  m_aContent = (byte []) in.readObject ();
  final String sCharsetName = in.readUTF ();
  m_aCharset = CharsetHelper.getCharsetFromName (sCharsetName);
  m_sContent = (String) in.readObject ();
}
 
Example 15
@SuppressWarnings("unchecked")
/** Custom serialization */
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
    final int length = is.readInt();
    this.values = new boolean[length];
    for (int i=0; i<length; ++i) {
        values[i] = is.readBoolean();
    }
}
 
Example 16
/**
 * Deserialize the {@code CertificateRevokedException} instance.
 */
private void readObject(ObjectInputStream ois)
    throws IOException, ClassNotFoundException {
    // Read in the non-transient fields
    // (revocationDate, reason, authority)
    ois.defaultReadObject();

    // Defensively copy the revocation date
    revocationDate = new Date(revocationDate.getTime());

    // Read in the size (number of mappings) of the extensions map
    // and create the extensions map
    int size = ois.readInt();
    if (size == 0) {
        extensions = Collections.emptyMap();
    } else {
        extensions = new HashMap<String, Extension>(size);
    }

    // Read in the extensions and put the mappings in the extensions map
    for (int i = 0; i < size; i++) {
        String oid = (String) ois.readObject();
        boolean critical = ois.readBoolean();
        int length = ois.readInt();
        byte[] extVal = new byte[length];
        ois.readFully(extVal);
        Extension ext = sun.security.x509.Extension.newExtension
            (new ObjectIdentifier(oid), critical, extVal);
        extensions.put(oid, ext);
    }
}
 
Example 17
Source Project: tomee   File: CalendarTimerData.java    License: Apache License 2.0 5 votes vote down vote up
private void readObject(final ObjectInputStream in) throws IOException {
    super.doReadObject(in);
    autoCreated = in.readBoolean();
    try {
        scheduleExpression = ScheduleExpression.class.cast(in.readObject());
    } catch (final ClassNotFoundException e) {
        throw new IOException(e);
    }
}
 
Example 18
/**
 * Deserialize the {@code CertificateRevokedException} instance.
 */
private void readObject(ObjectInputStream ois)
    throws IOException, ClassNotFoundException {
    // Read in the non-transient fields
    // (revocationDate, reason, authority)
    ois.defaultReadObject();

    // Defensively copy the revocation date
    revocationDate = new Date(revocationDate.getTime());

    // Read in the size (number of mappings) of the extensions map
    // and create the extensions map
    int size = ois.readInt();
    if (size == 0) {
        extensions = Collections.emptyMap();
    } else {
        extensions = new HashMap<String, Extension>(size);
    }

    // Read in the extensions and put the mappings in the extensions map
    for (int i = 0; i < size; i++) {
        String oid = (String) ois.readObject();
        boolean critical = ois.readBoolean();
        int length = ois.readInt();
        byte[] extVal = new byte[length];
        ois.readFully(extVal);
        Extension ext = sun.security.x509.Extension.newExtension
            (new ObjectIdentifier(oid), critical, extVal);
        extensions.put(oid, ext);
    }
}
 
Example 19
private void readObject(ObjectInputStream ois) throws IOException {
    Assert.assertFalse(writeObjectCalled, "readObject called too many times");
    readObjectCalled = ois.readBoolean();
}
 
Example 20
Source Project: SmartChart   File: SerializableCookie.java    License: Apache License 2.0 3 votes vote down vote up
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    Cookie.Builder builder = new Cookie.Builder();

    builder.name((String) in.readObject());

    builder.value((String) in.readObject());

    long expiresAt = in.readLong();
    if (expiresAt != NON_VALID_EXPIRES_AT) {
        builder.expiresAt(expiresAt);
    }

    final String domain = (String) in.readObject();
    builder.domain(domain);

    builder.path((String) in.readObject());

    if (in.readBoolean())
        builder.secure();

    if (in.readBoolean())
        builder.httpOnly();

    if (in.readBoolean())
        builder.hostOnlyDomain(domain);

    cookie = builder.build();
}