MCPcopy Create free account
hub / github.com/davidgiven/luje / write

Method write

lib/java/io/PrintStream.java:661–686  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

printMethod · 0.95

Calls 4

getStringMethod · 0.95
setErrorMethod · 0.95
flushMethod · 0.95
writeMethod · 0.65

Tested by

no test coverage detected