public String build(String input){
  inputString=input;
  inputIndex=0;
  inputLength=input.length();
  outputString=new StringBuffer();
  char nextChar;
  while ((nextChar=get()) != 0 && outputString.length() < maxOutputLength) {
    if (nextChar == '/') {
      if (inputStartsWith("*!")) {
        String nextChars=peek(7);
        boolean haveBangComment=false;
        if (nextChars != null && nextChars.length() == 7) {
          haveBangComment=true;
          for (int i=2; i < nextChars.length(); i++) {
            if (!Character.isDigit(nextChars.charAt(i))) {
              haveBangComment=false;
              break;
            }
          }
        }
        if (haveBangComment) {
          skip(7);
          String contents=getToDelimiter("*/");
          if (contents != null) {
            put(contents);
            skip(2);
          }
        }
 else {
          put(nextChar);
        }
      }
 else       if (inputStartsWith("*")) {
        if (getToDelimiter("*/") != null)         skip(2);
      }
 else {
        put(nextChar);
      }
    }
 else     if (nextChar == '-') {
      if (inputStartsWith("-")) {
        String tail=peek(2);
        if (tail == null) {
          break;
        }
 else {
          if (Character.isWhitespace(tail.charAt(1))) {
            String buf=getToEndOfLine();
            skip(buf.length());
            put(' ');
          }
 else           put(nextChar);
        }
      }
 else {
        put(nextChar);
      }
    }
 else     if (nextChar == '\n') {
      put(" ");
    }
 else {
      put(nextChar);
    }
  }
  return outputString.toString();
}

public String build ( String input ) { inputString = input ; inputIndex = 0 ; inputLength = input . length ( ) ; outputString = new StringBuffer ( ) ; char nextChar ; while ( ( nextChar = get ( ) ) != 0 && outputString . length ( ) < maxOutputLength ) { if ( nextChar == '/' ) { if ( inputStartsWith ( "*!" ) ) { String nextChars = peek ( 7 ) ; boolean haveBangComment = false ; if ( nextChars != null && nextChars . length ( ) == 7 ) { haveBangComment = true ; for ( int i = 2 ; i < nextChars . length ( ) ; i ++ ) { if ( ! Character . isDigit ( nextChars . charAt ( i ) ) ) { haveBangComment = false ; break ; } } } if ( haveBangComment ) { skip ( 7 ) ; String contents = getToDelimiter ( "*/" ) ; if ( contents != null ) { put ( contents ) ; skip ( 2 ) ; } } else { put ( nextChar ) ; } } else if ( inputStartsWith ( "*" ) ) { if ( getToDelimiter ( "*/" ) != null ) skip ( 2 ) ; } else { put ( nextChar ) ; } } else if ( nextChar == '-' ) { if ( inputStartsWith ( "-" ) ) { String tail = peek ( 2 ) ; if ( tail == null ) { break ; } else { if ( Character . isWhitespace ( tail . charAt ( 1 ) ) ) { String buf = getToEndOfLine ( ) ; skip ( buf . length ( ) ) ; put ( ' ' ) ; } else put ( nextChar ) ; } } else { put ( nextChar ) ; } } else if ( nextChar == '\n' ) { put ( " " ) ; } else { put ( nextChar ) ; } } return outputString . toString ( ) ; }
build a string for parsing .
