private static int parseFileForValue(String textToMatch,FileInputStream stream){
  byte[] buffer=new byte[1024];
  try {
    int length=stream.read(buffer);
    for (int i=0; i < length; i++) {
      if (buffer[i] == '\n' || i == 0) {
        if (buffer[i] == '\n')         i++;
        for (int j=i; j < length; j++) {
          int textIndex=j - i;
          if (buffer[j] != textToMatch.charAt(textIndex)) {
            break;
          }
          if (textIndex == textToMatch.length() - 1) {
            return extractValue(buffer,j);
          }
        }
      }
    }
  }
 catch (  IOException e) {
  }
catch (  NumberFormatException e) {
  }
  return DEVICEINFO_UNKNOWN;
}

private static int parseFileForValue ( String textToMatch , FileInputStream stream ) { byte [ ] buffer = new byte [ 1024 ] ; try { int length = stream . read ( buffer ) ; for ( int i = 0 ; i < length ; i ++ ) { if ( buffer [ i ] == '\n' || i == 0 ) { if ( buffer [ i ] == '\n' ) i ++ ; for ( int j = i ; j < length ; j ++ ) { int textIndex = j - i ; if ( buffer [ j ] != textToMatch . charAt ( textIndex ) ) { break ; } if ( textIndex == textToMatch . length ( ) - 1 ) { return extractValue ( buffer , j ) ; } } } } } catch ( IOException e ) { } catch ( NumberFormatException e ) { } return DEVICEINFO_UNKNOWN ; }
helper method for reading values from system files , using a minimised buffer .
