java.io.ObjectOutput#writeInt ( )源码实例Demo

下面列出了java.io.ObjectOutput#writeInt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: astor   文件: DormandPrince853StepInterpolator.java
/** {@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);

}
 
源代码2 项目: astor   文件: DormandPrince853StepInterpolator.java
/** {@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);

}
 
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 );
}
 
源代码4 项目: spliceengine   文件: RowMultiSetImpl.java
/**
 * <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 ] ); }
}
 
源代码5 项目: gemfirexd-oss   文件: TriggerDescriptor.java
/**
 * 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);
}
 
源代码6 项目: openjdk-8   文件: TCPEndpoint.java
/**
 * 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);
    }
}
 
源代码7 项目: ignite   文件: VisorServiceDescriptor.java
/** {@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);
}
 
源代码8 项目: simple-spring-memcached   文件: AppUser.java
@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);
}
 
源代码9 项目: openjdk-jdk9   文件: TCPEndpoint.java
/**
 * 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);
    }
}
 
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);
       } 
}
 
@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]);
    }
}
 
源代码12 项目: ignite   文件: HadoopDefaultJobInfo.java
/** {@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);
}
 
源代码13 项目: JOML   文件: Matrix3dStack.java
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeInt(curr);
    for (int i = 0; i < curr; i++) {
        out.writeObject(mats[i]);
    }
}
 
源代码14 项目: gemfirexd-oss   文件: Marshaller.java
/**
 * 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());
    }
}
 
源代码15 项目: astor   文件: AbstractStepInterpolator.java
/** 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);
  }

}
 
源代码16 项目: kogito-runtimes   文件: DefaultBetaConstraints.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(constraints);
    out.writeInt(indexed);
    out.writeObject(indexPrecedenceOption);
}
 
源代码17 项目: astor   文件: AbstractStepInterpolator.java
/** 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;
  }

}
 
源代码18 项目: unitime   文件: XCourseRequestSet.java
@Override
public void writeExternal(ObjectOutput out) throws IOException {
	out.writeInt(size());
	for (XCourseRequest request: this)
		request.writeExternal(out);
}
 
源代码19 项目: ignite   文件: IgniteWalReaderTest.java
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(iVal);
}
 
源代码20 项目: spliceengine   文件: InsertOperation.java
@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);
}