Tabnine Logo
Arrays.checkOffsetAndCount
Code IndexAdd Tabnine to your IDE (free)

How to use
checkOffsetAndCount
method
in
java.util.Arrays

Best Java code snippets using java.util.Arrays.checkOffsetAndCount (Showing top 20 results out of 315)

origin: robovm/robovm

@Override public synchronized int read(byte[] buffer, int byteOffset, int byteCount) {
  Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
  // Are there any bytes available?
  if (this.pos >= this.count) {
    return -1;
  }
  if (byteCount == 0) {
    return 0;
  }
  int copylen = this.count - pos < byteCount ? this.count - pos : byteCount;
  System.arraycopy(this.buf, pos, buffer, byteOffset, copylen);
  pos += copylen;
  return copylen;
}
origin: robovm/robovm

@Override public synchronized int read(byte[] buffer, int byteOffset, int byteCount) {
  if (buffer == null) {
    throw new NullPointerException("buffer == null");
  }
  Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
  if (byteCount == 0) {
    return 0;
  }
  int copylen = count - pos < byteCount ? count - pos : byteCount;
  for (int i = 0; i < copylen; ++i) {
    buffer[byteOffset + i] = (byte) this.buffer.charAt(pos + i);
  }
  pos += copylen;
  return copylen;
}
origin: robovm/robovm

/**
 * Update this {@code Adler32} checksum with the contents of {@code buf},
 * starting from {@code offset} and reading {@code byteCount} bytes of data.
 */
public void update(byte[] buf, int offset, int byteCount) {
  Arrays.checkOffsetAndCount(buf.length, offset, byteCount);
  adler = updateImpl(buf, offset, byteCount, adler);
}
origin: robovm/robovm

@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
  Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
  if (byteCount == 0) {
    return 0;
  }
  checkReadPrimitiveTypes();
  return primitiveData.read(buffer, byteOffset, byteCount);
}
origin: robovm/robovm

/**
 * Update this {@code CRC32} checksum with the contents of {@code buf},
 * starting from {@code offset} and reading {@code byteCount} bytes of data.
 */
public void update(byte[] buf, int offset, int byteCount) {
  Arrays.checkOffsetAndCount(buf.length, offset, byteCount);
  tbytes += byteCount;
  crc = updateImpl(buf, offset, byteCount, crc);
}
origin: robovm/robovm

final void append0(char[] chars, int offset, int length) {
  Arrays.checkOffsetAndCount(chars.length, offset, length);
  int newCount = count + length;
  if (newCount > value.length) {
    enlargeBuffer(newCount);
  }
  System.arraycopy(chars, offset, value, count, length);
  count = newCount;
}
origin: robovm/robovm

  @Override
  public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
    Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
    if (!channel.isBlocking()) {
      throw new IllegalBlockingModeException();
    }
    ByteBuffer buf = ByteBuffer.wrap(buffer, byteOffset, byteCount);
    return channel.read(buf);
  }
}
origin: robovm/robovm

@Override
public final CharBuffer get(char[] dst, int dstOffset, int charCount) {
  Arrays.checkOffsetAndCount(dst.length, dstOffset, charCount);
  if (charCount > remaining()) {
    throw new BufferUnderflowException();
  }
  int newPosition = position + charCount;
  sequence.toString().getChars(position, newPosition, dst, dstOffset);
  position = newPosition;
  return this;
}
origin: robovm/robovm

@Override
public void write(byte[] buffer, int offset, int byteCount) throws IOException {
  Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
  ByteBuffer buf = ByteBuffer.wrap(buffer, offset, byteCount);
  if (!channel.isBlocking()) {
    throw new IllegalBlockingModeException();
  }
  channel.write(buf);
}
origin: robovm/robovm

/**
 * Compresses {@code byteCount} bytes of data from {@code buf} starting at
 * {@code offset} and writes it to the underlying stream.
 * @throws IOException
 *             If an error occurs during writing.
 */
@Override public void write(byte[] buffer, int offset, int byteCount) throws IOException {
  if (done) {
    throw new IOException("attempt to write after finish");
  }
  Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
  if (!def.needsInput()) {
    throw new IOException();
  }
  def.setInput(buffer, offset, byteCount);
  deflate();
}
origin: robovm/robovm

/**
 * Sets the dictionary to be used for compression by this {@code Deflater}.
 * This method can only be called if this {@code Deflater} supports the writing
 * of ZLIB headers. This is the default, but can be overridden
 * using {@link #Deflater(int, boolean)}.
 */
public synchronized void setDictionary(byte[] buf, int offset, int byteCount) {
  checkOpen();
  Arrays.checkOffsetAndCount(buf.length, offset, byteCount);
  setDictionaryImpl(buf, offset, byteCount, streamHandle);
}
origin: robovm/robovm

private native int deflateImpl(byte[] buf, int offset, int byteCount, long handle, int flushParm);
origin: robovm/robovm

/**
 * Sets the preset dictionary to be used for inflation to a subsequence of {@code dictionary}
 * starting at {@code offset} and continuing for {@code byteCount} bytes. See {@link
 * #needsDictionary} for details.
 */
public synchronized void setDictionary(byte[] dictionary, int offset, int byteCount) {
  checkOpen();
  Arrays.checkOffsetAndCount(dictionary.length, offset, byteCount);
  setDictionaryImpl(dictionary, offset, byteCount, streamHandle);
}
origin: robovm/robovm

/**
 * Sets the current input to to be decompressed. This method should only be
 * called if {@link #needsInput} returns {@code true}.
 */
public synchronized void setInput(byte[] buf, int offset, int byteCount) {
  checkOpen();
  Arrays.checkOffsetAndCount(buf.length, offset, byteCount);
  inRead = 0;
  inLength = byteCount;
  setInputImpl(buf, offset, byteCount, streamHandle);
}
origin: robovm/robovm

/**
 * Writes to the decompressing output stream. The {@code bytes} array should contain
 * compressed input. The corresponding uncompressed data will be written to the underlying
 * stream.
 *
 * @throws IOException if an I/O error occurs, or the stream has been closed
 * @throws ZipException if a zip exception occurs.
 * @throws NullPointerException if {@code b == null}.
 * @throws IndexOutOfBoundsException if {@code off < 0 || len < 0 || off + len > b.length}
 */
@Override
public void write(byte[] bytes, int offset, int byteCount) throws IOException, ZipException {
  checkClosed();
  Arrays.checkOffsetAndCount(bytes.length, offset, byteCount);
  inf.setInput(bytes, offset, byteCount);
  write();
}
origin: robovm/robovm

/**
 * Copies {@code count} {@code boolean}s from the memory pointed to by this
 * {@link BooleanPtr} to {@code dst} starting at offset {@code offset}.
 * 
 * @param dst the destination.
 * @param offset the offset within the destination array to start copying
 *            to.
 * @param count the number of elements to copy.
 */
public void get(boolean[] dst, int offset, int count) {
  Arrays.checkOffsetAndCount(dst.length, offset, count);
  long h = getHandle();
  for (int i = 0; i < count; i++) {
    dst[i + offset] = VM.getByte(h++) != 0;
  }
}
origin: robovm/robovm

  /**
   * Copies {@code count} {@code boolean}s from {@code src} starting at offset
   * {@code offset} to the memory pointed to by this {@link BooleanPtr}.
   * 
   * @param src the source.
   * @param offset the offset within the source array to start copying from.
   * @param count the number of elements to copy.
   */
  public void set(boolean[] src, int offset, int count) {
    Arrays.checkOffsetAndCount(src.length, offset, count);
    long h = getHandle();
    for (int i = 0; i < count; i++) {
      VM.setByte(h++, (byte) (src[i + offset] ? 1 : 0));
    }
  }
}
origin: robovm/robovm

/**
 * Sets the input buffer the {@code Deflater} will use to extract uncompressed bytes
 * for later compression.
 */
public synchronized void setInput(byte[] buf, int offset, int byteCount) {
  checkOpen();
  Arrays.checkOffsetAndCount(buf.length, offset, byteCount);
  inLength = byteCount;
  inRead = 0;
  if (inputBuffer == null) {
    setLevelsImpl(compressLevel, strategy, streamHandle);
  }
  inputBuffer = buf;
  setInputImpl(buf, offset, byteCount, streamHandle);
}
origin: robovm/robovm

public long read(ByteBuffer[] buffers, int offset, int length) throws IOException {
  Arrays.checkOffsetAndCount(buffers.length, offset, length);
  checkOpen();
  checkReadable();
  return transferIoVec(new IoVec(buffers, offset, length, IoVec.Direction.READV));
}
origin: robovm/robovm

public long write(ByteBuffer[] buffers, int offset, int length) throws IOException {
  Arrays.checkOffsetAndCount(buffers.length, offset, length);
  checkOpen();
  checkWritable();
  return transferIoVec(new IoVec(buffers, offset, length, IoVec.Direction.WRITEV));
}
java.utilArrayscheckOffsetAndCount

Javadoc

Checks that the range described by offset and count doesn't exceed arrayLength.

Popular methods of Arrays

  • asList
    Returns a List of the objects in the specified array. The size of the List cannot be modified, i.e.
  • toString
    Returns a string representation of the contents of the specified array. The string representation co
  • equals
    Returns true if the two specified arrays of booleans areequal to one another. Two arrays are conside
  • sort
    Sorts the specified range of the array into ascending order. The range to be sorted extends from the
  • copyOf
    Copies the specified array, truncating or padding with false (if necessary) so the copy has the spec
  • fill
    Assigns the specified boolean value to each element of the specified array of booleans.
  • stream
  • hashCode
    Returns a hash code based on the contents of the specified array. For any two boolean arrays a and
  • copyOfRange
    Copies the specified range of the specified array into a new array. The initial index of the range (
  • binarySearch
    Searches the specified array of shorts for the specified value using the binary search algorithm. Th
  • deepEquals
    Returns true if the two specified arrays are deeply equal to one another. Unlike the #equals(Object[
  • deepToString
  • deepEquals,
  • deepToString,
  • deepHashCode,
  • setAll,
  • parallelSort,
  • parallelSetAll,
  • spliterator,
  • checkBinarySearchBounds,
  • checkStartAndEnd

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JButton (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now