Example usage for java.io ObjectOutput writeInt

List of usage examples for java.io ObjectOutput writeInt

Introduction

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

Prototype

void writeInt(int v) throws IOException;

Source Link

Document

Writes an int value, which is comprised of four bytes, to the output stream.

Usage

From source file:org.knime.al.util.noveltydetection.kernel.KernelCalculator.java

@Override
public void writeExternal(final ObjectOutput out) throws IOException {
    // write kernelFunction
    out.writeUTF(m_kernelFunction.getClass().getName());
    m_kernelFunction.writeExternal(out);

    // write trainingData
    // rows//  w  w  w  .ja  va 2  s.com
    out.writeInt(m_rowCount);
    // columns
    out.writeInt(m_colCount);
    // data
    for (final double[] row : m_trainingData) {
        for (final double col : row) {
            out.writeDouble(col);
        }
    }

}

From source file:org.apache.shindig.gadgets.http.HttpResponse.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(httpStatusCode);
    // Write out multimap as a map (see above)
    Map<String, List<String>> map = Maps.newHashMap();
    for (String key : headers.keySet()) {
        map.put(key, Lists.newArrayList(headers.get(key)));
    }/*ww  w. ja v a  2  s .  co  m*/
    out.writeObject(Maps.newHashMap(map));
    out.writeInt(responseBytes.length);
    out.write(responseBytes);
}

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

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    try {//from ww w  .  jav a  2  s .co m
        out.writeLong(heapConglom);
        out.writeBoolean(operationContext != null);
        if (operationContext != null)
            out.writeObject(operationContext);
        SIDriver.driver().getOperationFactory().writeTxn(txn, out);
        ArrayUtil.writeIntArray(out, pkCols);
        out.writeUTF(tableVersion);
        out.writeObject(execRowDefinition);
        out.writeInt(autoIncrementRowLocationArray.length);
        for (int i = 0; i < autoIncrementRowLocationArray.length; i++)
            out.writeObject(autoIncrementRowLocationArray[i]);
        out.writeInt(spliceSequences.length);
        for (int i = 0; i < spliceSequences.length; i++) {
            out.writeObject(spliceSequences[i]);
        }
        out.writeLong(heapConglom);
        out.writeInt(tentativeIndices.size());
        for (DDLMessage.TentativeIndex ti : tentativeIndices) {
            byte[] message = ti.toByteArray();
            out.writeInt(message.length);
            out.write(message);
        }
    } catch (Exception e) {
        throw new IOException(e);
    }

}

From source file:com.splicemachine.derby.stream.output.insert.InsertTableWriterBuilder.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    try {/*from  w w  w  .j ava  2  s .com*/
        out.writeBoolean(isUpsert);
        out.writeBoolean(operationContext != null);
        if (operationContext != null)
            out.writeObject(operationContext);
        SIDriver.driver().getOperationFactory().writeTxn(txn, out);
        ArrayUtil.writeIntArray(out, pkCols);
        out.writeUTF(tableVersion);
        ArrayUtil.writeIntArray(out, execRowTypeFormatIds);
        out.writeObject(execRowDefinition);
        out.writeInt(autoIncrementRowLocationArray.length);
        for (int i = 0; i < autoIncrementRowLocationArray.length; i++)
            out.writeObject(autoIncrementRowLocationArray[i]);
        out.writeInt(spliceSequences.length);
        for (int i = 0; i < spliceSequences.length; i++) {
            out.writeObject(spliceSequences[i]);
        }
        out.writeLong(heapConglom);
    } catch (Exception e) {
        throw new IOException(e);
    }

}

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);

    if ((nullMask & NAME) == 0)
        out.writeUTF(getName());//from  w  ww. j a  v  a 2 s. com

    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:TransferableScribblePane.java

/**
 * The following two methods implement the Externalizable interface. We use
 * Externalizable instead of Seralizable so we have full control over the data
 * format, and only write out the defined coordinates
 *//*from  w  w  w. ja  v  a2  s . c  o m*/
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
    out.writeFloat(x0);
    out.writeFloat(y0);
    out.writeInt(numsegs);
    for (int i = 0; i < numsegs * 2; i++)
        out.writeFloat(coords[i]);
}

From source file:com.conwet.silbops.model.Subscription.java

@Override
public void writeExternal(ObjectOutput output) throws IOException {

    output.writeObject(id);/*from   ww  w .  ja  va  2 s  .c  om*/
    output.writeObject(contextFunction);

    // write the attributes size
    output.writeInt(constraints.size());

    for (Entry<Attribute, Set<Constraint>> entry : constraints.entrySet()) {

        // write the attribute
        Attribute attribute = entry.getKey();
        attributeExt.writeExternal(output, attribute);

        // write constraints size and their values
        Set<Constraint> constrSet = entry.getValue();
        output.writeInt(constrSet.size());

        for (Constraint constraint : constrSet) {

            constraintExt.writeExternal(output, constraint);
        }
    }
}

From source file:org.apache.openjpa.datacache.QueryKey.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(_candidateClassName);
    out.writeBoolean(_subclasses);/*from w ww  .  ja v a  2 s . c  o  m*/
    out.writeObject(_accessPathClassNames);
    out.writeObject(_query);
    out.writeBoolean(_ignoreChanges);
    out.writeObject(_params);
    out.writeLong(_rangeStart);
    out.writeLong(_rangeEnd);
    out.writeInt(_timeout);
}

From source file:com.inmobi.grill.driver.hive.HiveDriver.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    // Write the query handle to hive handle map to output
    synchronized (hiveHandles) {
        out.writeInt(hiveHandles.size());
        for (Map.Entry<QueryHandle, OperationHandle> entry : hiveHandles.entrySet()) {
            out.writeObject(entry.getKey());
            out.writeObject(entry.getValue().toTOperationHandle());
            LOG.debug("Hive driver persisted " + entry.getKey() + ":" + entry.getValue());
        }/*from   w ww.  j  av  a2s .  co  m*/
        LOG.info("HiveDriver persisted " + hiveHandles.size() + " queries");
        out.writeInt(grillToHiveSession.size());
        for (Map.Entry<String, SessionHandle> entry : grillToHiveSession.entrySet()) {
            out.writeUTF(entry.getKey());
            out.writeObject(entry.getValue().toTSessionHandle());
        }
        LOG.info("HiveDriver persisted " + grillToHiveSession.size() + " sessions");
    }
}

From source file:com.openbravo.pos.ticket.TicketInfo.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(m_sId);/* www .  jav a 2 s. c o m*/
    out.writeInt(tickettype);
    out.writeInt(m_iTicketId);
    out.writeObject(m_Customer);
    out.writeObject(m_dDate);
    out.writeObject(attributes);
    out.writeObject(m_aLines);

    out.writeInt(ticketstatus);
}