Example usage for java.io ObjectOutput flush

List of usage examples for java.io ObjectOutput flush

Introduction

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

Prototype

public void flush() throws IOException;

Source Link

Document

Flushes the stream.

Usage

From source file:org.chiba.xml.xforms.ChibaBean.java

public void writeExternal(ObjectOutput objectOutput) throws IOException {
    DefaultSerializer serializer = new DefaultSerializer(this);
    Document serializedForm = serializer.serialize();

    StringWriter stringWriter = new StringWriter();
    Transformer transformer = null;
    StreamResult result = new StreamResult(stringWriter);
    try {/*from www . ja  va  2  s.com*/
        transformer = TransformerFactory.newInstance().newTransformer();
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.transform(new DOMSource(serializedForm), result);
    } catch (TransformerConfigurationException e) {
        throw new IOException("TransformerConfiguration invalid: " + e.getMessage());
    } catch (TransformerException e) {
        throw new IOException("Error during serialization transform: " + e.getMessage());
    }
    objectOutput.writeUTF(stringWriter.getBuffer().toString());
    objectOutput.flush();
    objectOutput.close();

}

From source file:org.kepler.objectmanager.cache.ActorCacheObject.java

/**
 * serialize this class//from  w  ww .  j  av a2  s  .c  o m
 * 
 *@param out
 *            Description of the Parameter
 *@exception IOException
 *                Description of the Exception
 */
public void writeExternal(ObjectOutput out) throws IOException {
    if (isDebugging)
        log.debug("writeExternal(" + out.getClass().getName() + ")");
    byte[] b = _actorString.getBytes();
    out.write(b, 0, b.length);
    out.flush();
}