Beispiel #1
0
 /**
  * Copies bytes into a buffer.
  *
  * @param target buffer to copy into
  * @param sourceOffset offset within these bytes
  * @param targetOffset offset within the target buffer
  * @param numberToCopy number of bytes to copy
  * @throws IndexOutOfBoundsException if an offset or size is negative or too large
  */
 public final void copyTo(byte[] target, int sourceOffset, int targetOffset, int numberToCopy) {
   checkRange(sourceOffset, sourceOffset + numberToCopy, size());
   checkRange(targetOffset, targetOffset + numberToCopy, target.length);
   if (numberToCopy > 0) {
     copyToInternal(target, sourceOffset, targetOffset, numberToCopy);
   }
 }
Beispiel #2
0
 /**
  * Writes a specified part of this byte string to an output stream.
  *
  * @param out the output stream to which to write the data.
  * @param sourceOffset offset within these bytes
  * @param numberToWrite number of bytes to write
  * @throws IOException if an I/O error occurs.
  * @throws IndexOutOfBoundsException if an offset or size is negative or too large
  */
 final void writeTo(OutputStream out, int sourceOffset, int numberToWrite) throws IOException {
   checkRange(sourceOffset, sourceOffset + numberToWrite, size());
   if (numberToWrite > 0) {
     writeToInternal(out, sourceOffset, numberToWrite);
   }
 }