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:org.apache.axis2.context.MessageContext.java

/**
 * Calls the serializeSelfManagedData() method of each handler that
 * implements the <bold>SelfManagedDataManager</bold> interface.
 * Handlers for this message context are identified via the
 * executionChain list.//from   w ww .j  av a2 s.c o  m
 *
 * @param out The output stream
 */
private void serializeSelfManagedData(ObjectOutput out) {
    selfManagedDataHandlerCount = 0;

    try {
        if ((selfManagedDataMap == null) || (executionChain == null) || (selfManagedDataMap.size() == 0)
                || (executionChain.size() == 0)) {
            out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);

            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(getLogIDString() + ":serializeSelfManagedData(): No data : END");
            }

            return;
        }

        // let's create a temporary list with the handlers
        ArrayList<Handler> flatExecChain = flattenPhaseListToHandlers(executionChain, null);

        //ArrayList selfManagedDataHolderList = serializeSelfManagedDataHelper(flatExecChain.iterator(), new ArrayList());
        ArrayList<SelfManagedDataHolder> selfManagedDataHolderList = serializeSelfManagedDataHelper(
                flatExecChain);

        if (selfManagedDataHolderList.size() == 0) {
            out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);

            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(getLogIDString() + ":serializeSelfManagedData(): No data : END");
            }

            return;
        }

        out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);

        // SelfManagedData can be binary so won't be able to treat it as a
        // string - need to treat it as a byte []

        // how many handlers actually
        // returned serialized SelfManagedData
        out.writeInt(selfManagedDataHolderList.size());

        for (int i = 0; i < selfManagedDataHolderList.size(); i++) {
            out.writeObject(selfManagedDataHolderList.get(i));
        }

    } catch (IOException e) {
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace("MessageContext:serializeSelfManagedData(): Exception [" + e.getClass().getName()
                    + "]  description [" + e.getMessage() + "]", e);
        }
    }

}

From source file:org.apache.lens.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 2  s .c  om*/
        LensDriver driver = null;
        for (Map.Entry<String, LensDriver> driverEntry : drivers.entrySet()) {
            driver = driverEntry.getValue();
            synchronized (driver) {
                out.writeUTF(driverEntry.getKey());
                out.writeUTF(driver.getClass().getName());
                driver.writeExternal(out);
            }
        }
    }
    // persist allQueries
    synchronized (allQueries) {
        out.writeInt(allQueries.size());
        for (QueryContext ctx : allQueries.values()) {
            synchronized (ctx) {
                out.writeObject(ctx);
                boolean isDriverAvailable = (ctx.getSelectedDriver() != null);
                out.writeBoolean(isDriverAvailable);
                if (isDriverAvailable) {
                    out.writeUTF(ctx.getSelectedDriver().getFullyQualifiedName());
                }
            }
        }
        log.info("Persisted {} queries", allQueries.size());
    }
}

From source file:com.sentaroh.android.SMBExplorer.SMBExplorerMain.java

@Override
public void writeExternal(ObjectOutput objout) throws IOException {
    //      Log.v("","wr");
    objout.writeLong(serialVersionUID);/*from ww w  .  j a  v a 2s . c o  m*/
    SerializeUtil.writeArrayList(objout, paste_list);
    SerializeUtil.writeUtf(objout, paste_from_url);
    SerializeUtil.writeUtf(objout, paste_to_url);
    SerializeUtil.writeUtf(objout, paste_item_list);

    objout.writeBoolean(is_paste_copy);
    objout.writeBoolean(is_paste_enabled);
    objout.writeBoolean(is_paste_from_local);

    SerializeUtil.writeArrayList(objout, local_dir_hist);
    SerializeUtil.writeArrayList(objout, remote_dir_hist);

    SerializeUtil.writeArrayList(objout, remote_file_list_cache);
    objout.writeObject(remote_curr_file_list);
    SerializeUtil.writeArrayList(objout, local_file_list_cache);
    objout.writeObject(local_curr_file_list);
    vsa.writeExternal(objout);
    objout.writeUTF(dialog_msg_cat);

    SerializeUtil.writeUtf(objout, remoteBase);
    SerializeUtil.writeUtf(objout, localBase);
    SerializeUtil.writeUtf(objout, remoteDir);
    SerializeUtil.writeUtf(objout, localDir);
    SerializeUtil.writeUtf(objout, currentTabName);
    SerializeUtil.writeUtf(objout, smbUser);
    SerializeUtil.writeUtf(objout, smbPass);

    objout.writeBoolean(localUpButtonEnabled);
    objout.writeBoolean(localTopButtonEnabled);
    objout.writeBoolean(remoteUpButtonEnabled);
    objout.writeBoolean(remoteTopButtonEnabled);
}