public Throwable readThrowable ( InputStream in ) throws ConversionException , IOException , ClassNotFoundException { byte [ ] byteInputStream = convertInputStreamToBytes ( in ) ; ByteArrayInputStream bais = new ByteArrayInputStream ( byteInputStream ) ; JSONObject json = null ; try { json = parseObject ( bais ) ; } catch ( IOException ex ) { bais . reset ( ) ; throw new RuntimeException ( convertStreamToString ( bais ) ) ; } Object t = readSerialized ( json . get ( N_THROWABLE ) ) ; if ( ! ( t instanceof Throwable ) ) { throwConversionException ( "readThrowable() receives an instance that's not a Throwable." , json . get ( N_THROWABLE ) ) ; } return ( Throwable ) t ; }
Decode a JSON document to retrieve a Throwable instance .