/* * [Splitter.java] * * Summary: splits files into pieces based on embedded markers. * * Copyright: (c) 2004-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.1 2006-03-05 reformat with IntelliJ, add Javadoc * 1.2 2007-05-22 add PAD and icon. Tidy with IntelliJ inspector. * 1.3 2008-03-21 allow user to specify the encoding. * 1.4 2014-05-17 allow multiple files and dirs on comand line */ package com.mindprod.splitter; import com.mindprod.commandline.CommandLine; import com.mindprod.common18.EIO; import com.mindprod.common18.ST; import com.mindprod.filter.AllButSVNDirectoriesFilter; import com.mindprod.filter.ExtensionListFilter; import com.mindprod.hunkio.HunkIO; import java.io.File; import java.io.IOException; import java.io.Writer; import java.nio.charset.Charset; import static java.lang.System.*; /** * splits files into pieces based on embedded markers. *
* splits a large file into pieces based on embedded tags in it that tell it where to put the pieces. The <split tags * are case-insensitive * * @author Roedy Green, Canadian Mind Products * @version 1.4 2014-05-17 allow multiple files and dirs on comand line * @since 2004 */ public final class Splitter { // declarations private static final int FIRST_COPYRIGHT_YEAR = 2004; /** * undisplayed copyright notice */ @SuppressWarnings( { "UnusedDeclaration" } ) private static final String EMBEDDED_COPYRIGHT = "Copyright: (c) 2004-2017 Roedy Green, Canadian Mind Products, http://mindprod.com"; @SuppressWarnings( { "UnusedDeclaration" } ) private static final String RELEASE_DATE = "2014-05-17"; /** * syntax of command line */ private static final String USAGE = "\nSplitter.jar -charset=UTF8 [-q] file [file -s dir...]"; /** * embedded version string. */ @SuppressWarnings( { "UnusedDeclaration" } ) private static final String VERSION_STRING = "1.4"; /** * keeps track of which files have been used previously. If they have, we isAppending. */ private static final FileStack dupsStack = new FileStack(); /** * keeps track of nesting of