Created
April 3, 2017 19:57
-
-
Save niallcurtis/e645f2ffa7afd2a571d4be3b8af9d807 to your computer and use it in GitHub Desktop.
JavaCoursework3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="KotlinCommonCompilerArguments"> | |
<option name="languageVersion" value="1.1" /> | |
<option name="apiVersion" value="1.1" /> | |
</component> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/Coursework3.iml" filepath="$PROJECT_DIR$/Coursework3.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
—x public class Reader | |
—> public class Binary extends Reader | |
—> public class Text extends Reader | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.niallcurtis.JavaCoursework3; | |
/** | |
* Created by niall on 03/04/2017. | |
*/ | |
public class Question1 { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.niallcurtis.JavaCoursework3; | |
/** | |
* Created by niall on 03/04/2017. | |
*/ | |
public class QuestionOne { | |
public static void main(String[] args) { | |
TextReader test = new TextReader(); | |
try { | |
test.readFile("test.txt"); | |
} | |
catch (Exception e){ | |
e.printStackTrace(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello | |
my | |
name | |
is | |
niall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.niallcurtis.JavaCoursework3; | |
import java.io.IOException; | |
import java.io.*; | |
import java.util.ArrayList; | |
/** | |
* Created by niall on 03/04/2017. | |
*/ | |
public class TextReader { | |
private ArrayList txtReader(String filename) throws IOException{ | |
FileReader readFile = new FileReader(filename); | |
BufferedReader inFile = new BufferedReader(readFile); | |
ArrayList lines = new ArrayList(); | |
String currentLine; | |
// Line reader tool used in Reading-Writing lectures | |
while((currentLine = inFile.readLine()) != null) { | |
lines.add(currentLine); | |
} | |
inFile.close(); | |
return lines; | |
} | |
private String binaryReader(String filename) { | |
return filename; | |
} | |
public ArrayList readFile(String filename) throws IOException { | |
return txtReader(filename); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment