public static int tokenizerByteArrayReadSequence(char[] buffer, InputStream stream, int start, int end) {
    { TokenizerStreamState state = stream.tokenizerState;
      int cursor = state.cursor;
      int internalEnd = state.end;
      int internalSize = state.bufferSize;
      OutputStream echostream = stream.echoStream;

      if (cursor == internalEnd) {
        if (InputStream.readIntoTokenizerBuffer(stream, state, -1)) {
          return (0);
        }
        cursor = state.cursor;
        internalEnd = state.end;
        if (cursor == internalSize) {
          cursor = 0;
        }
      }
      { int readSize = Stella.integer_min(end - start, internalEnd - cursor);
        int originalStart = start;
        char[] internalBuffer = state.buffer;

        { int i = Stella.NULL_INTEGER;
          int iter000 = 1;
          int upperBound000 = readSize;
          boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;

          for (;unboundedP000 ||
                    (iter000 <= upperBound000); iter000 = iter000 + 1) {
            i = iter000;
            i = i;
            buffer[start] = (char)(((char) (0x00ff & internalBuffer[cursor])));
            start = start + 1;
            cursor = cursor + 1;
          }
        }
//        if (echostream != null) {
//          Stella.byteArrayWriteSequence(buffer, echostream.nativeWriter, originalStart, end);
//        }
        state.cursor = cursor;
        return (readSize);
      }
    }
  }