public class GitIgnoreZipper extends Object
| Constructor and Description |
|---|
GitIgnoreZipper() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeTextFile(BufferedReader br)
Close a buffered reader opened using
openTextFile(String) |
List<Path> |
listFiles(Path dir)
Construct and return a sorted list of files in a directory identified by
the dir
|
List<Path> |
listFiles(Path dir,
String ext)
Construct and return a sorted list of files in a directory identified by
the dir that have extensions matching the ext
|
List<Path> |
listSubdirectories(Path dir)
Construct and return a sorted list of directories in a directory
identified by the dir variable
|
List<String> |
loadTextFile(String fqFilename)
Reads the lines of a text file into a list of strings and returns that
list.
|
static void |
main(String[] args)
Entry point to run this utility.
|
BufferedReader |
openTextFile(String fqFilename) |
String |
prompt(String strPrompt)
Print the supplied prompt (if not null) and return the trimmed response
|
String |
prompt(String strPrompt,
boolean bTrim)
Print the supplied prompt (if not null) and return the trimmed response
according to the supplied trim control
|
void |
saveTextFile(String textFileName,
String content)
Save the specified JSONObject in serialized form to the specified file or
throw the appropriate exception.
|
public static void main(String[] args)
args - output file name (e.g., zipper.files), input directory (e.g.,
the directory to be searched recursively for .gitignore files to
determine what has been left out of github repos to include in
the output file, overrides file name (e.g., .overrides) listing
directories and file names to be left out of the output file.public void closeTextFile(BufferedReader br)
openTextFile(String)br - public List<Path> listFiles(Path dir) throws IOException
dir - the path to the directory containing files to be returned in the
listIOException - if there is difficulty accessing the files in the supplied dirpublic List<Path> listFiles(Path dir, String ext) throws IOException
dir - the path to the directory containing files to be returned in the
listext - the file extension (without the leading period) used to filter
files in the dir. If ext is an empty string then all files are
returned.IOException - if there is difficulty accessing the files in the supplied dirpublic List<Path> listSubdirectories(Path dir) throws IOException
dir - the path to the directory containing directories to be returned
in the listIOException - if there is difficulty accessing the content in the supplied
dirpublic List<String> loadTextFile(String fqFilename) throws Exception
fqFilename - fully qualified filenameException - if the file can not be read.public BufferedReader openTextFile(String fqFilename) throws Exception
fqFilename - fully qualified name of the text file to be openedExceptionto close the reader returned by this
functionpublic String prompt(String strPrompt)
strPrompt - public String prompt(String strPrompt, boolean bTrim)
strPrompt - bTrim - public void saveTextFile(String textFileName, String content) throws Exception
textFileName - fully qualified name of the JSON file to be savedcontent - the content to be saved to a file.Exception - IOException) if there is a problem writing the fileCopyright © 2021. All rights reserved.