modules.add(new eu.svjatoslav.meviz.renamer.Main());
modules.add(new eu.svjatoslav.meviz.grabmemcard.Main());
modules.add(new eu.svjatoslav.meviz.textsplitter.Main());
-
+ modules.add(new eu.svjatoslav.meviz.bomremove.Main());
}
public static void main(final String[] args) throws Exception {
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();
final FileInputStream fileInputStream = new FileInputStream(file);
- final byte[] currentFileHeader = new byte[2];
+ final byte[] currentFileHeader = new byte[bomHeader.length];
fileInputStream.read(currentFileHeader);
fileInputStream.close();
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);
}