public interface FileReading
extends java.io.Closeable
Example:
final Media file = Media.get("test.txt"); try (FileReading reading = File.createFileReading(file);) { final boolean boolRead = reading.readBoolean(); final byte byteRead = reading.readByte(); final char charRead = reading.readChar(); final short shortRead = reading.readShort(); final int intRead = reading.readInteger(); final float floatRead = reading.readFloat(); final long longRead = reading.readLong(); final double doubleRead = reading.readDouble(); } catch (final IOException exception) { Assert.fail(exception.getMessage()); }
Modifier and Type | Method and Description |
---|---|
void |
close()
Terminate reading, close file.
|
boolean |
readBoolean()
Read a boolean (1 bit,
true or false ). |
byte |
readByte()
Read a byte (1 byte, -128 to 127 both included).
|
char |
readChar()
Read a char (2 bytes, 0 to 65535 both included).
|
double |
readDouble()
Read a double (8 bytes, 4.94065645841246544e-324 to 1.79769313486231570e+308 both included).
|
float |
readFloat()
Read a float (4 bytes, 1.40129846432481707e-45 to 3.40282346638528860e+38 both included).
|
int |
readInteger()
Read an integer (4 bytes, -2.147.483.648 to 2.147.483.647 both included).
|
long |
readLong()
Read a long (8 bytes, -9.223.372.036.854.775.808 to 9.223.372.036.854.775.807 both included).
|
short |
readShort()
Read a short (2 bytes, -32.768 to 32.767 both included).
|
java.lang.String |
readString()
Read a sequence of characters (2 bytes and more).
|
boolean readBoolean() throws java.io.IOException
true
or false
).java.io.IOException
- If read failed.byte readByte() throws java.io.IOException
java.io.IOException
- If read failed.char readChar() throws java.io.IOException
java.io.IOException
- If read failed.short readShort() throws java.io.IOException
java.io.IOException
- If read failed.int readInteger() throws java.io.IOException
java.io.IOException
- If read failed.float readFloat() throws java.io.IOException
java.io.IOException
- If read failed.long readLong() throws java.io.IOException
java.io.IOException
- If read failed.double readDouble() throws java.io.IOException
java.io.IOException
- If read failed.java.lang.String readString() throws java.io.IOException
java.io.IOException
- If read failed.void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException
- If close failed.