Java Code Examples for java.io.ObjectOutput#writeObject()

The following examples show how to use java.io.ObjectOutput#writeObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VisorRestConfiguration.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
    out.writeBoolean(restEnabled);
    out.writeBoolean(tcpSslEnabled);
    U.writeString(out, jettyPath);
    U.writeString(out, jettyHost);
    out.writeObject(jettyPort);
    U.writeString(out, tcpHost);
    out.writeInt(tcpPort);
    U.writeString(out, tcpSslCtxFactory);
    U.writeString(out, secretKey);
    out.writeBoolean(noDelay);
    out.writeBoolean(directBuf);
    out.writeInt(sndBufSize);
    out.writeInt(rcvBufSize);
    out.writeLong(idleQryCurTimeout);
    out.writeLong(idleQryCurCheckFreq);
    out.writeInt(sndQueueLimit);
    out.writeInt(selectorCnt);
    out.writeLong(idleTimeout);
    out.writeBoolean(sslClientAuth);
    U.writeString(out, sslFactory);
    out.writeInt(portRange);
    U.writeString(out, msgInterceptor);
}
 
Example 2
Source File: PowerFunction2DTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    PowerFunction2D f1 = new PowerFunction2D(1.0, 2.0);
    PowerFunction2D f2 = null;

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

        ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(
                buffer.toByteArray()));
        f2 = (PowerFunction2D) in.readObject();
        in.close();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(f1, f2);
}
 
Example 3
Source File: MonthDateFormatTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    MonthDateFormat mf1 = new MonthDateFormat();
    MonthDateFormat mf2 = null;
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(mf1);
        out.close();

        ObjectInput in = new ObjectInputStream(
            new ByteArrayInputStream(buffer.toByteArray())
        );
        mf2 = (MonthDateFormat) in.readObject();
        in.close();
    }
    catch (Exception e) {
        fail(e.toString());
    }
    assertTrue(mf1.equals(mf2));
}
 
Example 4
Source File: ExplainOperation.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeInt(explainString.size());
    for (int i = 0; i < explainString.size(); ++i) {
        out.writeUTF(explainString.get(i));
    }
    out.writeUTF(sparkExplainKind.toString());
    if (!sparkExplainKind.equals(ExplainNode.SparkExplainKind.NONE))
        out.writeObject(source);
}
 
Example 5
Source File: FirstOrderIntegratorWithJacobians.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(interpolator);
    out.writeInt(y.length);
    out.writeInt(dydp[0].length);
    writeArray(out, y);
    writeArray(out, dydy0);
    writeArray(out, dydp);
    writeArray(out, yDot);
    writeArray(out, dydy0Dot);
    writeArray(out, dydpDot);
}
 
Example 6
Source File: ActivatableRef.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Write out external representation for remote ref.
 */
public void writeExternal(ObjectOutput out) throws IOException
{
    RemoteRef localRef = ref;

    out.writeObject(id);
    if (localRef == null) {
        out.writeUTF("");
    } else {
        out.writeUTF(localRef.getRefClass(out));
        localRef.writeExternal(out);
    }
}
 
Example 7
Source File: CertifiedDecision.java    From protect with MIT License 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {

		out.writeInt(pid);
		out.writeInt(cid);
		out.writeObject(decision);
		out.writeObject(consMsgs);
	}
 
Example 8
Source File: DiceRoll.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
  final int[] dice = new int[rolls.size()];
  for (int i = 0; i < rolls.size(); i++) {
    dice[i] = rolls.get(i).getCompressedValue();
  }
  out.writeObject(dice);
  out.writeInt(hits);
  out.writeDouble(expectedHits);
}
 
Example 9
Source File: MethodExpressionLiteral.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(this.expr);
    out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
            : "");
    out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
}
 
Example 10
Source File: PlatformJavaObjectFactoryProxy.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(factoryTyp);
    U.writeString(out, clsName);
    out.writeObject(payload);
    U.writeMap(out, props);
}
 
Example 11
Source File: TCPEndpoint.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Write endpoint to output stream.
 */
public void write(ObjectOutput out) throws IOException {
    if (csf == null) {
        out.writeByte(FORMAT_HOST_PORT);
        out.writeUTF(host);
        out.writeInt(port);
    } else {
        out.writeByte(FORMAT_HOST_PORT_FACTORY);
        out.writeUTF(host);
        out.writeInt(port);
        out.writeObject(csf);
    }
}
 
Example 12
Source File: PbcastHeader.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(type);
out.writeLong(seqno);
out.writeObject(gossip);
out.writeObject(xmit_reqs);
   }
 
Example 13
Source File: AbstractStepInterpolator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** Save the base state of the instance.
 * This method performs step finalization if it has not been done
 * before.
 * @param out stream where to save the state
 * @exception IOException in case of write error
 */
protected void writeBaseExternal(final ObjectOutput out)
  throws IOException {

  if (currentState == null) {
      out.writeInt(-1);
  } else {
      out.writeInt(currentState.length);
  }
  out.writeDouble(globalPreviousTime);
  out.writeDouble(globalCurrentTime);
  out.writeDouble(softPreviousTime);
  out.writeDouble(softCurrentTime);
  out.writeDouble(h);
  out.writeBoolean(forward);
  out.writeObject(primaryMapper);
  out.write(secondaryMappers.length);
  for (final EquationsMapper  mapper : secondaryMappers) {
      out.writeObject(mapper);
  }

  if (currentState != null) {
      for (int i = 0; i < currentState.length; ++i) {
          out.writeDouble(currentState[i]);
      }
  }

  out.writeDouble(interpolatedTime);

  // we do not store the interpolated state,
  // it will be recomputed as needed after reading

  try {
      // finalize the step (and don't bother saving the now true flag)
      finalizeStep();
  } catch (MaxCountExceededException mcee) {
      final IOException ioe = new IOException(mcee.getLocalizedMessage());
      ioe.initCause(mcee);
      throw ioe;
  }

}
 
Example 14
Source File: PlatformContinuousQueryRemoteFilter.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(filter);
}
 
Example 15
Source File: TimestampLessThanOperation.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException
{
    out.writeObject(this.getAttribute());
    TimestampAttribute timestampAttribute = (TimestampAttribute) this.getAttribute();
    timestampAttribute.writeToStream(out, (Timestamp)this.getParameter());
}
 
Example 16
Source File: TableScannerBuilder.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException{
        out.writeObject(template);
        writeScan(out);
        out.writeBoolean(rowColumnMap!=null);
        if(rowColumnMap!=null){
            out.writeInt(rowColumnMap.length);
            //noinspection ForLoopReplaceableByForEach
            for(int i=0;i<rowColumnMap.length;++i){
                out.writeInt(rowColumnMap[i]);
            }
        }
        writeTxn(out);
        ArrayUtil.writeByteArray(out, token);
        ArrayUtil.writeIntArray(out,keyColumnEncodingOrder);
        ArrayUtil.writeIntArray(out,partitionByColumns);

        out.writeBoolean(keyColumnSortOrder!=null);
        if(keyColumnSortOrder!=null){
            ArrayUtil.writeBooleanArray(out,keyColumnSortOrder);
        }
        ArrayUtil.writeIntArray(out,keyColumnTypes);
        out.writeBoolean(keyDecodingMap!=null);
        if(keyDecodingMap!=null){
            ArrayUtil.writeIntArray(out,keyDecodingMap);
        }
        out.writeBoolean(baseColumnMap!=null);
        if(baseColumnMap!=null){
            ArrayUtil.writeIntArray(out,baseColumnMap);
        }
        out.writeObject(accessedKeys);
        out.writeBoolean(reuseRowLocation);
        out.writeBoolean(oneSplitPerRegion);
        out.writeBoolean(indexName!=null);
        if(indexName!=null)
            out.writeUTF(indexName);
        out.writeBoolean(tableVersion!=null);
        if(tableVersion!=null)
            out.writeUTF(tableVersion);

        out.writeBoolean(fieldLengths!=null);
        if(fieldLengths!=null){
            out.writeInt(fieldLengths.length);
            //noinspection ForLoopReplaceableByForEach
            for(int i=0;i<fieldLengths.length;++i){
                out.writeInt(fieldLengths[i]);
            }
            out.writeInt(columnPositionMap.length);
            //noinspection ForLoopReplaceableByForEach
            for(int i=0;i<columnPositionMap.length;++i){
                out.writeInt(columnPositionMap[i]);
            }
            out.writeLong(baseTableConglomId);
        }
        out.writeLong(demarcationPoint);
        out.writeBoolean(optionalProbeValue !=null);
        if (optionalProbeValue!=null)
            out.writeObject(optionalProbeValue);
        out.writeBoolean(pin);
        writeNullableString(delimited,out);
        writeNullableString(escaped,out);
        writeNullableString(lines,out);
        writeNullableString(storedAs,out);
        writeNullableString(location,out);
        out.writeBoolean(useSample);
        out.writeDouble(sampleFraction);
        out.writeBoolean(defaultRow != null);
        if (defaultRow != null)
            out.writeObject(defaultRow);
        out.writeBoolean(defaultValueMap != null);
        if (defaultValueMap != null)
            out.writeObject(defaultValueMap);
        out.writeBoolean(ignoreRecentTransactions);
}
 
Example 17
Source File: ASTRealVector.java    From symja_android_library with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
	objectOutput.writeShort(fEvalFlags);
	objectOutput.writeObject(vector);
}
 
Example 18
Source File: NonPrimitiveNotInOperation.java    From reladomo with Apache License 2.0 4 votes vote down vote up
protected void writeParameter(ObjectOutput out, Object o) throws IOException
{
    out.writeObject(o);
}
 
Example 19
Source File: UserPhases.java    From butterfly with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(this.id);
    out.writeObject(this.user);
    out.writeInt(this.ddr16Phase);
}
 
Example 20
Source File: JNDIStorable.java    From activemq-artemis with Apache License 2.0 2 votes vote down vote up
/**
 * Method for class's implementing externalizable to delegate to if not custom implementing.
 *
 * @param out
 * @throws IOException
 * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
 */
public void writeObject(ObjectOutput out) throws IOException {
   out.writeObject(getProperties());
}