Code example for ByteArrayInputStream

Methods: close

0
    public Object decodeObject(final byte[] in) throws IOException {
        Object obj = null;
        ByteArrayInputStream bais = null;
        HessianInput input = null;
        try { 
            bais = new ByteArrayInputStream(in);
            input = new HessianInput(bais);
            input.startReply();
            obj = input.readObject();
            input.completeReply();
        } 
        catch (final IOException ex) {
            throw ex;
        } 
        catch (final Throwable e) {
            this.logger.error("Failed to decode object.", e);
        } 
        finally { 
            if (input != null) {
                try { 
                    bais.close();
                } 
                catch (final IOException ex) {
                    this.logger.error("Failed to close stream.", ex);
                } 
            }