public int foo(int size, int max) { try { size=(long)stream.available(); } catch (IOException e) {/* empty block */} return size; }