commons-file/src/main/java/info/monitorenter/util/FileUtil.java
public static boolean isAllASCII(final InputStream in) throws IOException {
    boolean ret = true;
    int read = -1;
    do {
      read = in.read();
      if (read > 0x7F) {
        ret = false;
        break;
      }

    } while (read != -1);
    return ret;
  }
public static boolean isAllASCII(final InputStream in) throws IOException {
    boolean ret = true;
    int read = -1;
    do {
      read = in.read();
      if (read > 0x7F) {
        ret = false;
        break;
      }

    } while (read != -1);
    return ret;
  }
public static boolean isAllASCII ( final InputStream in ) throws IOException { boolean ret = true ; int read = - 1 ; do { read = in . read ( ) ; if ( read > 0x7F ) { ret = false ; break ; } } while ( read != - 1 ) ; return ret ; }
Tests wether the given input stream only contains ASCII characters if
interpreted by reading bytes (16 bit).
<p>
This does not mean that the underlying content is really an ASCII text
file. It just might be viewed with an editor showing only valid ASCII
characters.
<p>

@param in
the stream to test.

@return true if all bytes in the given input stream are in the ASCII range.

@throws java.io.IOException
on a bad day.
Tests wether the given input stream only contains ASCII characters if interpreted by reading bytes ( 16 bit ) . <p > This does not mean that the underlying content is really an ASCII text file . It just might be viewed with an editor showing only valid ASCII characters . <p >