Olá pessoal,
No endereço abaixo foi postado método para verificar se um arquivo é binário.
public boolean isBinaryFile(String file){
boolean isBinary = false;
BufferedReader in = null;
try {
/*Reads the file*/
in = new BufferedReader(new FileReader(file));
String str;
/*Walking through the file until a binary character is founded*/
while((str = in.readLine()) != null && !isBinary){
for (int i = 0; i < str.length(); i++){
isBinary = (int) str.charAt(i) > 127;
}
}
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
return isBinary;
}
http://blowingjava.blogspot.com/
Abraço a todos,
gqueiroz
editado pela moderação: marketing gratuito tem limite. Adicionei o código ao post.