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.externalize.MessageExternalizeUtils.java

/**
 * Write out the Message/* w ww.  j a  v  a 2 s  .  c om*/
 * @param out
 * @param mc
 * @param correlationIDString
 * @param outputFormat
 * @throws IOException
 */
public static void writeExternal(ObjectOutput out, MessageContext mc, String correlationIDString,
        OMOutputFormat outputFormat) throws IOException {
    if (log.isDebugEnabled()) {
        log.debug(correlationIDString + ":writeExternal(): start");
    }
    SOAPEnvelope envelope = mc.getEnvelope();
    if (envelope == null) {
        // Case: No envelope
        out.writeUTF("NULL_ENVELOPE");
        out.writeInt(revisionID);
        out.writeBoolean(EMPTY_OBJECT); // Not Active
        out.writeInt(0); // EndBlocks
        if (log.isDebugEnabled()) {
            log.debug(correlationIDString + ":writeExternal(): end: msg is Empty");
        }
        return;
    }

    // Write Prolog
    String msgClass = envelope.getClass().getName();
    out.writeUTF(msgClass);
    out.writeInt(revisionID);
    out.writeBoolean(ACTIVE_OBJECT);
    if (outputFormat.isOptimized()) {
        out.writeBoolean(true);
        // Write out the contentType.
        out.writeUTF(outputFormat.getContentType());
    } else {
        out.writeBoolean(false);
    }
    out.writeUTF(outputFormat.getCharSetEncoding());
    out.writeUTF(envelope.getNamespace().getNamespaceURI());
    if (log.isDebugEnabled()) {
        log.debug(correlationIDString + ":writeExternal(): " + "optimized=[" + outputFormat.isOptimized()
                + "]  " + "optimizedContentType " + outputFormat.getContentType() + "]  " + "charSetEnc=["
                + outputFormat.getCharSetEncoding() + "]  " + "namespaceURI=["
                + envelope.getNamespace().getNamespaceURI() + "]");
    }

    // Write DataBlocks
    // MessageOutputStream writes out the DataBlocks in chunks
    // BufferedOutputStream buffers the data to prevent numerous, small blocks
    MessageOutputStream mos = new MessageOutputStream(out);
    BufferedOutputStream bos = new BufferedOutputStream(mos);
    boolean errorOccurred = false;
    try {
        // Write out the message using the same logic as the 
        // transport layer.
        MessageFormatter msgFormatter = MessageProcessorSelector.getMessageFormatter(mc);
        msgFormatter.writeTo(mc, outputFormat, bos, true); // Preserve the original message

    } catch (IOException e) {
        throw e;
    } catch (Throwable t) {
        throw AxisFault.makeFault(t);
    } finally {
        bos.flush();
        bos.close();
    }

    // Write End of Data Blocks
    if (errorOccurred) {
        out.writeInt(-1);
    } else {
        out.writeInt(0);
    }
    if (log.isDebugEnabled()) {
        log.debug(correlationIDString + ":writeExternal(): end");
    }
}

From source file:MutableBoolean.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(value);
}

From source file:Clock.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(isDigital);
    out.writeObject(getBackground());//from w w w  . j  a  v a 2 s  . c o m
    out.writeObject(getForeground());
    out.writeObject(getPreferredSize());
}

From source file:org.hyperic.hq.transport.util.AsynchronousInvocationHandler.java

/**
 * Subclasses should only extend this method, never override it.
 * /*  ww w  . j  a v a  2 s. c  om*/
 * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
 */
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(_guaranteed);
}

From source file:com.enonic.cms.core.portal.instruction.PostProcessInstruction.java

protected void writeBoolean(ObjectOutput out, boolean value) throws IOException {
    out.writeBoolean(value);
}

From source file:com.splicemachine.derby.stream.function.TableScanQualifierFunction.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeBoolean(optionalProbeValue != null);
    if (optionalProbeValue != null)
        out.writeObject(optionalProbeValue);
}

From source file:com.splicemachine.derby.stream.function.MergeAllAggregatesFlatMapFunction.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeBoolean(returnDefault);
}

From source file:com.delphix.session.service.ServiceName.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);

    out.writeUTF(name);/*from  w  w  w. j a  v  a  2  s.com*/
    out.writeBoolean(ephemeral);
}

From source file:com.splicemachine.derby.stream.output.direct.DirectTableWriterBuilder.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(destConglomerate);//from   ww w  .  j a va 2  s. c  o  m
    out.writeObject(opCtx);
    out.writeBoolean(skipIndex);
    SIDriver.driver().getOperationFactory().writeTxn(txn, out);
}

From source file:com.talis.storage.s3.ExternalizableS3Object.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(getKey());//ww  w . j  a v  a 2s . c o  m
    out.writeUTF(getBucketName());
    out.writeObject(getAcl());
    out.writeBoolean(isMetadataComplete());
    out.writeObject(getMetadataMap());
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    try {
        IOUtils.copy(this.getDataInputStream(), buffer);
    } catch (S3ServiceException e) {
        LOG.error("Error copying entity stream", e);
        throw new IOException("Error serializing object", e);
    }
    out.writeInt(buffer.toByteArray().length);
    out.write(buffer.toByteArray());
}