diff options
Diffstat (limited to 'src/StandardIO')
| -rw-r--r-- | src/StandardIO/Approvable.java | 15 | ||||
| -rw-r--r-- | src/StandardIO/FileIO/FileDecomposer.java | 60 | ||||
| -rw-r--r-- | src/StandardIO/FileOutputArray.java | 49 | ||||
| -rw-r--r-- | src/StandardIO/MFileFilter.java | 40 | ||||
| -rw-r--r-- | src/StandardIO/MFileWriter.java | 26 | ||||
| -rw-r--r-- | src/StandardIO/ModulusFileChooser.java | 49 | ||||
| -rw-r--r-- | src/StandardIO/ModulusOutputStream.java | 168 | ||||
| -rw-r--r-- | src/StandardIO/PropertiesReader.java | 60 | ||||
| -rw-r--r-- | src/StandardIO/SaveFileWriter.java | 20 |
9 files changed, 487 insertions, 0 deletions
diff --git a/src/StandardIO/Approvable.java b/src/StandardIO/Approvable.java new file mode 100644 index 0000000..56a31d1 --- /dev/null +++ b/src/StandardIO/Approvable.java @@ -0,0 +1,15 @@ +package StandardIO; + +import java.io.File; + +public abstract interface Approvable +{ + public abstract void onApprove(File paramFile); + + public abstract void onCancel(); +} + +/* Location: Modulus.jar + * Qualified Name: StandardIO.Approvable + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/FileIO/FileDecomposer.java b/src/StandardIO/FileIO/FileDecomposer.java new file mode 100644 index 0000000..9b1df75 --- /dev/null +++ b/src/StandardIO/FileIO/FileDecomposer.java @@ -0,0 +1,60 @@ +/* */ package StandardIO.FileIO; +/* */ +/* */ import java.io.BufferedReader; +/* */ import java.io.DataInputStream; +/* */ import java.io.File; +/* */ import java.io.FileInputStream; +/* */ import java.io.IOException; +/* */ import java.io.InputStreamReader; +/* */ +/* */ public class FileDecomposer +/* */ { +/* */ public static String[] decompose(String file) +/* */ throws IOException +/* */ { +/* 14 */ return decompose(new File(file)); +/* */ } +/* */ public static String[] decompose(File file) throws IOException { +/* 17 */ String[] toReturn = new String[getCountOf(file)]; +/* 18 */ int count = 0; +/* */ +/* 20 */ FileInputStream fstream = new FileInputStream(file); +/* 21 */ DataInputStream in = new DataInputStream(fstream); +/* 22 */ BufferedReader br = new BufferedReader(new InputStreamReader(in)); +/* 23 */ String str = ""; +/* 24 */ while ((str = br.readLine()) != null) { +/* 25 */ toReturn[count] = str; +/* 26 */ count++; +/* */ } +/* */ +/* 29 */ fstream.close(); +/* 30 */ in.close(); +/* 31 */ br.close(); +/* */ +/* 33 */ return toReturn; +/* */ } +/* */ public static int getCountOf(File f) { +/* */ try { +/* 37 */ int count = 0; +/* 38 */ FileInputStream fstream = new FileInputStream(f); +/* 39 */ DataInputStream in = new DataInputStream(fstream); +/* 40 */ BufferedReader br = new BufferedReader(new InputStreamReader(in)); +/* */ +/* 42 */ while (br.readLine() != null) count++; +/* */ +/* 44 */ fstream.close(); +/* 45 */ in.close(); +/* 46 */ br.close(); +/* */ +/* 48 */ return count; +/* */ } +/* */ catch (Exception e) { +/* 51 */ e.printStackTrace(); +/* 52 */ }return 0; +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.FileIO.FileDecomposer + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/FileOutputArray.java b/src/StandardIO/FileOutputArray.java new file mode 100644 index 0000000..923b075 --- /dev/null +++ b/src/StandardIO/FileOutputArray.java @@ -0,0 +1,49 @@ +/* */ package StandardIO; +/* */ +/* */ import java.io.File; +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ import java.io.PrintWriter; +/* */ import java.util.ArrayList; +/* */ import java.util.List; +/* */ +/* */ public class FileOutputArray +/* */ { +/* */ private List<String> output; +/* */ +/* */ public FileOutputArray() +/* */ { +/* 15 */ this.output = new ArrayList(); +/* */ } +/* */ public void flushToFile(String file) { +/* */ try { +/* 19 */ PrintWriter stream = new SaveFileWriter(file); +/* 20 */ for (int i = 0; i < this.output.size(); i++) { +/* 21 */ stream.print((String)this.output.get(i)); +/* */ } +/* 23 */ stream.flush(); +/* 24 */ stream.close(); +/* */ } +/* */ catch (IOException e) { +/* 27 */ e.printStackTrace(); +/* 28 */ System.err.println("File could not be written."); +/* */ } +/* */ } +/* */ +/* 32 */ public void flushToFile(File f) { flushToFile(f.toString()); } +/* */ +/* */ public void reset() { +/* 35 */ this.output = new ArrayList(); +/* */ } +/* */ public void setOutput(List<String> arr) { +/* 38 */ this.output = arr; +/* */ } +/* */ public void append(String what) { +/* 41 */ this.output.add(what); +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.FileOutputArray + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/MFileFilter.java b/src/StandardIO/MFileFilter.java new file mode 100644 index 0000000..8484806 --- /dev/null +++ b/src/StandardIO/MFileFilter.java @@ -0,0 +1,40 @@ +/* */ package StandardIO; +/* */ +/* */ import java.io.File; +/* */ +/* */ public class MFileFilter extends javax.swing.filechooser.FileFilter +/* */ { +/* */ java.io.FileFilter filter; +/* */ String description; +/* */ String[] ext; +/* */ +/* */ public MFileFilter(java.io.FileFilter f, String description) +/* */ { +/* 18 */ this.filter = f; +/* 19 */ this.description = description; +/* 20 */ this.ext = null; +/* */ } +/* */ +/* */ public MFileFilter(String[] acceptedExtensions, String description) { +/* 24 */ this.ext = acceptedExtensions; +/* 25 */ this.description = description; +/* 26 */ this.filter = null; +/* */ } +/* */ public boolean accept(File f) { +/* 29 */ if (f.isDirectory()) return true; +/* 30 */ if (this.filter != null) +/* 31 */ return this.filter.accept(f); +/* 32 */ for (String ex : this.ext) +/* 33 */ if (f.toString().endsWith(ex)) +/* 34 */ return true; +/* 35 */ return false; +/* */ } +/* */ public String getDescription() { +/* 38 */ return this.description; +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.MFileFilter + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/MFileWriter.java b/src/StandardIO/MFileWriter.java new file mode 100644 index 0000000..b6a0a5f --- /dev/null +++ b/src/StandardIO/MFileWriter.java @@ -0,0 +1,26 @@ +/* */ package StandardIO; +/* */ +/* */ import java.io.FileWriter; +/* */ import java.io.IOException; +/* */ import java.io.PrintWriter; +/* */ import java.text.SimpleDateFormat; +/* */ import java.util.Calendar; +/* */ +/* */ public class MFileWriter extends PrintWriter +/* */ { +/* */ public MFileWriter(String file) +/* */ throws IOException +/* */ { +/* 16 */ super(new FileWriter(file)); +/* */ } +/* */ public void writeDateAndTime() { +/* 19 */ Calendar c = Calendar.getInstance(); +/* 20 */ SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yyyy\tHH:mm:ss"); +/* 21 */ super.println(fmt.format(c.getTime())); +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.MFileWriter + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/ModulusFileChooser.java b/src/StandardIO/ModulusFileChooser.java new file mode 100644 index 0000000..1d73c80 --- /dev/null +++ b/src/StandardIO/ModulusFileChooser.java @@ -0,0 +1,49 @@ +/* */ package StandardIO; +/* */ +/* */ import javax.swing.JFileChooser; +/* */ +/* */ public class ModulusFileChooser extends JFileChooser +/* */ { +/* */ Approvable onApprove; +/* */ +/* */ public ModulusFileChooser(Approvable app, String currentDirectory, MFileFilter[] chooseableFilters) +/* */ { +/* 16 */ super(currentDirectory); +/* 17 */ for (MFileFilter f : chooseableFilters) { +/* 18 */ super.addChoosableFileFilter(f); +/* */ } +/* 20 */ this.onApprove = app; +/* 21 */ setFileFilter(chooseableFilters[0]); +/* */ } +/* */ public void promptOpen() { +/* 24 */ int returnVal = super.showOpenDialog(this); +/* 25 */ if (returnVal == 0) { +/* 26 */ this.onApprove.onApprove(getSelectedFile()); +/* */ } +/* */ else +/* 29 */ this.onApprove.onCancel(); +/* */ } +/* */ +/* */ public void promptSave() { +/* 33 */ int returnVal = super.showSaveDialog(this); +/* 34 */ if (returnVal == 0) { +/* 35 */ this.onApprove.onApprove(getSelectedFile()); +/* */ } +/* */ else +/* 38 */ this.onApprove.onCancel(); +/* */ } +/* */ +/* */ public void promptDialog(String dialog) { +/* 42 */ int returnVal = super.showDialog(this, dialog); +/* 43 */ if (returnVal == 0) { +/* 44 */ this.onApprove.onApprove(getSelectedFile()); +/* */ } +/* */ else +/* 47 */ this.onApprove.onCancel(); +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.ModulusFileChooser + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/ModulusOutputStream.java b/src/StandardIO/ModulusOutputStream.java new file mode 100644 index 0000000..8ef368b --- /dev/null +++ b/src/StandardIO/ModulusOutputStream.java @@ -0,0 +1,168 @@ +/* */ package StandardIO; +/* */ +/* */ import java.io.File; +/* */ import java.io.OutputStream; +/* */ import java.io.PrintStream; +/* */ import javax.swing.JTextArea; +/* */ +/* */ public class ModulusOutputStream extends PrintStream +/* */ { +/* */ private JTextArea textAreaToAppend; +/* */ private FileOutputArray output; +/* */ +/* */ public ModulusOutputStream(OutputStream out, boolean autoFlush) +/* */ { +/* 22 */ super(out, autoFlush); +/* 23 */ this.output = new FileOutputArray(); +/* */ } +/* */ +/* */ public ModulusOutputStream(JTextArea append, OutputStream out, boolean autoFlush) +/* */ { +/* 30 */ super(out, autoFlush); +/* 31 */ this.textAreaToAppend = append; +/* 32 */ this.output = new FileOutputArray(); +/* */ } +/* */ +/* */ public void print(String s) +/* */ { +/* */ try +/* */ { +/* 41 */ this.textAreaToAppend.append(s); +/* 42 */ this.output.append(s); +/* */ } +/* */ catch (Exception e) { +/* 45 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void print(int s) { +/* */ try { +/* 51 */ this.textAreaToAppend.append(s); +/* 52 */ this.output.append(s); +/* */ } +/* */ catch (Exception e) { +/* 55 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void print(float s) { +/* */ try { +/* 61 */ this.textAreaToAppend.append(s); +/* 62 */ this.output.append(s); +/* */ } +/* */ catch (Exception e) { +/* 65 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void print(double s) { +/* */ try { +/* 71 */ this.textAreaToAppend.append(s); +/* 72 */ this.output.append(s); +/* */ } +/* */ catch (Exception e) { +/* 75 */ e.printStackTrace(); +/* 76 */ this.output.append(s); +/* */ } +/* */ } +/* */ +/* */ public void print(boolean s) { +/* */ try { +/* 82 */ this.textAreaToAppend.append(s); +/* 83 */ this.output.append(s); +/* */ } +/* */ catch (Exception e) { +/* 86 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void print(char s) { +/* */ try { +/* 92 */ this.textAreaToAppend.append(s); +/* 93 */ this.output.append(s); +/* */ } +/* */ catch (Exception e) { +/* 96 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* 100 */ public void print(char[] s) { print(new String(s)); } +/* */ +/* */ public void println(String s) +/* */ { +/* */ try { +/* 105 */ this.textAreaToAppend.append(s + "\n"); +/* 106 */ this.output.append(s + "\n"); +/* */ } +/* */ catch (Exception e) { +/* 109 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void println(int s) { +/* */ try { +/* 115 */ this.textAreaToAppend.append(s + "\n"); +/* 116 */ this.output.append(s + "\n"); +/* */ } +/* */ catch (Exception e) { +/* 119 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void println(float s) { +/* */ try { +/* 125 */ this.textAreaToAppend.append(s + "\n"); +/* 126 */ this.output.append(s + "\n"); +/* */ } +/* */ catch (Exception e) { +/* 129 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void println(double s) { +/* */ try { +/* 135 */ this.textAreaToAppend.append(s + "\n"); +/* 136 */ this.output.append(s + "\n"); +/* */ } +/* */ catch (Exception e) { +/* 139 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void println(boolean s) { +/* */ try { +/* 145 */ this.textAreaToAppend.append(s + "\n"); +/* 146 */ this.output.append(s + "\n"); +/* */ } +/* */ catch (Exception e) { +/* 149 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* */ public void println(char s) { +/* */ try { +/* 155 */ this.textAreaToAppend.append(s + "\n"); +/* 156 */ this.output.append(s + "\n"); +/* */ } +/* */ catch (Exception e) { +/* 159 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ +/* 163 */ public void println(char[] s) { println(new String(s)); } +/* */ +/* */ public void silentPrint(String prnt) { +/* 166 */ this.output.append(prnt); +/* */ } +/* */ public void flushTo(File file) { +/* 169 */ this.output.flushToFile(file); +/* */ } +/* */ public void flushTo(String file) { +/* 172 */ this.output.flushToFile(file); +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.ModulusOutputStream + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/PropertiesReader.java b/src/StandardIO/PropertiesReader.java new file mode 100644 index 0000000..172162b --- /dev/null +++ b/src/StandardIO/PropertiesReader.java @@ -0,0 +1,60 @@ +/* */ package StandardIO; +/* */ +/* */ import StandardIO.FileIO.FileDecomposer; +/* */ import java.io.BufferedWriter; +/* */ import java.io.FileWriter; +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ +/* */ public class PropertiesReader +/* */ { +/* */ private String dir; +/* */ +/* */ public PropertiesReader(String directory) +/* */ { +/* 11 */ this.dir = directory; +/* */ } +/* */ public String[] readProperties() { +/* 14 */ String[] file = new String[0]; +/* 15 */ String[] toReturn = new String[6]; +/* */ try { +/* 17 */ file = FileDecomposer.decompose(this.dir); +/* */ } +/* */ catch (IOException e) { +/* 20 */ System.out.println("Properties Not Found"); +/* 21 */ return new String[] { "1234567890\\QWERTYUIOP\\ASDFGHJKL\\ZXCVBNM", "none", "none", "none", "full", "false" }; +/* */ } +/* */ +/* 24 */ for (String str : file) { +/* 25 */ if (str.startsWith("keyboard-style")) +/* 26 */ if (str.substring(str.indexOf(":") + 1).trim().equals("QWERTY")) toReturn[0] = "1234567890\\QWERTYUIOP\\ASDFGHJKL\\ZXCVBNM"; +/* 27 */ else if (str.substring(str.indexOf(":") + 1).trim().equals("DVORAK")) toReturn[0] = "1234567890\\PYFGCRL\\AOEUIDHTNS\\QJKXBMWVZ"; +/* 28 */ else if (str.substring(str.indexOf(":") + 1).trim().equals("ALPHABETICAL")) toReturn[0] = "0123456789\\ABCDEFGHIJ\\KLMNOPQRST\\UVWXYZ"; +/* 29 */ if (str.startsWith("keyboard")) toReturn[0] = str.substring(str.indexOf(":") + 1); +/* 30 */ if (str.startsWith("ColorKeys")) toReturn[1] = str.substring(str.indexOf(":") + 1); +/* 31 */ if (str.startsWith("LastFunctionDir")) toReturn[2] = str.substring(str.indexOf(":") + 1); +/* 32 */ if (str.startsWith("LastLoadDir")) toReturn[3] = str.substring(str.indexOf(":") + 1); +/* 33 */ if (str.startsWith("calcsize:")) toReturn[4] = str.substring(str.indexOf(":") + 1); +/* 34 */ if (str.startsWith("ontop:")) toReturn[5] = str.substring(str.indexOf(":") + 1); +/* */ } +/* 36 */ return toReturn; +/* */ } +/* */ public void writeProperties(String[] props) { +/* 39 */ String[] scrpt = { "keyboard-style:", "ColorKeys:", "LastFunctionDir:", "LastLoadDir:", "calcsize:", "ontop:" }; +/* */ try { +/* 41 */ BufferedWriter out = new BufferedWriter(new FileWriter(this.dir)); +/* 42 */ for (int i = 0; i < props.length; i++) { +/* 43 */ out.write(scrpt[i] + props[i] + "\n"); +/* */ } +/* 45 */ out.close(); +/* */ } +/* */ catch (IOException localIOException) +/* */ { +/* */ } +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.PropertiesReader + * JD-Core Version: 0.6.2 + */
\ No newline at end of file diff --git a/src/StandardIO/SaveFileWriter.java b/src/StandardIO/SaveFileWriter.java new file mode 100644 index 0000000..98309b1 --- /dev/null +++ b/src/StandardIO/SaveFileWriter.java @@ -0,0 +1,20 @@ +/* */ package StandardIO; +/* */ +/* */ import java.io.IOException; +/* */ +/* */ public class SaveFileWriter extends MFileWriter +/* */ { +/* */ public SaveFileWriter(String file) +/* */ throws IOException +/* */ { +/* 14 */ super(file); +/* 15 */ println("Modulus 2.0.0 Save File"); +/* 16 */ super.writeDateAndTime(); +/* 17 */ println("------------------------------"); +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.SaveFileWriter + * JD-Core Version: 0.6.2 + */
\ No newline at end of file |