Example usage for java.io ObjectOutput writeObject

List of usage examples for java.io ObjectOutput writeObject

Introduction

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

Prototype

public void writeObject(Object obj) throws IOException;

Source Link

Document

Write an object to the underlying storage or stream.

Usage

From source file:de.pro.dbw.file.reflection.api.ReflectionCommentModel.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(this.getId());
    out.writeLong(this.getGenerationTime());
    out.writeObject(this.getText());
}

From source file:gridool.routing.strategy.ConsistentHash.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(hashFunction);
    out.writeInt(numberOfVirtualNodes);/*from   www. j av a2s .  co  m*/
    final GridNode[] nodes = getAll();
    out.writeInt(nodes.length);
    for (GridNode node : nodes) {
        out.writeObject(node);
    }
    int numRemoved = removedNodes.size();
    out.writeInt(numRemoved);
    for (GridNode node : removedNodes.values()) {
        out.writeObject(node);
    }
}

From source file:com.aol.advertising.qiao.util.cache.PersistentValueWrapper.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    //System.out.println("<writeExternal> " + this.toString()); //TODO: remove
    super.writeExternal(out);
    out.writeLong(this.expirationTime);
    out.writeObject(key);
}

From source file:com.splicemachine.derby.stream.output.update.UpdateTableWriterBuilder.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(operationContext != null);
    if (operationContext != null)
        out.writeObject(operationContext);
    out.writeLong(heapConglom);//from  w  w w  .  j a v a2  s  .com
    ArrayUtil.writeIntArray(out, formatIds);
    ArrayUtil.writeIntArray(out, columnOrdering);
    ArrayUtil.writeIntArray(out, pkCols);
    out.writeObject(pkColumns);
    out.writeObject(heapList);
    out.writeUTF(tableVersion);
    SIDriver.driver().getOperationFactory().writeTxn(txn, out);
    ArrayUtil.writeIntArray(out, execRowTypeFormatIds);
}

From source file:de.pro.dbw.file.tipofthenight.api.TipOfTheNightModel.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(this.getId());
    out.writeLong(this.getGenerationTime());
    out.writeObject(this.getText());
    out.writeObject(this.getTitle());
}

From source file:xbird.xquery.misc.BasicStringChunk.java

public void writeExternal(final ObjectOutput out) throws IOException {
    out.writeObject(_strPool);
    out.writeObject(_cchunks);//  w  w  w  . j  a va2 s . c  om
    out.writeLong(_cpointer);
}

From source file:org.ejbca.core.model.approval.approvalrequests.EditEndEntityApprovalRequest.java

public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeInt(LATEST_VERSION);/*from   w w  w . ja  va  2s  .c om*/
    out.writeObject(newuserdata);
    out.writeBoolean(clearpwd);
    out.writeObject(orguserdata);
}

From source file:com.github.naoghuman.cm.model.matrix.MatrixModel.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(this.getId());
    out.writeLong(this.getGenerationTime());
    out.writeObject(StringEscapeUtils.escapeHtml4(this.getTitle()));
    out.writeObject(StringEscapeUtils.escapeHtml4(this.getDescription()));
}

From source file:com.splicemachine.derby.stream.output.delete.DeleteTableWriterBuilder.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(heapConglom);/*from   w w  w  .j  a  v  a2 s.  c  o  m*/
    SIDriver.driver().getOperationFactory().writeTxn(txn, out);
    out.writeBoolean(operationContext != null);
    if (operationContext != null)
        out.writeObject(operationContext);
}

From source file:org.jfree.data.xy.junit.DefaultXYDatasetTest.java

/**
 * Serialize an instance, restore it, and check for equality.
 *///from w  w  w. j  ava2 s.c  o  m
public void testSerialization() {

    DefaultXYDataset d1 = new DefaultXYDataset();
    DefaultXYDataset d2 = null;

    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(d1);
        out.close();

        ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
        d2 = (DefaultXYDataset) in.readObject();
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(d1, d2);

    // try a dataset with some content...
    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[][] data1 = new double[][] { x1, y1 };
    d1.addSeries("S1", data1);
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(d1);
        out.close();

        ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
        d2 = (DefaultXYDataset) in.readObject();
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(d1, d2);

}