public class BinaryOutputFile
extends java.lang.Object
Constructor and Description |
---|
BinaryOutputFile()
Constructs an BinaryOutputFile, prompting the user via Dialog Box for a file to write to.
|
BinaryOutputFile(java.io.File file)
Constructs an BinaryOutputFile using the file provided.
|
BinaryOutputFile(java.lang.String filename)
Constructs an BinaryOutputFile and tries to open a file with the path provided in the String.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the file.
|
java.io.File |
getFile()
Returns the file being used
|
boolean |
successful()
Indicates whether or not the previous operation
was successful.
|
void |
writeBoolean(boolean b)
Writes a boolean to the file
|
void |
writeByte(byte b)
Writes a byte to the file
|
void |
writeChar(char c)
Writes a char to the file
|
void |
writeDouble(double d)
Writes a double to the file
|
void |
writeFloat(float f)
Writes a float to the file
|
void |
writeInt(int i)
Writes an int to the file
|
void |
writeLong(long l)
Writes a long to the file
|
void |
writeObject(java.lang.Object o)
Writes an Object to the file using serialization.
|
void |
writeShort(short s)
Writes a short to the file
|
void |
writeString(java.lang.String s)
Writes a String to the file
|
public BinaryOutputFile()
public BinaryOutputFile(java.lang.String filename)
filename
- the name of the file to write topublic BinaryOutputFile(java.io.File file)
file
- the file to write topublic java.io.File getFile()
public boolean successful()
public void close()
public void writeByte(byte b)
b
- a byte to be writtenpublic void writeChar(char c)
c
- char to be writtenpublic void writeDouble(double d)
d
- a double to be writtenpublic void writeFloat(float f)
f
- is written to be writtenpublic void writeInt(int i)
i
- is written to be writtenpublic void writeShort(short s)
s
- is written to be writtenpublic void writeLong(long l)
l
- is written to be writtenpublic void writeString(java.lang.String s)
s
- is written to be writtenpublic void writeBoolean(boolean b)
b
- is written to be writtenpublic void writeObject(java.lang.Object o)
o
- is written to be written