Example usage for java.io ObjectOutput writeObject

List of usage examples for java.io ObjectOutput writeObject

Introduction

In this page you can find the example usage for java.io ObjectOutput writeObject.

Prototype

public void writeObject(Object obj) throws IOException;

Source Link

Document

Write an object to the underlying storage or stream.

Usage

From source file:com.github.catageek.bytecart.routing.Metric.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(delay);
}

From source file:Blip3.java

public void writeExternal(ObjectOutput out) throws IOException {
    System.out.println("Blip3.writeExternal");
    // You must do this:
    out.writeObject(s);
    out.writeInt(i);/* ww w.jav  a 2s . c  om*/
}

From source file:org.drools.CheeseEqual.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(type);
    out.writeInt(price);
}

From source file:gov.nih.nci.caarray.external.v1_0.data.AbstractDataColumn.java

/**
 * Optimizes the serialized form of this class by compressing the values array.
 * /* w  w  w.  j  a va  2s  .  co m*/
 * {@inheritDoc}
 */
public void writeExternal(ObjectOutput oo) throws IOException {
    oo.writeObject(this.quantitationType);
    byte[] serializedValues = CaArrayUtils.serialize(getSerializableValues());
    oo.writeInt(serializedValues.length);
    oo.write(serializedValues, 0, serializedValues.length);
}

From source file:org.codehaus.wadi.servicespace.InvocationInfo.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(targetClass);
    out.writeInt(memberUpdaterIndex);// w w w  .  j av a2  s. c o m
    out.writeObject(params);
    out.writeObject(metaData);
}

From source file:net.carinae.dev.async.util.SerializerJavaImpl.java

/**
 * {@inheritDoc}// w  w  w  . j  av a  2  s .  c o m
 */
@Override
public byte[] serializeObject(Object obj) {

    try {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutput out;
        out = new ObjectOutputStream(bos);
        out.writeObject(obj);
        out.close();

        byte[] buf = bos.toByteArray();
        return buf;
    } catch (IOException e) {
        e.printStackTrace();
        throw new IllegalArgumentException("Could not serialize object " + obj, e);
    }

}

From source file:ca.uhn.fhir.model.primitive.BoundCodeDt.java

@Override
public void writeExternal(ObjectOutput theOut) throws IOException {
    super.writeExternal(theOut);
    theOut.writeObject(myBinder);
}

From source file:org.mule.transport.legstar.test.lsfileae.LsfileaeHttpClientTest.java

/**
 * @return a serialized java request object in a byte array.
 * @throws IOException  if serialization fails
 *//*from w  ww  . ja v a 2s . c om*/
private byte[] getSerializedJavaRequest() throws IOException {
    ObjectFactory of = new ObjectFactory();
    Dfhcommarea dfhcommarea = of.createDfhcommarea();
    dfhcommarea.setComNumber(100L);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutput out = new ObjectOutputStream(bos);
    out.writeObject(dfhcommarea);
    out.close();
    return bos.toByteArray();
}

From source file:com.lhy.commons.encrypt.service.EncryptService.java

@Override
public File createLicenseFile(License license, String licenseFilePath) {
    License licObj = new License();
    licObj.setIpAddress(DigestUtils.sha512Hex(license.getIpAddress()));
    licObj.setLicenseID(license.getLicenseID());
    licObj.setLicenseType(license.getLicenseType());
    licObj.setStopTime(/*from w  w  w.j a v  a2s  .co m*/
            license.getStopTime() == null ? DateUtils.addDays(new Date(), 30) : license.getStopTime());
    File licenseFile = null;
    try {
        licenseFile = new File(licenseFilePath + File.separator + LicenseFileName);
        ObjectOutput out = new ObjectOutputStream(new FileOutputStream(licenseFile));
        out.writeObject(licObj);
        out.close();
    } catch (FileNotFoundException e) {
        log.error(e.getMessage());
    } catch (IOException e) {
        log.error(e.getMessage());
    }
    return licenseFile;
}

From source file:com.conwet.silbops.model.ContextFunctionTest.java

@Test
public void shouldExternalize() throws Exception {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutput output = new ObjectOutputStream(baos);

    output.writeObject(function);
    output.close();//w  ww.j av a 2  s .  co m

    ObjectInput input = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));

    ContextFunction cxtFun = (ContextFunction) input.readObject();
    assertThat(cxtFun).isEqualTo(function);
}