Code example for ObjectOutputStream

Methods: closewriteObject

0
    public byte[] encodeObject(final Object objContent) throws IOException {
        ByteArrayOutputStream baos = null;
        ObjectOutputStream output = null;
        try { 
            baos = new ByteArrayOutputStream(1024);
            output = new ObjectOutputStream(baos);
            output.writeObject(objContent);
        } 
        catch (final IOException ex) {
            throw ex;
 
        } 
        finally { 
            if (output != null) {
                try { 
                    output.close();
                    if (baos != null) {
                        baos.close();
                    } 
                } 
                catch (final IOException ex) {
Stop searching for code, let great code find you!  Add Codota to your java IDE