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

The following examples show how to use java.io.ObjectOutput#writeInt() . 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: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  try {
    // save the local attributes
    finalizeStep();
  } catch (MathUserException e) {
      IOException ioe = new IOException(e.getLocalizedMessage());
      ioe.initCause(e);
      throw ioe;
  }
  final int dimension = (currentState == null) ? -1 : currentState.length;
  out.writeInt(dimension);
  for (int i = 0; i < dimension; ++i) {
    out.writeDouble(yDotKLast[0][i]);
    out.writeDouble(yDotKLast[1][i]);
    out.writeDouble(yDotKLast[2][i]);
  }

  // save the state of the base class
  super.writeExternal(out);

}
 
Example 2
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
  throws IOException {

  try {
    // save the local attributes
    finalizeStep();
  } catch (DerivativeException e) {
    throw MathRuntimeException.createIOException(e);
  }
  final int dimension = (currentState == null) ? -1 : currentState.length;
  out.writeInt(dimension);
  for (int i = 0; i < dimension; ++i) {
    out.writeDouble(yDotKLast[0][i]);
    out.writeDouble(yDotKLast[1][i]);
    out.writeDouble(yDotKLast[2][i]);
  }

  // save the state of the base class
  super.writeExternal(out);

}
 
Example 3
Source File: CompositeObjectSinkAdapter.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt( index );
    out.writeByte( type );
    out.writeObject( ovalue );
    out.writeLong( lvalue );
    out.writeBoolean( bvalue );
    out.writeDouble( dvalue );
    out.writeBoolean( isNull );
    out.writeInt( hashCode );
}
 
Example 4
Source File: AbstractStepInterpolator.java    From astor with GNU General Public License v2.0 5 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(previousTime);
  out.writeDouble(currentTime);
  out.writeDouble(h);
  out.writeBoolean(forward);

  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

  // finalize the step (and don't bother saving the now true flag)
  try {
    finalizeStep();
  } catch (DerivativeException e) {
    throw MathRuntimeException.createIOException(e);
  }

}
 
Example 5
Source File: Marshaller.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Writes an object to the ObjectOutput stream.
 * If possible, we will send over a magic number instead of the class name
 * so that we transfer less amount of data.
 * @param inst - an object instance to be serialized, can not be null
 * @param out - the ObjectOutput stream we will write the serialized data to
 */
public static void write(Externalizable inst, ObjectOutput out) throws IOException {
    boolean is_null=(inst == null);
    try {
        // if inst is a null value we write this first
        out.writeBoolean(is_null);
        if(is_null)
            return;

        //find out if we have a magic number for this class
        int magic=mConfigurator.getMagicNumber(inst.getClass());
        //-1 means no magic number otherwise we have one
        if(magic != -1) {
            //true means we use a magic number
            out.writeBoolean(true);
            //write the magic number
            out.writeInt(magic);
        }
        else {
            //we don't have a magic number
            out.writeBoolean(false);
            //write the classname instead
            out.writeUTF(inst.getClass().getName());
        }//end if
        //write the object data
        inst.writeExternal(out);
    }
    catch(Exception x) {
        if(x instanceof IOException)
            throw (IOException)x;
        else
            throw new java.io.IOException(x.toString());
    }
}
 
Example 6
Source File: Matrix3dStack.java    From JOML with MIT License 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeInt(curr);
    for (int i = 0; i < curr; i++) {
        out.writeObject(mats[i]);
    }
}
 
Example 7
Source File: HadoopDefaultJobInfo.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    U.writeString(out, jobName);
    U.writeString(out, user);

    out.writeBoolean(hasCombiner);
    out.writeInt(numReduces);

    IgfsUtils.writeStringMap(out, props);

    U.writeByteArray(out, credentials);
}
 
Example 8
Source File: DistributedCreateExternalTableJob.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 {
    int length = partitionBy.length;
    out.writeInt(length);
    for(int i =0;i<length;i++){
        out.writeInt(partitionBy[i]);
    }

    out.writeBoolean(delimited!=null);
    if (delimited!=null)
        out.writeUTF(delimited);

    out.writeBoolean(escaped!=null);
    if (escaped!=null)
        out.writeUTF(escaped);

    out.writeBoolean(lines!=null);
    if (lines!=null)
        out.writeUTF(lines);

    out.writeBoolean(storedAs!=null);
    if (storedAs!=null)
        out.writeUTF(storedAs);

    out.writeBoolean(location!=null);
    if (location!=null)
        out.writeUTF(location);

    out.writeBoolean(compression!=null);
    if (compression!=null)
        out.writeUTF(compression);

    out.writeUTF(jobGroup);
    out.writeInt(columnInfo.length);
    for(int i = 0; i < columnInfo.length; ++i) {
        out.writeObject(columnInfo[i]);
    }
}
 
Example 9
Source File: ReferencedColumnsDescriptorImpl.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
private void writeReferencedColumns(ObjectOutput out) throws IOException 
{ 
   	//trigger is defined on select columns. Write info about those columns
       out.writeInt( referencedColumns.length );
       for (int referencedColumn : referencedColumns) {
           out.writeInt(referencedColumn);
       } 
}
 
Example 10
Source File: TCPEndpoint.java    From openjdk-jdk9 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 11
Source File: AppUser.java    From simple-spring-memcached with MIT License 5 votes vote down vote up
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
    out.writeInt(CLASS_VERSION);
    out.writeInt(userId);
    out.writeInt(applicationId);
    out.writeBoolean(enabled);
    out.writeInt(version);
}
 
Example 12
Source File: VisorServiceDescriptor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
    U.writeString(out, name);
    U.writeString(out, srvcCls);
    out.writeInt(totalCnt);
    out.writeInt(maxPerNodeCnt);
    U.writeString(out, cacheName);
    U.writeUuid(out, originNodeId);
    U.writeMap(out, topSnapshot);
}
 
Example 13
Source File: TCPEndpoint.java    From openjdk-8 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 14
Source File: TriggerDescriptor.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Write this object to a stream of stored objects.
 *
 * @param out write bytes here.
 *
 * @exception IOException		thrown on error
 */
public void writeExternal( ObjectOutput out )
	 throws IOException
{
	if (SanityManager.DEBUG)
	{
		SanityManager.ASSERT(triggerSchemaId != null,
			"triggerSchemaId expected to be non-null");
		SanityManager.ASSERT(triggerTableId != null,
			"triggerTableId expected to be non-null");
	}
	out.writeObject(id);
	out.writeObject(name);
	out.writeObject(triggerSchemaId);
	out.writeObject(triggerTableId);
	out.writeInt(eventMask);
	out.writeBoolean(isBefore);
	out.writeBoolean(isRow);
	out.writeBoolean(isEnabled);
	out.writeObject(whenSPSId);
	out.writeObject(actionSPSId);
	if (referencedCols == null)
	{
		out.writeInt(0);
	}
	else
	{
		out.writeInt(referencedCols.length);
		for (int i = 0; i < referencedCols.length; i++)
		{
			out.writeInt(referencedCols[i]);
		}
	}	
	out.writeObject(triggerDefinition);
	out.writeBoolean(referencingOld);
	out.writeBoolean(referencingNew);
	out.writeObject(oldReferencingName);
	out.writeObject(newReferencingName);
}
 
Example 15
Source File: RowMultiSetImpl.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * <p>
 * Write ourself to a formatable stream.
 * </p>
 */
public  void writeExternal( ObjectOutput out )
    throws IOException
{
    int     count = _columnNames.length;

    out.writeInt( count );

    for (String _columnName : _columnNames) {
        out.writeUTF(_columnName);
    }
    for ( int i = 0; i < count; i++ ) { out.writeObject( _types[ i ] ); }
}
 
Example 16
Source File: XCourseRequestSet.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
	out.writeInt(size());
	for (XCourseRequest request: this)
		request.writeExternal(out);
}
 
Example 17
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 18
Source File: IgniteWalReaderTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(iVal);
}
 
Example 19
Source File: DefaultBetaConstraints.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(constraints);
    out.writeInt(indexed);
    out.writeObject(indexPrecedenceOption);
}
 
Example 20
Source File: InsertOperation.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{
    super.writeExternal(out);
    int length=autoIncrementRowLocationArray.length;
    out.writeInt(length);
    for(int i=0;i<length;i++){
        out.writeObject(autoIncrementRowLocationArray[i]);
    }
    out.writeUTF(insertMode.toString());
    out.writeBoolean(statusDirectory!=null);
    if(statusDirectory!=null)
        out.writeUTF(statusDirectory);
    out.writeInt(failBadRecordCount);
    out.writeBoolean(delimited!=null);
    if (delimited!=null)
        out.writeUTF(delimited);
    out.writeBoolean(escaped!=null);
    if (escaped!=null)
        out.writeUTF(escaped);
    out.writeBoolean(lines!=null);
    if (lines!=null)
        out.writeUTF(lines);
    out.writeBoolean(storedAs!=null);
    if (storedAs!=null)
        out.writeUTF(storedAs);
    out.writeBoolean(location!=null);
    if (location!=null)
        out.writeUTF(location);
    out.writeBoolean(compression!=null);
    if (compression!=null)
        out.writeUTF(compression);
    out.writeBoolean(bulkImportDirectory!=null);
    if (bulkImportDirectory!=null)
        out.writeUTF(bulkImportDirectory);
    out.writeBoolean(skipConflictDetection);
    out.writeBoolean(skipWAL);
    out.writeBoolean(samplingOnly);
    out.writeBoolean(outputKeysOnly);
    out.writeBoolean(skipSampling);
    out.writeBoolean(indexName != null);
    if (indexName != null)
        out.writeUTF(indexName);
    out.writeInt(partitionByRefItem);
    out.writeDouble(sampleFraction);
}