X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Fbomremove%2FMain.java;h=3177d0653c331577609aaa7821f3b878fc52c7ed;hb=567410640f4e0428caf9de9fc83df4c73f0e5067;hp=d792bb68d06bcfa86511ae4f682648c0722f3d3f;hpb=1b742640af99284aae1cd10c259254137316ba7c;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 d792bb6..3177d06 100755 --- a/src/main/java/eu/svjatoslav/meviz/bomremove/Main.java +++ b/src/main/java/eu/svjatoslav/meviz/bomremove/Main.java @@ -1,11 +1,11 @@ /* * Meviz - Various tools collection to work with multimedia. - * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Copyright (C) 2012 -- 2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. +*/ package eu.svjatoslav.meviz.bomremove; @@ -20,13 +20,13 @@ import java.util.Arrays; public class Main implements Module { - byte[] bomHeader = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf}; + private final byte[] bomHeader = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf}; - CommandlineHandler commandlineHandler = new CommandlineHandler(); + private final CommandlineHandler commandlineHandler = new CommandlineHandler(); - BomStrippingOptions options; + private BomStrippingOptions options; - public boolean contains(final byte[] header, final byte[] patternToSeek) { + private boolean contains(final byte[] header, final byte[] patternToSeek) { for (int i = 0; i < patternToSeek.length; i++) if (header[i] != patternToSeek[i]) @@ -35,7 +35,7 @@ public class Main implements Module { return true; } - public boolean fileContainsHeader(final File file) + private boolean fileContainsHeader(final File file) throws IOException { final FileInputStream fileInputStream = new FileInputStream(file); @@ -47,7 +47,7 @@ public class Main implements Module { return contains(currentFileHeader, bomHeader); } - public boolean fileMatchesInputPattern(final File file) { + private boolean fileMatchesInputPattern(final File file) { final String fileName = file.getName().toLowerCase(); for (final String inputPattern : options.inputPatterns) @@ -67,7 +67,7 @@ public class Main implements Module { return "stripbom"; } - public void processDirectory(final File directory) { + private void processDirectory(final File directory) { for (final File subFile : directory.listFiles()) if (subFile.isDirectory()) { @@ -85,7 +85,7 @@ public class Main implements Module { } - public void processFile(final File file) throws IOException { + private void processFile(final File file) throws IOException { if (file.length() < bomHeader.length) return; @@ -116,7 +116,7 @@ public class Main implements Module { commandlineHandler.parser.showHelp(); } - public void stripFileFromHeader(final File file) + private void stripFileFromHeader(final File file) throws IOException { // read entire file final byte[] fileContents = IOHelper.getFileContents(file);