throw e; } finally { exitRead(res);
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { if (count == 0L) { return 0L; } long val = state; checkMaxSize(val); if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED) || allAreClear(val, MASK_COUNT)) { if (allAreClear(val, FLAG_FINISHED)) { invokeFinishListener(); } return -1; } long res = 0L; try { return res = next.transferTo(min(count, val & MASK_COUNT), throughBuffer, target); } catch (IOException | RuntimeException | Error e) { IoUtils.safeClose(exchange.getConnection()); throw e; } finally { exitRead(res + throughBuffer.remaining()); } }
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { long val = state; checkMaxSize(val); if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED) || allAreClear(val, MASK_COUNT)) { if (allAreClear(val, FLAG_FINISHED)) { invokeFinishListener(); } return -1L; } long res = 0L; try { return res = next.transferTo(position, min(count, val & MASK_COUNT), target); } catch (IOException | RuntimeException | Error e) { IoUtils.safeClose(exchange.getConnection()); throw e; } finally { exitRead(res); } }
throw e; } finally { exitRead(res);
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { if (count == 0L) { return 0L; } long val = state; checkMaxSize(val); if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED) || allAreClear(val, MASK_COUNT)) { if (allAreClear(val, FLAG_FINISHED)) { invokeFinishListener(); } return -1; } long res = 0L; try { return res = next.transferTo(min(count, val & MASK_COUNT), throughBuffer, target); } catch (IOException | RuntimeException | Error e) { IoUtils.safeClose(exchange.getConnection()); throw e; } finally { exitRead(res + throughBuffer.remaining()); } }
throw e; } finally { exitRead(res);
throw e; } finally { exitRead(res);
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { if (count == 0L) { return 0L; } long val = state; checkMaxSize(val); if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED) || allAreClear(val, MASK_COUNT)) { if (allAreClear(val, FLAG_FINISHED)) { invokeFinishListener(); } return -1; } long res = 0L; try { return res = next.transferTo(min(count, val & MASK_COUNT), throughBuffer, target); } catch (IOException | RuntimeException | Error e) { IoUtils.safeClose(exchange.getConnection()); throw e; } finally { exitRead(res + throughBuffer.remaining()); } }
throw e; } finally { exitRead(res);
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { long val = state; checkMaxSize(val); if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED) || allAreClear(val, MASK_COUNT)) { if (allAreClear(val, FLAG_FINISHED)) { invokeFinishListener(); } return -1L; } long res = 0L; try { return res = next.transferTo(position, min(count, val & MASK_COUNT), target); } catch (IOException | RuntimeException | Error e) { IoUtils.safeClose(exchange.getConnection()); throw e; } finally { exitRead(res); } }
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { long val = state; checkMaxSize(val); if (anyAreSet(val, FLAG_CLOSED | FLAG_FINISHED) || allAreClear(val, MASK_COUNT)) { if (allAreClear(val, FLAG_FINISHED)) { invokeFinishListener(); } return -1L; } long res = 0L; try { return res = next.transferTo(position, min(count, val & MASK_COUNT), target); } catch (IOException | RuntimeException | Error e) { IoUtils.safeClose(exchange.getConnection()); throw e; } finally { exitRead(res); } }
throw e; } finally { exitRead(res);