public interface FileWriting
extends java.io.Closeable
Example:
final Media file = Media.get("test.txt"); try (FileWriting writing = File.createFileWriting(file);) { writing.writeBoolean(true); writing.writeByte((byte) 1); writing.writeChar('c'); writing.writeShort((short) 2); writing.writeInteger(1); writing.writeFloat(5.1f); writing.writeLong(6L); writing.writeDouble(7.1); } catch (final IOException exception) { Assert.fail(exception.getMessage()); }
Modifier and Type | Method and Description |
---|---|
void |
close()
Terminate writing, close file.
|
void |
writeBoolean(boolean b)
Write a boolean (1 bit,
true or false ). |
void |
writeByte(byte b)
Write a byte (1 byte, -128 to 127 both included).
|
void |
writeChar(char c)
Write a char (2 bytes, 0 to 65535 both included).
|
void |
writeDouble(double d)
Write a double (8 bytes, 4.94065645841246544e-324 to 1.79769313486231570e+308).
|
void |
writeFloat(float f)
Write a float (4 bytes, 1.40129846432481707e-45 to 3.40282346638528860e+38).
|
void |
writeInteger(int i)
Write an integer (4 bytes, -2.147.483.648 to 2.147.483.647 both included).
|
void |
writeLong(long l)
Write a long (8 bytes, -9.223.372.036.854.775.808 to 9.223.372.036.854.775.807).
|
void |
writeShort(short s)
Write a short (2 bytes, -32.768 to 32.767 both included).
|
void |
writeString(java.lang.String s)
Write a sequence of characters (2 bytes and more).
|
void writeBoolean(boolean b) throws java.io.IOException
true
or false
).b
- The boolean to writejava.io.IOException
- If write failed.void writeByte(byte b) throws java.io.IOException
b
- The byte to write.java.io.IOException
- If write failed.void writeChar(char c) throws java.io.IOException
c
- The char to write.java.io.IOException
- If write failed.void writeShort(short s) throws java.io.IOException
s
- The short to write.java.io.IOException
- If write failed.void writeInteger(int i) throws java.io.IOException
i
- The integer to write.java.io.IOException
- If write failed.void writeFloat(float f) throws java.io.IOException
f
- The float to write.java.io.IOException
- If write failed.void writeLong(long l) throws java.io.IOException
l
- The long to write.java.io.IOException
- If write failed.void writeDouble(double d) throws java.io.IOException
d
- The double to write.java.io.IOException
- If write failed.void writeString(java.lang.String s) throws java.io.IOException
s
- The string to write.java.io.IOException
- If write failed.void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException
- If write failed.