public int read(final ByteBuffer dst) throws IOException {
   if (allAreSet(state, READ_SHUTDOWN)) {
     return -1;
   }
   int res = Native.readSingle(fd, dst);
   if (res <= 0) state &= ~READ_READY;
   checkReadTimeout(res > 0);
   return res;
 }