下面列出了java.io.ObjectOutput#writeInt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** {@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);
}
/** {@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 );
}
/**
* <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 ] ); }
}
/**
* 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);
}
/**
* 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);
}
}
/** {@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);
}
@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);
}
/**
* 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]);
}
}
/** {@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);
}
public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
out.writeInt(curr);
for (int i = 0; i < curr; i++) {
out.writeObject(mats[i]);
}
}
/**
* 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());
}
}
/** 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);
}
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(constraints);
out.writeInt(indexed);
out.writeObject(indexPrecedenceOption);
}
/** 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;
}
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(size());
for (XCourseRequest request: this)
request.writeExternal(out);
}
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(iVal);
}
@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);
}