The example of this article tells the method of Java judging whether a file is a binary file. Share it for everyone for your reference. The specifics are as follows:
Public Static Boolean Isbining (File File) {Boolean Isbining = False; Try {FileInputStream Fin = New FileInputStream (File); Long Len = File.length (); for (In J = 0 0 ; j <(int) len; j ++) {int T = Fin.Read (); if (T <32 && T! = 9 && T! = 10 && T! = 13) {isbinary = true; break;}} Catch (Exception E) {e.printstacktrace ();} Return isbining;}
It is hoped that this article is helpful to everyone's Java program design.