protected final < T > T processStream ( Binary binary , BinaryOperation < T > operation ) throws Exception { InputStream stream = binary . getStream ( ) ; if ( stream == null ) { throw new IllegalArgumentException ( "The binary value is empty" ) ; } try { return operation . execute ( stream ) ; } finally { stream . close ( ) ; } }
Allows subclasses to process the stream of binary value property in safe fashion making sure the stream is closed at the end of the operation .