Class Index | File Index

## Classes

- _global_
- JSC3D
- JSC3D.AABB
- JSC3D.BinaryStream
- JSC3D.LoaderSelector
- JSC3D.Material
- JSC3D.Math3D
- JSC3D.Matrix3x4
- JSC3D.Mesh
- JSC3D.ObjLoader
- JSC3D.PickInfo
- JSC3D.Scene
- JSC3D.StlLoader
- JSC3D.Texture
- JSC3D.Viewer

# Class JSC3D.BinaryStream

BinaryStream The helper class to parse data from a binary stream.
Defined in: jsc3d.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JSC3D.BinaryStream(data, isBigEndian)

Method Summary
Method Attributes | Method Name and Description
--- | ---
| available() Get count of the remaining bytes in the stream.
| eof() See if the position indicator is already at the end of the stream.
| readBytes(buffer, bytesToRead) Read a piece of the stream into a given buffer.
| readFloat32() Read a 32-bits' (IEEE 754) floating point number.
| readFloat64() Read a 64-bits' (IEEE 754) floating point number.
| readInt16() Read a 16-bits' signed int number.
| readInt32() Read a 32-bits' signed int number.
| readInt8() Read an 8-bits' signed int number.
| readUInt16() Read a 16-bits' unsigned int number.
| readUInt32() Read a 32-bits' unsigned int number.
| readUInt8() Read an 8-bits' unsigned int number.
| reset() Reset the position indicator to the beginning of the stream.
| seek(position) Set the position indicator of the stream to a new position.
| size() Get the full length (in bytes) of the stream.
| skip(bytesToSkip) Advance the position indicator to skip a given number of bytes.
| tell() Get current position of the indicator.

Class Detail
JSC3D.BinaryStream(data, isBigEndian)

Parameters:
data
isBigEndian

Method Detail
{Number} available()
Get count of the remaining bytes in the stream.

Returns:
  {Number} the number of bytes from current position to the end of the stream.

{Boolean} eof()
See if the position indicator is already at the end of the stream.

Returns:
  {Boolean} true if the position indicator is at the end of the stream; false if not.

{Number} readBytes(buffer, bytesToRead)
Read a piece of the stream into a given buffer.

Parameters:
{Array} buffer
  the buffer to receive the result.
{Number} bytesToRead
  length of the piece to be read, in bytes.

Returns:
  {Number} the total number of bytes that are successfully read.

{Number} readFloat32()
Read a 32-bits' (IEEE 754) floating point number.

Returns:
  {Number} a 32-bits' floating point number, or NaN if any error occured.

{Number} readFloat64()
Read a 64-bits' (IEEE 754) floating point number.

Returns:
  {Number} a 64-bits' floating point number, or NaN if any error occured.

{Number} readInt16()
Read a 16-bits' signed int number.

Returns:
  {Number} a 16-bits' signed int number, or NaN if any error occured.

{Number} readInt32()
Read a 32-bits' signed int number.

Returns:
  {Number} a 32-bits' signed int number, or NaN if any error occured.

{Number} readInt8()
Read an 8-bits' signed int number.

Returns:
  {Number} an 8-bits' signed int number, or NaN if any error occured.

{Number} readUInt16()
Read a 16-bits' unsigned int number.

Returns:
  {Number} a 16-bits' unsigned int number, or NaN if any error occured.

{Number} readUInt32()
Read a 32-bits' unsigned int number.

Returns:
  {Number} a 32-bits' unsigned int number, or NaN if any error occured.

{Number} readUInt8()
Read an 8-bits' unsigned int number.

Returns:
  {Number} an 8-bits' unsigned int number, or NaN if any error occured.

reset()
Reset the position indicator to the beginning of the stream.

{Boolean} seek(position)
Set the position indicator of the stream to a new position.

Parameters:
{Number} position
  the new position.

Returns:
  {Boolean} true if succeeded; false if the given position is out of range.

{Number} size()
Get the full length (in bytes) of the stream.

Returns:
  {Number} the length of the stream.

skip(bytesToSkip)
Advance the position indicator to skip a given number of bytes.

Parameters:
{Number} bytesToSkip
  the number of bytes to skip.

{Number} tell()
Get current position of the indicator.

Returns:
  {Number} current position in stream.

Documentation generated by JsDoc Toolkit 2.1.0 on Thu Nov 28 2013 14:35:14 GMT+0800 (CST)