public static String readLineFromTokenizerBuffer(InputStream stream) {
    { OutputStringStream buffer = OutputStringStream.newOutputStringStream();
      String line = null;
      char ch = Stella.NULL_CHARACTER;
      char ch2 = Stella.NULL_CHARACTER;
      boolean eofP = false;
      char newline = Stella.EOL_STRING.charAt(0);

      loop000 : for (;;) {
        { Object [] caller_MV_returnarray = new Object[1];

          ch = InputStream.readCharacterFromTokenizerBuffer(stream, caller_MV_returnarray);
          eofP = ((boolean)(((BooleanWrapper)(caller_MV_returnarray[0])).wrapperValue));
        }
        if (eofP) {
          line = buffer.theStringReader();
          if (line.length() == 0) {
            line = null;
          }
          else {
            eofP = false;
          }
          break loop000;
        }
        if (ch == newline) {
          if (Stella.EOL_STRING.length() == 2) {
            { Object [] caller_MV_returnarray = new Object[1];

              ch2 = InputStream.readCharacterFromTokenizerBuffer(stream, caller_MV_returnarray);
              eofP = ((boolean)(((BooleanWrapper)(caller_MV_returnarray[0])).wrapperValue));
            }
            if (eofP) {
              line = buffer.theStringReader();
              if (line.length() == 0) {
                line = null;
              }
              else {
                eofP = false;
              }
              break loop000;
            }
            if (!(ch2 == Stella.EOL_STRING.charAt(1))) {
              buffer.nativeStream.print(ch + ch2);
              continue loop000;
            }
          }
          line = buffer.theStringReader();
          break loop000;
        }
        buffer.nativeStream.print(ch);
      }
      return (line);
    }
  }