当前位置: 首页>>代码示例>>Java>>正文


Java ObjectOutput.writeObject方法代码示例

本文整理汇总了Java中java.io.ObjectOutput.writeObject方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectOutput.writeObject方法的具体用法?Java ObjectOutput.writeObject怎么用?Java ObjectOutput.writeObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.ObjectOutput的用法示例。


在下文中一共展示了ObjectOutput.writeObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSerialization

import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    VectorDataItem v1 = new VectorDataItem(1.0, 2.0, 3.0, 4.0);
    VectorDataItem v2 = null;
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(v1);
        out.close();

        ObjectInput in = new ObjectInputStream(
                new ByteArrayInputStream(buffer.toByteArray()));
        v2 = (VectorDataItem) in.readObject();
        in.close();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(v1, v2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:VectorDataItemTests.java

示例2: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(1);

    // NOTE: Super was not written in version 0
    super.writeExternal(out);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _set.length; i-- > 0;) {
        if (_set[i] != REMOVED && _set[i] != FREE) {
            out.writeObject(_set[i]);
            out.writeObject(_values[i]);
        }
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:19,代码来源:THashMap.java

示例3: testSerialization

import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    // test a default instance
    DialValueIndicator i1 = new DialValueIndicator(0, "Label");
    DialValueIndicator i2 = null;

    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(i1);
        out.close();

        ObjectInput in = new ObjectInputStream(
                new ByteArrayInputStream(buffer.toByteArray()));
        i2 = (DialValueIndicator) in.readObject();
        in.close();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(i1, i2);
    
    // test a custom instance
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:DialValueIndicatorTests.java

示例4: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
    out.writeByte(0);

    // LIST
    out.writeObject( list );
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:8,代码来源:TCharListDecorator.java

示例5: generaArrayDati

import java.io.ObjectOutput; //导入方法依赖的package包/类
public byte[] generaArrayDati(){
    try {
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        ObjectOutput outObject = new ObjectOutputStream(outStream);
        synchronized (this.data){
            outObject.writeObject(this.data);
        }
        return outStream.toByteArray();
    } catch (IOException ex) {
        Logger.getLogger(DataManager.class.getName()).log(Level.SEVERE, null, ex);
    }
return null;
}
 
开发者ID:ilofX,项目名称:StazioneMetereologica,代码行数:14,代码来源:DataManager.java

示例6: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
	out.writeObject(color.getRed());
	out.writeObject(color.getGreen());
	out.writeObject(color.getBlue());
	out.writeObject(color.getOpacity());
	out.flush();
}
 
开发者ID:enoy19,项目名称:keyboard-light-composer,代码行数:9,代码来源:KlcColor.java

示例7: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
public void writeExternal( ObjectOutput out ) throws IOException {
	// VERSION
	out.writeByte( 0 );

	// LIST
	out.writeObject( _list );
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:8,代码来源:TIntArrayStack.java

示例8: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(setFunc);
    out.writeObject(getFunc);
    out.writeInt(rows);
    out.writeInt(cols);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:8,代码来源:FunctionMatrixStorage.java

示例9: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ValueExpressionImpl.java

示例10: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
  * Serializes this {@code DataFlavor}.
  */
public synchronized void writeExternal(ObjectOutput os) throws IOException {
    if (mimeType != null) {
        mimeType.setParameter("humanPresentableName", humanPresentableName);
        os.writeObject(mimeType);
        mimeType.removeParameter("humanPresentableName");
    } else {
        os.writeObject(null);
    }

    os.writeObject(representationClass);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:DataFlavor.java

示例11: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(reply);
    out.writeInt(uuid.length);
    out.write(uuid, 0, uuid.length);
    out.writeInt(rpcId.length);
    out.write(rpcId, 0, rpcId.length);
    out.writeObject(message);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:RpcMessage.java

示例12: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
 * Writes this object to the serialized stream.
 * 
 * @param objectOutput
 * @throws IOException
 */
public void writeExternal(ObjectOutput objectOutput)
  throws IOException
{
  objectOutput.writeLong(serialVersionUID);
  objectOutput.writeObject(_wrapped);
  objectOutput.writeObject(_label);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:14,代码来源:FacesMessageWrapper.java

示例13: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
	super.writeExternal(out);
	out.writeObject(iGroup);
	out.writeInt(iLimit);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:7,代码来源:XGroupReservation.java

示例14: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(_bitSize);
    out.writeInt(_mask);
    out.writeObject(_bits);
    out.flush();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:BitArray.java

示例15: writeExternal

import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(this.mark);
    out.writeObject(this.target);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:6,代码来源:JspMethodExpression.java


注:本文中的java.io.ObjectOutput.writeObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。