Example usage for java.io ObjectOutputStream defaultWriteObject

List of usage examples for java.io ObjectOutputStream defaultWriteObject

Introduction

In this page you can find the example usage for java.io ObjectOutputStream defaultWriteObject.

Prototype

public void defaultWriteObject() throws IOException 

Source Link

Document

Write the non-static and non-transient fields of the current class to this stream.

Usage

From source file:org.LexGrid.LexBIG.Impl.Extensions.GenericExtensions.search.SearchScoreDocIterator.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Output output = new Output(baos);
    Kryo kryo = new Kryo();
    kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);
    SynchronizedCollectionsSerializer.registerSerializers(kryo);
    kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
    kryo.register(ScoreDoc.class);
    kryo.writeClassAndObject(output, (List<ScoreDoc>) list);
    output.close();/*  w  w w.  ja  va  2  s .co  m*/
    String outputString = Base64.encodeBase64String(baos.toByteArray());
    out.writeObject(outputString);
}

From source file:it.scoppelletti.programmerpower.wui.DefaultActivity.java

/**
 * Serializza l&rsquo;oggetto./*from  ww w.jav a  2s . c  o m*/
 * 
 * @param      out Flusso di scrittura.
 * @serialData     Formato di default seguito dall&rsquo;elenco delle
 *                 categorie:
 *
 * <P><OL>
 * <LI>Numero di categorie.
 * <LI>Sequenza di categorie.
 * </OL></P>
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    if (myCategories == null) {
        out.writeInt(-1);
    } else {
        out.writeInt(myCategories.size());
        for (String catg : myCategories) {
            out.writeObject(catg);
        }
    }
}

From source file:org.nuxeo.ecm.core.api.SerializableInputStream.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    // write content
    if (in == null) {
        return;/*from   w  w w  .  j a v  a2s  .  c  o  m*/
    }
    try {
        int read;
        byte[] buf = new byte[IN_MEM_LIMIT];
        while ((read = in.read(buf)) != -1) {
            // next follows a chunk of 'read' bytes
            out.writeInt(read);
            out.write(buf, 0, read);
        }
        out.writeInt(-1); // EOF
    } finally {
        if (in != null) {
            in.close();
        }
    }
}

From source file:org.wings.SAbstractLayoutManager.java

private void writeObject(ObjectOutputStream out) throws IOException {
    try {//from   w  w w.  java 2  s . c  o  m
        // preprocessing
        out.defaultWriteObject(); // default
        // postprocessing
    } catch (IOException e) {
        log.warn("Unexpected Exception", e);
        throw e;
    }
}

From source file:uk.q3c.krail.core.guice.uiscope.UIScope.java

/**
 * Writes out the cache by using {@link GuiceKeyProxy} to replace {@link Key}.  It also
 *
 * @param out/*  w w w  .  j ava  2s .  co  m*/
 * @throws IOException
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    Map<UIKey, Map<GuiceKeyProxy, Serializable>> proxyMap = new HashMap<>();
    for (Map.Entry<UIKey, Map<Key<?>, Object>> entry : cache.entrySet()) {
        Map<GuiceKeyProxy, Serializable> targetDetail = new HashMap<>();
        proxyMap.put(entry.getKey(), targetDetail);
        Map<Key<?>, Object> sourceDetail = entry.getValue();
        for (Map.Entry<Key<?>, Object> detailEntry : sourceDetail.entrySet()) {
            GuiceKeyProxy proxy = new GuiceKeyProxy(detailEntry.getKey());
            Object detailValue = detailEntry.getValue();
            if (Serializable.class.isAssignableFrom(detailValue.getClass())) {
                byte[] serValue = SerializationUtils.serialize(detailValue.getClass());
                targetDetail.put(proxy, serValue);
            } else {
                targetDetail.put(proxy, proxy);
            }

        }
    }
    out.writeObject(proxyMap);
}

From source file:org.mule.transport.DefaultReplyToHandler.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    String connectorName = null;//w ww.jav  a  2 s .co  m
    String connectorType = null;

    //Can be null if service call originates from MuleClient
    if (serializedData != null) {
        connectorName = (String) serializedData.get("connectorName");
        connectorType = (String) serializedData.get("connectorType");
    } else {
        if (connector != null) {
            if (!ObjectNameHelper.isDefaultAutoGeneratedConnector(connector)) {
                connectorName = connector.getName();
            }
            connectorType = connector.getProtocol();
        }
    }
    out.writeObject(connectorName);
    out.writeObject(connectorType);
}

From source file:com.uofa.adventure_app.model.Choice.java

/**
 * This is the default implementation of writeObject. Customise if
 * necessary./*from   w ww  .  ja v a  2  s  .  c  om*/
 */
private void writeObject(ObjectOutputStream aOutputStream) throws IOException {
    // perform the default serialization for all non-transient, non-static
    // fields
    aOutputStream.defaultWriteObject();
}

From source file:org.geoserver.importer.RemoteData.java

private void defaultWriteObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
}

From source file:com.hp.autonomy.hod.client.api.textindex.query.search.Document.java

/**
 * @param objectOutputStream The output stream
 * @serialData Writes out the standard fields, then the number of non-standard fields {@code int}, followed by
 * the non-standard field names alternated with their values
 *//*from  w  ww  .j a  v a2 s.c  om*/
private void writeObject(final ObjectOutputStream objectOutputStream) throws IOException {
    objectOutputStream.defaultWriteObject();

    objectOutputStream.writeInt(fields.size());

    for (final Map.Entry<String, Serializable> entry : fields.entrySet()) {
        objectOutputStream.writeObject(entry.getKey());
        objectOutputStream.writeObject(entry.getValue());
    }
}

From source file:org.eclipse.ecr.runtime.api.ServiceHost.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    if (groups != null) {
        out.writeInt(groups.length);/*from w  ww .  j  ava2s .com*/
        for (ServiceGroup group : groups) {
            out.writeObject(group.getName());
        }
    } else {
        out.writeInt(0);
    }
}