java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.StreamIn
com.github.stephengold.joltjni.StreamInWrapper
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A wrapper around an
std::ifstream
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
app()
Return the mode bit for a stream that appends to existing content.static int
ate()
Return the mode bit for a stream whose output position starts at the end of the file.static int
binary()
Return the mode bit for a binary-mode stream.static int
in()
Return the mode bit for a stream that supports input operations.boolean
isEof()
Test whether the stream has reached its end.static StreamInWrapper
Open a file for input.static int
out()
Return the mode bit for a stream that supports output operations.void
readFloat3
(Float3 storeFloats) Read 3 floats from the stream.int
readInt()
Read an integer from the stream.static int
trunc()
Return the mode bit for a stream that discards pre-existing content when opened.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
StreamInWrapper
Open aStringStream
for input.- Parameters:
data
- the underlying stream (not null)
-
-
Method Details
-
app
public static int app()Return the mode bit for a stream that appends to existing content.- Returns:
- the value of
std::ifstream::app
-
ate
public static int ate()Return the mode bit for a stream whose output position starts at the end of the file.- Returns:
- the value of
std::ifstream::ate
-
binary
public static int binary()Return the mode bit for a binary-mode stream.- Returns:
- the value of
std::ifstream::binary
-
in
public static int in()Return the mode bit for a stream that supports input operations.- Returns:
- the value of
std::ifstream::in
-
isEof
public boolean isEof()Test whether the stream has reached its end.- Returns:
true
if it has reached its end, otherwisefalse
-
open
Open a file for input.- Parameters:
fileName
- the name of the file to open (not null)streamMode
- the desired mode bits or-ed together- Returns:
- a new object, or
null
if the file wasn't opened successfully
-
readFloat3
Read 3 floats from the stream.- Parameters:
storeFloats
- storage for the values that were read (not null, modified)
-
readInt
public int readInt()Read an integer from the stream.- Returns:
- the value that was read
-
out
public static int out()Return the mode bit for a stream that supports output operations.- Returns:
- the value of
std::ifstream::out
-
trunc
public static int trunc()Return the mode bit for a stream that discards pre-existing content when opened.- Returns:
- the value of
std::ifstream::trunc
-