Example usage for java.io ObjectOutput writeBoolean

List of usage examples for java.io ObjectOutput writeBoolean

Introduction

In this page you can find the example usage for java.io ObjectOutput writeBoolean.

Prototype

void writeBoolean(boolean v) throws IOException;

Source Link

Document

Writes a boolean value to this output stream.

Usage

From source file:xbird.xquery.expr.path.PathExpr.java

public void writeExternal(ObjectOutput out) throws IOException {
    final List<XQExpression> steps = _steps;
    final int numSteps = steps.size();
    out.writeInt(numSteps);/*from   ww  w  .  j  a  v  a  2s  .  com*/
    for (int i = 0; i < numSteps; i++) {
        XQExpression step = steps.get(i);
        out.writeObject(step);
    }
    final XQExpression analyzed = _analyzedExpr;
    if (analyzed == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeObject(analyzed);
    }
}

From source file:com.splicemachine.derby.impl.sql.execute.operations.SpliceBaseOperation.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    SpliceLogUtils.trace(LOG, "writeExternal");
    out.writeDouble(optimizerEstimatedCost);
    out.writeDouble(optimizerEstimatedRowCount);
    out.writeObject(operationInformation);
    out.writeBoolean(isTopResultSet);
}

From source file:org.apache.rahas.Token.java

/**
 * Implementing serialize logic according to our own protocol. We had to follow this, because
 * OMElement class is not serializable. Making OMElement serializable will have an huge impact
 * on other components. Therefore implementing serialization logic according to a manual
 * protocol.//from   ww  w .  j  a  va  2s. c o  m
 * @param out Stream which writes serialized bytes.
 * @throws IOException If unable to serialize particular member.
 */
public void writeExternal(ObjectOutput out) throws IOException {

    out.writeObject(this.id);

    out.writeInt(this.state);

    String stringElement = convertOMElementToString(this.token);
    out.writeObject(stringElement);

    stringElement = convertOMElementToString(this.previousToken);
    out.writeObject(stringElement);

    stringElement = convertOMElementToString(this.attachedReference);
    out.writeObject(stringElement);

    stringElement = convertOMElementToString(this.unattachedReference);
    out.writeObject(stringElement);

    out.writeObject(this.properties);

    out.writeBoolean(this.changed);

    int secretLength = 0;
    if (null != this.secret) {
        secretLength = this.secret.length;
    }

    // First write the length of secret
    out.writeInt(secretLength);
    if (0 != secretLength) {
        out.write(this.secret);
    }

    out.writeObject(this.created);

    out.writeObject(this.expires);

    out.writeObject(this.issuerAddress);

    out.writeObject(this.encrKeySha1Value);
}

From source file:net.lightbody.bmp.proxy.jetty.jetty.servlet.WebApplicationContext.java

public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
    out.writeObject(getContextPath());// w ww  .  j a  va2  s  . c  o m
    out.writeObject(getVirtualHosts());
    HttpHandler[] handlers = getHandlers();
    for (int i = 0; i < handlers.length; i++) {
        if (handlers[i] instanceof WebApplicationHandler)
            break;
        out.writeObject(handlers[i]);
    }
    out.writeObject(getAttributes());
    out.writeBoolean(isRedirectNullPath());
    out.writeInt(getMaxCachedFileSize());
    out.writeInt(getMaxCacheSize());
    out.writeBoolean(getStatsOn());
    out.writeObject(getPermissions());
    out.writeBoolean(isClassLoaderJava2Compliant());

    out.writeObject(_defaultsDescriptor);
    out.writeObject(_war);
    out.writeBoolean(_extract);
    out.writeBoolean(_ignorewebjetty);
    out.writeBoolean(_distributable);

    out.writeObject(_configurationClassNames);
}

From source file:org.apache.openjpa.lib.conf.ConfigurationImpl.java

/**
 * Implementation of the {@link Externalizable} interface to write
 * the properties returned by {@link #toProperties}.
 */// ww w . ja  va 2s  .c o m
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(toProperties(true));
    out.writeObject(_props);
    out.writeBoolean(_globals);
}

From source file:com.akop.bach.util.SerializableCookie.java

public void writeExternal(final ObjectOutput out) throws IOException {
    nullMask |= (getName() == null) ? NAME : 0;
    nullMask |= (getValue() == null) ? VALUE : 0;
    nullMask |= (getComment() == null) ? COMMENT : 0;
    nullMask |= (getCommentURL() == null) ? COMMENT_URL : 0;
    nullMask |= (getExpiryDate() == null) ? EXPIRY_DATE : 0;
    nullMask |= (getDomain() == null) ? DOMAIN : 0;
    nullMask |= (getPath() == null) ? PATH : 0;
    nullMask |= (getPorts() == null) ? PORTS : 0;

    out.writeInt(nullMask);/*from www  .  j  ava  2s  .c  om*/

    if ((nullMask & NAME) == 0)
        out.writeUTF(getName());

    if ((nullMask & VALUE) == 0)
        out.writeUTF(getValue());

    if ((nullMask & COMMENT) == 0)
        out.writeUTF(getComment());

    if ((nullMask & COMMENT_URL) == 0)
        out.writeUTF(getCommentURL());

    if ((nullMask & EXPIRY_DATE) == 0)
        out.writeLong(getExpiryDate().getTime());

    out.writeBoolean(isPersistent());

    if ((nullMask & DOMAIN) == 0)
        out.writeUTF(getDomain());

    if ((nullMask & PATH) == 0)
        out.writeUTF(getPath());

    if ((nullMask & PORTS) == 0) {
        out.writeInt(getPorts().length);
        for (int p : getPorts())
            out.writeInt(p);
    }

    out.writeBoolean(isSecure());
    out.writeInt(getVersion());
}

From source file:LayeredPaneDemo4.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(m_titleBarBackground);
    out.writeObject(m_titleBarForeground);
    out.writeObject(m_BorderColor);/*from w ww. j a v a 2 s . co  m*/
    out.writeObject(m_selectedTitleBarBackground);
    out.writeObject(m_selectedBorderColor);

    out.writeObject(m_title);

    out.writeBoolean(m_iconizeable);
    out.writeBoolean(m_resizeable);
    out.writeBoolean(m_closeable);
    out.writeBoolean(m_maximizeable);

    out.writeObject(m_frameIcon);
    out.writeObject(getBounds());
}

From source file:com.inmobi.grill.server.query.QueryExecutionServiceImpl.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    // persist all drivers
    synchronized (drivers) {
        out.writeInt(drivers.size());//from w w  w . java 2s . c o m
        for (GrillDriver driver : drivers) {
            out.writeUTF(driver.getClass().getName());
            driver.writeExternal(out);
        }
    }
    // persist allQueries
    synchronized (allQueries) {
        out.writeInt(allQueries.size());
        for (QueryContext ctx : allQueries.values()) {
            out.writeObject(ctx);
            boolean isDriverAvailable = (ctx.getSelectedDriver() != null);
            out.writeBoolean(isDriverAvailable);
            if (isDriverAvailable) {
                out.writeUTF(ctx.getSelectedDriver().getClass().getName());
            }
        }
    }
    LOG.info("Persisted " + allQueries.size() + " queries");
}

From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    int version = 1;
    out.writeInt(version);/* w  ww  .j  a va 2 s  .  co  m*/

    out.writeInt(dataPoints);
    out.writeInt(crossColor.getRGB());
    out.writeDouble(pointSize);

    out.writeInt(value.length);
    for (int i = 0; i < value.length; i++) {
        out.writeFloat(value[i]);
    }

    out.writeInt(selectionData.length);
    for (int i = 0; i < selectionData.length; i++) {
        out.writeFloat(selectionData[i]);
    }

    out.writeInt(useData.length);
    for (int i = 0; i < useData.length; i++) {
        out.writeBoolean(useData[i]);
    }

    out.writeDouble((Double) offset.getValue());
    out.writeBoolean(showOffset.isSelected());

}

From source file:org.codehaus.groovy.grails.web.util.StreamCharBuffer.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(EXTERNALIZABLE_VERSION);
    StringChunk stringChunk = readToSingleStringChunk(false);
    if (stringChunk != null && stringChunk.str.length() > 0) {
        char[] buf = StringCharArrayAccessor.getValue(stringChunk.str);
        out.writeInt(buf.length);/*from w ww  . ja  v  a 2s. co  m*/
        Writer writer = new OutputStreamWriter((OutputStream) out, "UTF-8");
        writer.write(buf);
        writer.flush();
        if (stringChunk instanceof MultipartStringChunk) {
            MultipartStringChunk mpStringChunk = (MultipartStringChunk) stringChunk;
            out.writeInt(mpStringChunk.partCount());
            EncodingStatePart current = mpStringChunk.firstPart;
            while (current != null) {
                out.writeInt(current.len);
                if (current.encodingState != null && current.encodingState.getEncoders() != null
                        && current.encodingState.getEncoders().size() > 0) {
                    out.writeInt(current.encodingState.getEncoders().size());
                    for (Encoder encoder : current.encodingState.getEncoders()) {
                        out.writeUTF(encoder.getCodecIdentifier().getCodecName());
                        out.writeBoolean(encoder.isSafe());
                    }
                } else {
                    out.writeInt(0);
                }
                current = current.next;
            }
        } else {
            out.writeInt(0);
        }
    } else {
        out.writeInt(0);
    }
}