下面列出了java.io.ObjectOutput#writeUTF ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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 );
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt( index );
out.writeObject( valueType );
if (fieldType == null) {
out.writeUTF( "" );
} else {
out.writeUTF( fieldType.getName() );
}
}
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
out.writeLong(delegateKey_);
out.writeInt(getTypes().size());
for (Class<?> clazz : getTypes()) {
out.writeUTF(clazz.getName());
}
}
/**
* 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);
}
}
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);
}
/**
* 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());
}
}
@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);
}
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));
}
}
/**
* 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);
}
}
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
super.writeExternal(out);
out.writeInt(EXTERNALVERSIONUID);
out.writeUTF(getCanonical());
out.writeUTF(_language);
}
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);
}
@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);
}
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(id);
out.writeInt(orgId);
out.writeUTF(firstName);
out.writeUTF(lastName);
out.writeDouble(salary);
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(split.getClass().getCanonicalName());
((Writable) split).write(out);
}
/**
* {@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();
}
public void writeExternal(ObjectOutput out) throws IOException
{
this.writeRemoteTransactionId(out);
out.writeUTF(MithraSerialUtil.getDataClassNameToSerialize(this.refreshedData));
this.refreshedData.zSerializeFullData(out);
}
/**
* 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;
}
}
}
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(ctx.kernalContext());
out.writeUTF(name);
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(conf.getClass().getCanonicalName());
conf.write(out);
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF( name );
out.writeUTF( packageName );
out.writeObject( this.metaAttributes );
}