public boolean analyzeManifestContents(InputStream inputStream) throws IOException {
  char[] chars=Util.getInputStreamAsCharArray(inputStream,-1,Util.UTF_8);
  int state=START, substate=0;
  StringBuffer currentJarToken=new StringBuffer();
  int currentChar;
  this.classpathSectionsCount=0;
  this.calledFilesNames=null;
  for (int i=0, max=chars.length; i < max; ) {
    currentChar=chars[i++];
    if (currentChar == '\r') {
      if (i < max) {
        currentChar=chars[i++];
      }
    }
switch (state) {
case START:
      if (currentChar == CLASSPATH_HEADER_TOKEN[0]) {
        state=IN_CLASSPATH_HEADER;
        substate=1;
      }
 else {
        state=SKIP_LINE;
      }
    break;
case IN_CLASSPATH_HEADER:
  if (currentChar == '\n') {
    state=START;
  }
 else   if (currentChar != CLASSPATH_HEADER_TOKEN[substate++]) {
    state=SKIP_LINE;
  }
 else   if (substate == CLASSPATH_HEADER_TOKEN.length) {
    state=PAST_CLASSPATH_HEADER;
  }
break;
case PAST_CLASSPATH_HEADER:
if (currentChar == ' ') {
state=SKIPPING_WHITESPACE;
this.classpathSectionsCount++;
}
 else {
return false;
}
break;
case SKIPPING_WHITESPACE:
if (currentChar == '\n') {
state=CONTINUING;
}
 else if (currentChar != ' ') {
currentJarToken.append((char)currentChar);
state=READING_JAR;
}
 else {
addCurrentTokenJarWhenNecessary(currentJarToken);
}
break;
case CONTINUING:
if (currentChar == '\n') {
addCurrentTokenJarWhenNecessary(currentJarToken);
state=START;
}
 else if (currentChar == ' ') {
state=SKIPPING_WHITESPACE;
}
 else if (currentChar == CLASSPATH_HEADER_TOKEN[0]) {
addCurrentTokenJarWhenNecessary(currentJarToken);
state=IN_CLASSPATH_HEADER;
substate=1;
}
 else if (this.calledFilesNames == null) {
addCurrentTokenJarWhenNecessary(currentJarToken);
state=START;
}
 else {
addCurrentTokenJarWhenNecessary(currentJarToken);
state=SKIP_LINE;
}
break;
case SKIP_LINE:
if (currentChar == '\n') {
state=START;
}
break;
case READING_JAR:
if (currentChar == '\n') {
state=CONTINUING;
break;
}
 else if (currentChar == ' ') {
state=SKIPPING_WHITESPACE;
}
 else {
currentJarToken.append((char)currentChar);
break;
}
addCurrentTokenJarWhenNecessary(currentJarToken);
break;
}
}
switch (state) {
case START:
return true;
case IN_CLASSPATH_HEADER:
return true;
case PAST_CLASSPATH_HEADER:
return false;
case SKIPPING_WHITESPACE:
addCurrentTokenJarWhenNecessary(currentJarToken);
return true;
case CONTINUING:
addCurrentTokenJarWhenNecessary(currentJarToken);
return true;
case SKIP_LINE:
if (this.classpathSectionsCount != 0) {
if (this.calledFilesNames == null) {
return false;
}
}
return true;
case READING_JAR:
return false;
}
return true;
}

public boolean analyzeManifestContents ( InputStream inputStream ) throws IOException { char [ ] chars = Util . getInputStreamAsCharArray ( inputStream , - 1 , Util . UTF_8 ) ; int state = START , substate = 0 ; StringBuffer currentJarToken = new StringBuffer ( ) ; int currentChar ; this . classpathSectionsCount = 0 ; this . calledFilesNames = null ; for ( int i = 0 , max = chars . length ; i < max ; ) { currentChar = chars [ i ++ ] ; if ( currentChar == '\r' ) { if ( i < max ) { currentChar = chars [ i ++ ] ; } } switch ( state ) { case START : if ( currentChar == CLASSPATH_HEADER_TOKEN [ 0 ] ) { state = IN_CLASSPATH_HEADER ; substate = 1 ; } else { state = SKIP_LINE ; } break ; case IN_CLASSPATH_HEADER : if ( currentChar == '\n' ) { state = START ; } else if ( currentChar != CLASSPATH_HEADER_TOKEN [ substate ++ ] ) { state = SKIP_LINE ; } else if ( substate == CLASSPATH_HEADER_TOKEN . length ) { state = PAST_CLASSPATH_HEADER ; } break ; case PAST_CLASSPATH_HEADER : if ( currentChar == ' ' ) { state = SKIPPING_WHITESPACE ; this . classpathSectionsCount ++ ; } else { return false ; } break ; case SKIPPING_WHITESPACE : if ( currentChar == '\n' ) { state = CONTINUING ; } else if ( currentChar != ' ' ) { currentJarToken . append ( ( char ) currentChar ) ; state = READING_JAR ; } else { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; } break ; case CONTINUING : if ( currentChar == '\n' ) { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = START ; } else if ( currentChar == ' ' ) { state = SKIPPING_WHITESPACE ; } else if ( currentChar == CLASSPATH_HEADER_TOKEN [ 0 ] ) { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = IN_CLASSPATH_HEADER ; substate = 1 ; } else if ( this . calledFilesNames == null ) { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = START ; } else { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = SKIP_LINE ; } break ; case SKIP_LINE : if ( currentChar == '\n' ) { state = START ; } break ; case READING_JAR : if ( currentChar == '\n' ) { state = CONTINUING ; break ; } else if ( currentChar == ' ' ) { state = SKIPPING_WHITESPACE ; } else { currentJarToken . append ( ( char ) currentChar ) ; break ; } addCurrentTokenJarWhenNecessary ( currentJarToken ) ; break ; } } switch ( state ) { case START : return true ; case IN_CLASSPATH_HEADER : return true ; case PAST_CLASSPATH_HEADER : return false ; case SKIPPING_WHITESPACE : addCurrentTokenJarWhenNecessary ( currentJarToken ) ; return true ; case CONTINUING : addCurrentTokenJarWhenNecessary ( currentJarToken ) ; return true ; case SKIP_LINE : if ( this . classpathSectionsCount != 0 ) { if ( this . calledFilesNames == null ) { return false ; } } return true ; case READING_JAR : return false ; } return true ; }
analyze the manifest contents . the given input stream is read using a utf - 8 encoded reader . if the contents of the input stream is not encoded using a utf - 8 encoding , the analysis will fail .
