public class ReadFile
extends java.lang.Object
| Constructor | Description |
|---|---|
ReadFile() |
| Modifier and Type | Method | Description |
|---|---|---|
static boolean |
bracesBalanced(java.lang.StringBuffer strB) |
Checks a StringBuffer object to see if all open braces within the StringBuffer
have an accompanying closing curly brace.
|
static java.lang.StringBuffer |
fillInStory(java.lang.StringBuffer strBuffer,
java.lang.StringBuffer strBuffer2) |
Returns a StringBuffer that has the original story with all the phrases surrounded by
<> as well as the <> removed.
|
static java.lang.StringBuffer |
loadFile(java.lang.String pathname) |
This method reads a file by character using BufferedReader.
|
static void |
main(java.lang.String[] args) |
|
static void |
readAndCheck(java.lang.String[] files) |
Loads the files and performs the three main functionalities:
1) Checking if a file has balanced braces
2) Checking if two files are identical
3) Filling in provided spots in a story
|
public static void main(java.lang.String[] args)
public static void readAndCheck(java.lang.String[] files)
files - a String[] that holds the names of all the files to be usedpublic static java.lang.StringBuffer loadFile(java.lang.String pathname)
throws java.io.FileNotFoundException
pathname - the name of the file to readjava.io.FileNotFoundException - occurs if the file, with name pathname, cannot be foundpublic static boolean bracesBalanced(java.lang.StringBuffer strB)
strB - the StringBuffer for whose curly brace pairs are to be checkedpublic static java.lang.StringBuffer fillInStory(java.lang.StringBuffer strBuffer,
java.lang.StringBuffer strBuffer2)
strBuffer - the name of the first file, which contains the story, with parts to
be filled instrBuffer2 - a list of words to use to fill in the areas between <> in the story.
if there is no already-provided file where this list came from
this will be equal to "".