@Override
  public synchronized int read(final ByteBuffer target) throws IOException {
    final int bytesRead = read(target, position);
    position += Math.max(0, bytesRead);
    return bytesRead;
  }
@Override
  public synchronized int read(final ByteBuffer target)