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

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

源代码1 项目: hacep   文件: HAKieSerializedSession.java
@Override
public void writeObject(ObjectOutput output, HAKieSerializedSession object) throws IOException {
    output.writeInt(object.getSessionSize());
    if (object.session != null) {
        output.write(object.session);
        output.writeUTF(object.version);
    }

    Fact[] fa = new Fact[object.buffer.size()];
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oo = new ObjectOutputStream(baos);

    oo.writeObject( object.buffer.toArray(fa) );
    byte[] ba = baos.toByteArray();
    output.writeInt( ba.length );
    output.write( ba );
}
 
源代码2 项目: kogito-runtimes   文件: BaseClassFieldReader.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt( index );
    out.writeObject( valueType );
    if (fieldType == null) {
        out.writeUTF( "" );
    } else {
        out.writeUTF( fieldType.getName() );
    }
}
 
源代码3 项目: org.openntf.domino   文件: DElementStore.java
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
	out.writeLong(delegateKey_);
	out.writeInt(getTypes().size());
	for (Class<?> clazz : getTypes()) {
		out.writeUTF(clazz.getName());
	}
}
 
源代码4 项目: openjdk-jdk8u   文件: 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);
    }
}
 
源代码5 项目: fitnotifications   文件: MeasureFormat.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(0); // version
    out.writeUTF(locale.toLanguageTag());
    out.writeByte(formatWidth.ordinal());
    out.writeObject(numberFormat);
    out.writeByte(subClass);
    out.writeObject(keyValues);
}
 
源代码6 项目: openjdk-jdk8u   文件: MimeType.java
/**
 * The object implements the writeExternal method to save its contents
 * by calling the methods of DataOutput for its primitive values or
 * calling the writeObject method of ObjectOutput for objects, strings
 * and arrays.
 * @exception IOException Includes any I/O exceptions that may occur
 */
public void writeExternal(ObjectOutput out) throws IOException {
    String s = toString(); // contains ASCII chars only
    // one-to-one correspondence between ASCII char and byte in UTF string
    if (s.length() <= 65535) { // 65535 is max length of UTF string
        out.writeUTF(s);
    } else {
        out.writeByte(0);
        out.writeByte(0);
        out.writeInt(s.length());
        out.write(s.getBytes());
    }
}
 
源代码7 项目: spliceengine   文件: DeleteTableWriterBuilder.java
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(heapConglom);
    out.writeLong(tempConglomID);
    out.writeUTF(tableVersion);
    SIDriver.driver().getOperationFactory().writeTxn(txn, out);
    out.writeBoolean(operationContext!=null);
    if (operationContext!=null)
        out.writeObject(operationContext);
    ArrayUtil.writeIntArray(out, updateCounts);
    out.writeObject(execRowDefinition);
}
 
源代码8 项目: opensim-gui   文件: MotionsDBDescriptor.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(serialVersionUID);
    out.writeInt(getModelFileNames().size());
    for (int i=0; i<getModelFileNames().size(); i++) {
        out.writeUTF(getModelFileNames().get(i));
        out.writeUTF(getMotionFileNames().get(i));
    }
}
 
源代码9 项目: hottub   文件: 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);
    }
}
 
源代码10 项目: org.openntf.domino   文件: NameODA.java
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
	super.writeExternal(out);
	out.writeInt(EXTERNALVERSIONUID);
	out.writeUTF(getCanonical());
	out.writeUTF(_language);
}
 
源代码11 项目: j2objc   文件: MeasureFormat.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(0); // version
    out.writeUTF(locale.toLanguageTag());
    out.writeByte(formatWidth.ordinal());
    out.writeObject(numberFormat);
    out.writeByte(subClass);
    out.writeObject(keyValues);
}
 
源代码12 项目: tomcatsrc   文件: ValueExpressionImpl.java
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(this.expr);
    out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
            : "");
    out.writeObject(this.fnMapper);
    out.writeObject(this.varMapper);
}
 
源代码13 项目: ignite   文件: Person.java
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(id);
    out.writeInt(orgId);
    out.writeUTF(firstName);
    out.writeUTF(lastName);
    out.writeDouble(salary);
}
 
源代码14 项目: components   文件: ConfigurableHDFSFileSource.java
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(split.getClass().getCanonicalName());
    ((Writable) split).write(out);
}
 
源代码15 项目: directory-ldap-api   文件: Value.java
/**
 * {@inheritDoc}
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    // Write a boolean for the HR flag
    out.writeBoolean( isHR );

    if ( isHR )
    { 
        // Write the value if any
        out.writeBoolean( upValue != null );

        if ( upValue != null )
        {
            // Write the value
            out.writeInt( bytes.length );

            if ( bytes.length > 0 )
            {
                out.write( bytes );
            }
        }

        // Write the prepared value if any
        out.writeBoolean( normValue != null );

        if ( normValue != null )
        {
            // Write the value
            out.writeUTF( normValue );
        }
    }
    else
    {
        // Just write the bytes if not null
        out.writeBoolean( bytes != null );

        if ( bytes != null )
        {
            out.writeInt( bytes.length );
            
            if ( bytes.length > 0 )
            {
                out.write( bytes );
            }
        }
    }

    // and flush the data
    out.flush();
}
 
源代码16 项目: reladomo   文件: RemoteRefreshDatedObjectResult.java
public void writeExternal(ObjectOutput out) throws IOException
{
    this.writeRemoteTransactionId(out);
    out.writeUTF(MithraSerialUtil.getDataClassNameToSerialize(this.refreshedData));
    this.refreshedData.zSerializeFullData(out);
}
 
源代码17 项目: ignite   文件: IgfsControlResponse.java
/**
 * Writes object to data output. Do not use externalizable interface to avoid marshaller.
 *
 * @param out Data output.
 * @throws IOException If error occurred.
 */
public void writeExternal(ObjectOutput out) throws IOException {
    byte[] hdr = new byte[RES_HEADER_SIZE];

    U.intToBytes(resType, hdr, 0);

    int off = 4;

    hdr[off++] = err != null ? (byte)1 : (byte)0;

    if (resType == RES_TYPE_BYTE_ARRAY)
        U.intToBytes(len, hdr, off);

    out.write(hdr);

    if (err != null) {
        out.writeUTF(err);
        out.writeInt(errCode);

        if (resType == RES_TYPE_ERR_STREAM_ID)
            out.writeLong((Long)res);

        return;
    }

    switch (resType) {
        case RES_TYPE_BOOLEAN:
            out.writeBoolean((Boolean)res);

            break;

        case RES_TYPE_LONG:
            out.writeLong((Long)res);

            break;

        case RES_TYPE_BYTE_ARRAY:
            byte[][] buf = (byte[][])res;

            for (byte[] bytes : buf)
                out.write(bytes);

            break;

        case RES_TYPE_IGFS_PATH:
        case RES_TYPE_IGFS_PATH_SUMMARY:
        case RES_TYPE_IGFS_FILE:
        case RES_TYPE_IGFS_STREAM_DESCRIPTOR:
        case RES_TYPE_HANDSHAKE:
        case RES_TYPE_MODE_RESOLVER:
        case RES_TYPE_STATUS: {
            out.writeBoolean(res != null);

            if (res != null)
                ((Externalizable)res).writeExternal(out);

            break;
        }

        case RES_TYPE_COL_IGFS_FILE:
        case RES_TYPE_COL_IGFS_PATH:
        case RES_TYPE_COL_IGFS_BLOCK_LOCATION: {
            Collection<Externalizable> items = (Collection<Externalizable>)res;

            if (items != null) {
                out.writeInt(items.size());

                for (Externalizable item : items)
                    item.writeExternal(out);
            }
            else
                out.writeInt(-1);

            break;
        }
    }
}
 
源代码18 项目: ignite   文件: GridCacheAtomicLongImpl.java
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(ctx.kernalContext());
    out.writeUTF(name);
}
 
源代码19 项目: beam   文件: SerializableConfiguration.java
@Override
public void writeExternal(ObjectOutput out) throws IOException {
  out.writeUTF(conf.getClass().getCanonicalName());
  conf.write(out);
}
 
源代码20 项目: kogito-runtimes   文件: SerializedRule.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF( name );
    out.writeUTF( packageName );
    out.writeObject( this.metaAttributes );
}