public final class FileReading extends Object implements Closeable
Example:
final Media file = Medias.create("test.txt"); try (FileReading reading = new FileReading(file)) { reading.readBoolean(); reading.readByte(); reading.readChar(); reading.readShort(); reading.readInteger(); reading.readFloat(); reading.readLong(); reading.readDouble(); } catch (final IOException exception) { Assert.fail(exception.getMessage()); }
Constructor and Description |
---|
FileReading(Media media)
Internal constructor.
|
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).
|
String |
readString()
Read a sequence of characters (2 bytes and more).
|
public FileReading(Media media)
media
- The media path.LionEngineException
- If error when opening the media.public boolean readBoolean() throws IOException
true
or false
).IOException
- If read failed.public byte readByte() throws IOException
IOException
- If read failed.public char readChar() throws IOException
IOException
- If read failed.public short readShort() throws IOException
IOException
- If read failed.public int readInteger() throws IOException
IOException
- If read failed.public float readFloat() throws IOException
IOException
- If read failed.public long readLong() throws IOException
IOException
- If read failed.public double readDouble() throws IOException
IOException
- If read failed.public String readString() throws IOException
IOException
- If read failed.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- If close failed.Copyright © 2017 Byron 3D Games Studio. All rights reserved.