|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectuk.co.petertribble.jumble.JumbleFile
public class JumbleFile
Convenience routines for accessing files. Allows for reading a file into a
String or arrays of bytes
| Constructor Summary | |
|---|---|
JumbleFile(java.io.File file)
Read a file, specified by a File object |
|
JumbleFile(java.lang.String filename)
Read a file, specified by name |
|
| Method Summary | |
|---|---|
java.lang.Object |
contents()
Gets the contents of the file. |
static java.lang.Object |
contents(java.io.File f)
Static utility method to read a file. |
byte[] |
getByteContents()
Gets the contents of the file, explicitly as a byte array |
static byte[] |
getByteContents(java.io.File f)
Static utility method to read a file into a byte array |
java.lang.String |
getMessage()
Get a status message, if any. |
java.lang.String |
getStringContents()
Gets the contents of the file as a String |
static java.lang.String |
getStringContents(java.io.File f)
Static utility method to read a file into a String |
static boolean |
put(java.io.File f,
java.lang.Object data)
Static utility method to write to a file. |
boolean |
put(java.lang.Object data)
Write to a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JumbleFile(java.lang.String filename)
filename - The name of the file to be readpublic JumbleFile(java.io.File file)
File object
file - The File to be read| Method Detail |
|---|
public java.lang.Object contents()
Object
which is exactly the byte array returned by the
getByteContents() method
Objectpublic byte[] getByteContents()
byte array
bytespublic java.lang.String getStringContents()
String
Stringpublic boolean put(java.lang.Object data)
data - The data to be written, which must either be a
String or an array of bytes
getMessage() to determine why the write failed.public java.lang.String getMessage()
public static java.lang.Object contents(java.io.File f)
f - A File to be read.
Objectpublic static byte[] getByteContents(java.io.File f)
byte array
f - A File to be read.
bytespublic static java.lang.String getStringContents(java.io.File f)
String
f - A File to be read.
String
public static boolean put(java.io.File f,
java.lang.Object data)
f - A File to be written to.data - The data to be written, which must either be a
String or an array of bytes
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||