All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.basex.io.in.ArrayInput Maven / Gradle / Ivy

There is a newer version: 11.3
Show newest version
package org.basex.io.in;

import org.basex.util.*;

/**
 * This class allows reading from a cached byte array.
 *
 * @author BaseX Team 2005-22, BSD License
 * @author Christian Gruen
 */
public final class ArrayInput extends BufferInput {
  /**
   * Constructor, specifying the byte array to be read.
   * @param in input bytes
   */
  public ArrayInput(final byte[] in) {
    super(in);
  }

  /**
   * Constructor, specifying the string to be read.
   * @param in input bytes
   */
  public ArrayInput(final String in) {
    this(Token.token(in));
  }

  @Override
  protected int readByte() {
    return bpos < bsize ? array[bpos++] & 0xFF : -1;
  }

  @Override
  public byte[] content() {
    return array;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy