496 throw new IndexOutOfBoundsException(); |
496 throw new IndexOutOfBoundsException(); |
497 // ## Fix IOUtil.write so that we can avoid this array copy |
497 // ## Fix IOUtil.write so that we can avoid this array copy |
498 return write0(Util.subsequence(srcs, offset, length)); |
498 return write0(Util.subsequence(srcs, offset, length)); |
499 } |
499 } |
500 |
500 |
|
501 // package-private |
|
502 int sendOutOfBandData(byte b) throws IOException { |
|
503 synchronized (writeLock) { |
|
504 ensureWriteOpen(); |
|
505 int n = 0; |
|
506 try { |
|
507 begin(); |
|
508 synchronized (stateLock) { |
|
509 if (!isOpen()) |
|
510 return 0; |
|
511 writerThread = NativeThread.current(); |
|
512 } |
|
513 for (;;) { |
|
514 n = sendOutOfBandData(fd, b); |
|
515 if ((n == IOStatus.INTERRUPTED) && isOpen()) |
|
516 continue; |
|
517 return IOStatus.normalize(n); |
|
518 } |
|
519 } finally { |
|
520 writerCleanup(); |
|
521 end((n > 0) || (n == IOStatus.UNAVAILABLE)); |
|
522 synchronized (stateLock) { |
|
523 if ((n <= 0) && (!isOutputOpen)) |
|
524 throw new AsynchronousCloseException(); |
|
525 } |
|
526 assert IOStatus.check(n); |
|
527 } |
|
528 } |
|
529 } |
|
530 |
501 protected void implConfigureBlocking(boolean block) throws IOException { |
531 protected void implConfigureBlocking(boolean block) throws IOException { |
502 IOUtil.configureBlocking(fd, block); |
532 IOUtil.configureBlocking(fd, block); |
503 } |
533 } |
504 |
534 |
505 public SocketAddress localAddress() { |
535 public SocketAddress localAddress() { |