Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions readwrite.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.io.PrintWriter;

// Reads a file
public class readWrite {
public readWrite(String inputFile) throws IOException {
public class readwrite {
public readwrite(String inputFile) throws IOException {
File file = new File(inputFile);
BufferedReader reader = new BufferedReader(new FileReader(file));
String line;
Expand All @@ -25,21 +25,36 @@ public void writeCode(String codeFile, String text) throws IOException {
}
}

public static String readFile(File file) {
String currentString = "";

try {
BufferedReader reader = new BufferedReader(new FileReader(file));
while (reader.ready()) {
char nextChar = (char) reader.read();
currentString += nextChar;

}
reader.close();
} catch (IOException ex) {
System.out.println("nah");
}
return currentString;

}

public static int countCharacters(String inputFile) {
File newf = new File(inputFile);
String blonk = readFile(newf);
return blonk.length();
}

public static void main(String[] args) {
try {
readWrite rw = new readWrite("input.txt");
readwrite rw = new readwrite("input.txt");
rw.writeCode("output.txt", "aidan rahill is my baby boy i love him");
} catch (IOException e) {
e.printStackTrace();
}
}}










}
}