Writes count bytes from buffer starting at offset to the target stream. If autoflush is set, this stream gets flushed after writing the buffer. This stream's error flag is set to true if this stream is closed or an I/O error occurs. @param buffer the b
(byte[] buffer, int offset, int length)
| 659 | * @see #flush() |
| 660 | */ |
| 661 | @Override |
| 662 | public void write(byte[] buffer, int offset, int length) { |
| 663 | // Force buffer null check first! |
| 664 | if (offset > buffer.length || offset < 0) { |
| 665 | // luni.12=Offset out of bounds \: {0} |
| 666 | throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.12", offset)); //$NON-NLS-1$ |
| 667 | } |
| 668 | if (length < 0 || length > buffer.length - offset) { |
| 669 | // luni.18=Length out of bounds \: {0} |
| 670 | throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.18", length)); //$NON-NLS-1$ |
| 671 | } |
| 672 | synchronized (this) { |
| 673 | if (out == null) { |
| 674 | setError(); |
| 675 | return; |
| 676 | } |
| 677 | try { |
| 678 | out.write(buffer, offset, length); |
| 679 | if (autoflush) { |
| 680 | flush(); |
| 681 | } |
| 682 | } catch (IOException e) { |
| 683 | setError(); |
| 684 | } |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * Writes one byte to the target stream. Only the least significant byte of |