Package com.orbbec.obsensor

## Class Frame

- java.lang.Object
- - com.orbbec.obsensor.LobClass
  - - com.orbbec.obsensor.Frame

All Implemented Interfaces:
  `java.lang.AutoCloseable`, `java.lang.Cloneable`

Direct Known Subclasses:
  `AccelFrame`, `FrameSet`, `GyroFrame`, `PointFrame`, `VideoFrame`

    public class Frame
    extends LobClass
    implements java.lang.Cloneable

The data frame in the data stream is the base class of ColorFrame, DepthFrame, IRFrame, VideoFrame, FrameSet

### Field Summary

### Fields inherited from class com.orbbec.obsensor.LobClass

`handle, owner`

### Method Summary

All Methods Instance Methods Concrete Methods
`<T extends Frame> T` `as​(FrameType frameType)` Frame type conversion
`void` `close()` release data frame resources
`int` `getData​(byte[] buf)` Get the data of the dataframe
`int` `getData​(java.nio.ByteBuffer directByteBuffer)` Get the data of the dataFrame
`int` `getDataSize()` Get the data size of the data frame
`java.nio.ByteBuffer` `getDirectBuffer()` Get the buffer of frame data The buffer should be consumed before the frame closed
`Format` `getFormat()` Get the data stream format to which the data frame belongs
`long` `getFrameIndex()` Get the sequence number of the data frame in the data stream
`void` `getMetadata​(byte[] metadata)` Get the metadata of the frame
`int` `getMetadataSize()` Get the metadata size of the frame
`FrameType` `getStreamType()` Get the data stream type to which the data frame belongs
`long` `getSystemTimeStamp()` Get the system timestamp of the data frame, unit: ms
`long` `getTimeStamp()` Get the device timestamp of the data frame, unit: ms
`java.math.BigInteger` `getTimeStampUs()` Get the device timestamp of the data frame, unit: us

### Methods inherited from class com.orbbec.obsensor.LobClass

`getHandle, throwInitializeException`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### as

    public <T extends Frame> T as​(FrameType frameType)

Frame type conversion

Type Parameters:
  `T` - Subclass of frame
Parameters:
  `frameType` - frame type to be converted
Returns:
  New type of frame generated after conversion

#### getSystemTimeStamp

    public long getSystemTimeStamp()

Get the system timestamp of the data frame, unit: ms

Returns:
  system timestamp

#### getTimeStamp

    public long getTimeStamp()

Get the device timestamp of the data frame, unit: ms

Returns:
  device timestamp

#### getTimeStampUs

    public java.math.BigInteger getTimeStampUs()

Get the device timestamp of the data frame, unit: us

Returns:
  device timestamp

#### getStreamType

    public FrameType getStreamType()

Get the data stream type to which the data frame belongs

Returns:
  Data stream type

#### getFormat

    public Format getFormat()

Get the data stream format to which the data frame belongs

Returns:
  Data Stream

#### getFrameIndex

    public long getFrameIndex()

Get the sequence number of the data frame in the data stream

Returns:
  data frame number

#### getDataSize

    public int getDataSize()

Get the data size of the data frame

Returns:
  data size

#### getData

    public int getData​(byte[] buf)

Get the data of the dataframe

Parameters:
  `buf` - byte array to fill frame data
Returns:
  success, return the size of data had fill to buf; failed, return -1;

#### getData

    public int getData​(java.nio.ByteBuffer directByteBuffer)

Get the data of the dataFrame

Parameters:
  `directByteBuffer` - ByteBuffer to fill frame data.
Returns:
  success, return the size of data had fill to buf; failed, return -1;

#### getDirectBuffer

    public java.nio.ByteBuffer getDirectBuffer()

Get the buffer of frame data The buffer should be consumed before the frame closed

Returns:
  return the buffer of the frame data

#### getMetadataSize

    public int getMetadataSize()

Get the metadata size of the frame

Returns:
  Returns the metadata size of the frame

#### getMetadata

    public void getMetadata​(byte[] metadata)

Get the metadata of the frame

Parameters:
  `metadata` - frame metadata

#### close

    public void close()

release data frame resources

Specified by:
  `close` in interface `java.lang.AutoCloseable`