X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Fbomremove%2FMain.java;h=05251eeccacd4a60f3ca514a7f7aa7cfeff7b9f4;hb=b0c6e70ecdcb0dc55eed55ded5a82edc8bdfa729;hp=a377f0457a68b58feff0d1931bdeb03763820e81;hpb=6b6927aafa42fefece54df3c05ebd9161993ef52;p=meviz.git diff --git a/src/main/java/eu/svjatoslav/meviz/bomremove/Main.java b/src/main/java/eu/svjatoslav/meviz/bomremove/Main.java index a377f04..05251ee 100755 --- a/src/main/java/eu/svjatoslav/meviz/bomremove/Main.java +++ b/src/main/java/eu/svjatoslav/meviz/bomremove/Main.java @@ -21,7 +21,7 @@ import eu.svjatoslav.meviz.Module; public class Main implements Module { - byte[] bomHeader = new byte[] { (byte) 0xfe, (byte) 0xff }; + byte[] bomHeader = new byte[] { (byte) 0xef, (byte) 0xbb, (byte) 0xbf }; CommandlineHandler commandlineHandler = new CommandlineHandler(); @@ -41,7 +41,7 @@ public class Main implements Module { final FileInputStream fileInputStream = new FileInputStream(file); - final byte[] currentFileHeader = new byte[2]; + final byte[] currentFileHeader = new byte[bomHeader.length]; fileInputStream.read(currentFileHeader); fileInputStream.close(); @@ -60,7 +60,7 @@ public class Main implements Module { @Override public String getDescription() { - return "Remove byte order mark (bom) from UTF text files of they are present."; + return "Remove byte order mark (bom) from UTF text files if they are present."; } @Override @@ -88,12 +88,13 @@ public class Main implements Module { public void processFile(final File file) throws IOException { - if (file.length() < 2) + if (file.length() < bomHeader.length) return; if (!fileContainsHeader(file)) return; + System.out.println("Removing BOM from: " + file.getAbsolutePath()); stripFileFromHeader(file); }