class ByteArrayByteIterator extends ByteIterator {
  private final int originalOffset;
  private final byte[] str;
  private int off;
  private final int len;

  public ByteArrayByteIterator(byte[] s) {
    this.str = s;
    this.off = 0;
    this.len = s.length;
    originalOffset = 0;
  }

  public ByteArrayByteIterator(byte[] s, int off, int len) {
    this.str = s;
    this.off = off;
    this.len = off + len;
    originalOffset = off;
  }

  @Override
  public boolean hasNext() {
    return off < len;
  }

  @Override
  public byte nextByte() {
    byte ret = str[off];
    off++;
    return ret;
  }

  @Override
  public long bytesLeft() {
    return len - off;
  }

  @Override
  public void reset() {
    off = originalOffset;
  }

  @Override
  public byte[] toArray() {<FILL_FUNCTION_BODY>}

}

    int size = (int) bytesLeft();
    byte[] bytes = new byte[size];
    System.arraycopy(str, off, bytes, 0, size);
    off = len;
    return bytes;
  
<methods>public non-sealed void <init>() ,public abstract long bytesLeft() ,public abstract boolean hasNext() ,public java.lang.Byte next() ,public int nextBuf(byte[], int) ,public abstract byte nextByte() ,public void remove() ,public void reset() ,public byte[] toArray() ,public java.lang.String toString() <variables>