public class BlenderInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
protected byte[] |
cachedBuffer
The buffer we store the read data to.
|
protected int |
position
The current position of the read cursor.
|
protected int |
size
The total size of the stored data.
|
Constructor and Description |
---|
BlenderInputStream(java.io.InputStream inputStream)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
alignPosition(int bytesAmount)
This method aligns cursor position forward to a given amount of bytes.
|
void |
close() |
int |
getPointerSize()
This method returns the size of the pointer.
|
int |
getPosition()
This method returns the position of the read cursor.
|
java.lang.String |
getVersionNumber()
This method returns the blender version number where the file was created.
|
int |
read() |
int |
readByte()
This method reads 1 byte from the stream.
|
double |
readDouble()
This method reads 8-byte floating point number (double) from the stream.
|
float |
readFloat()
This method reads 4-byte floating point number (float) from the stream.
|
int |
readInt()
This method reads 4-byte number from the stream.
|
long |
readLong()
This method reads 8-byte number from the stream.
|
long |
readPointer()
This method reads the pointer value.
|
int |
readShort()
This method reads 2-byte number from the stream.
|
java.lang.String |
readString()
This method reads the string.
|
void |
setPosition(int position)
This method sets the current position of the read cursor.
|
protected byte[] cachedBuffer
protected int size
protected int position
public BlenderInputStream(java.io.InputStream inputStream) throws BlenderFileException
inputStream
- the stream we read data fromBlenderFileException
- this exception is thrown if the file header has some invalid datapublic int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int readByte()
public int readShort()
public int readInt()
public float readFloat()
public long readLong()
public double readDouble()
public long readPointer()
public java.lang.String readString()
public void setPosition(int position)
position
- the position of the read cursorpublic int getPosition()
public java.lang.String getVersionNumber()
public int getPointerSize()
public void alignPosition(int bytesAmount)
bytesAmount
- the byte amount to which we aligh the cursorpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException