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.taverna.server.master.common.Workflow.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    try {//from  w ww  . j av  a  2s.c  o m
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OutputStreamWriter w = new OutputStreamWriter(new DeflaterOutputStream(baos), ENCODING);
        marshaller.marshal(this, w);
        w.close();
        byte[] bytes = baos.toByteArray();
        out.writeInt(bytes.length);
        out.write(bytes);
    } catch (JAXBException e) {
        throw new IOException("failed to marshal", e);
    }
}

From source file:xbird.xquery.expr.func.FunctionCall.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(_type);//ww  w.  j  av  a2  s.  com
    _funcName.writeExternal(out);
    final List<XQExpression> params = _params;
    final int numParams = params.size();
    out.writeInt(numParams);
    for (XQExpression e : params) {
        out.writeObject(e);
    }
}

From source file:BasicUUID.java

/**
 * Write this out.//  w w w .ja  v  a 2 s.c  om
 * 
 * @exception IOException
 *              error writing to log stream
 */
public void writeExternal(ObjectOutput out) throws IOException {
    // RESOLVE: write out the byte array instead?
    out.writeLong(majorId);
    out.writeLong(timemillis);
    out.writeInt(sequence);
}

From source file:xbird.engine.remote.RemoteFocus.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(_proxy);//from  w ww . j a  va 2 s .c  o  m
    out.writeInt(_fetchSize);
    out.writeFloat(_fetchGrow);
    out.writeInt(_fetchWatermark);
    out.writeObject(_fetchMethod);
}

From source file:BinaryHeapQueue.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(comparator);//from w  w w.j av a 2s  . c  o  m
    out.writeObject(elements);
    out.writeInt(size);
}

From source file:com.redhat.red.build.koji.model.xmlrpc.KojiBuildInfo.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(VERSION);
    out.writeInt(id);//  w  ww  .j a  v a 2  s. c  o  m
    out.writeInt(packageId);
    ExternalizableUtils.writeUTF(out, name);
    ExternalizableUtils.writeUTF(out, version);
    ExternalizableUtils.writeUTF(out, release);
    out.writeObject(completionTime);
    out.writeObject(creationTime);
    ExternalizableUtils.writeUTF(out, nvr);
    out.writeObject(taskId);
    out.writeObject(ownerId);
    ExternalizableUtils.writeUTF(out, ownerName);
    out.writeObject(buildState);
    out.writeObject(creationEventId);
    ExternalizableUtils.writeUTF(out, mavenGroupId);
    ExternalizableUtils.writeUTF(out, mavenArtifactId);
    ExternalizableUtils.writeUTF(out, mavenVersion);
    ExternalizableUtils.writeUTF(out, platform);
    out.writeObject(extra);
    ExternalizableUtils.writeUTF(out, source);
    // XXX: This has @JsonIgnore
    out.writeObject(typeNames);
    ExternalizableUtils.writeUTF(out, volumeName);
}

From source file:com.splicemachine.orc.predicate.SpliceORCPredicate.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    ArrayUtil.writeIntArray(out, baseColumnMap);
    out.writeBoolean(qualifiers != null);
    if (qualifiers != null) {
        out.writeInt(qualifiers.length);
        out.writeInt(qualifiers[0].length);
        for (int i = 0; i < qualifiers[0].length; i++) {
            out.writeObject(qualifiers[0][i]);
        }//from   ww  w .jav  a 2 s.  c  o  m
        for (int and_idx = 1; and_idx < qualifiers.length; and_idx++) {
            out.writeInt(qualifiers[and_idx].length);
            for (int or_idx = 0; or_idx < qualifiers[and_idx].length; or_idx++) {
                out.writeObject(qualifiers[and_idx][or_idx]);
            }
        }
    }
    out.writeObject(structType.json());
}

From source file:org.openspaces.remoting.ExecutorRemotingTask.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(lookupName);/*ww  w.j  a va2  s  . c  om*/
    out.writeUTF(methodName);
    if (arguments == null) {
        out.writeInt(0);
    } else {
        out.writeInt(arguments.length);
        for (Object arg : arguments) {
            out.writeObject(arg);
        }
    }
    if (metaArguments == null) {
        out.writeInt(0);
    } else {
        out.writeInt(metaArguments.length);
        for (Object arg : metaArguments) {
            out.writeObject(arg);
        }
    }

    methodHash.writeExternal(out);
}

From source file:hivemall.fm.FFMPredictionModel.java

@Override
public void writeExternal(@Nonnull ObjectOutput out) throws IOException {
    out.writeDouble(_w0);/*from   w  w  w  .  j a v  a2  s.  co m*/
    final int factors = _factors;
    out.writeInt(factors);
    out.writeInt(_numFeatures);
    out.writeInt(_numFields);

    int used = _map.size();
    out.writeInt(used);

    final int[] keys = _map.getKeys();
    final int size = keys.length;
    out.writeInt(size);

    final byte[] states = _map.getStates();
    writeStates(states, out);

    final long[] values = _map.getValues();

    final HeapBuffer buf = _buf;
    final Entry e = new Entry(buf, factors);
    final float[] Vf = new float[factors];
    for (int i = 0; i < size; i++) {
        if (states[i] != IntOpenHashTable.FULL) {
            continue;
        }
        ZigZagLEB128Codec.writeSignedInt(keys[i], out);
        e.setOffset(values[i]);
        writeEntry(e, factors, Vf, out);
    }

    // help GC
    this._map = null;
    this._buf = null;
}

From source file:gridool.db.DBInsertOperation.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    IOUtils.writeString(createTableDDL, out);
    IOUtils.writeString(tableName, out);
    final String[] fn = fieldNames;
    final int numFields = (fn == null) ? 0 : fn.length;
    out.writeInt(numFields);
    for (int i = 0; i < numFields; i++) {
        IOUtils.writeString(fn[i], out);
    }// w ww. ja v a2 s .  c o m
    final DBRecord[] r = records;
    final int numRecords = r.length;
    out.writeInt(numRecords);
    for (int i = 0; i < numRecords; i++) {
        out.writeObject(r[i]);
    }
}