目录

MediaParcel

Class Info

public class MediaParcel

序列化数据的载体,将MediaPlayer内部的数据序列化,达到高效传输的目的。

Public Method Summary

Qualifier and Type

Method Name and Description

static MediaParcel

create()

创建一个MediaParcel的对象。

void

writeInt32(int value)

写入int类型的值。

void

writeInt64(long value)

写入long类型的值。

void

writeFloat(float value)

写入float类型的值。

void

writeDouble(double value)

写入double类型的值。

void

writeByteBuffer(ByteBuffer buffer)

写入ByteBuffer类型的数据。

int

readInt32()

读取int类型的值。

long

readInt64()

读取long类型的值。

float

readFloat()

读取float类型的值。

double

readDouble()

读取double类型的值。

ByteBuffer

readByteBuffer(int size)

读取ByteBuffer类型的数据。

int

getDataSize()

获取数据量。

int

getDataPos()

获取当前读取位置。

Public Methods

[h2]create

Method

public static MediaParcel create()

创建一个序列化数据的对象。

Returns

Type

Description

MediaParcel

返回一个序列化数据的对象。

[h2]writeInt32

Method

public void writeInt32(int value)

序列化写入int类型的数据。

Parameters

Name

Description

value

写入int类型的数据。

[h2]writeInt64

Method

public void writeInt64(long value)

序列化写入long类型的数据。

Parameters

Name

Description

value

写入long类型的数据。

[h2]writeFloat

Method

public void writeFloat(float value)

序列化写入float类型的数据。

Parameters

Name

Description

value

写入float类型的数据。

[h2]writeDouble

Method

public void writeDouble(double value)

序列化写入double类型的数据。

Parameters

Name

Description

value

写入double类型的数据。

[h2]writeByteBuffer

Method

public void writeByteBuffer(ByteBuffer buffer)

序列化写入ByteBuffer类型的数据。

Parameters

Name

Description

buffer

写入ByteBuffer类型的数据。

[h2]readInt32

Method

public int readInt32()

读取序列化数据中int类型的值。

Returns

Type

Description

int

返回序列化数据中int类型的值。

[h2]readInt64

Method

public long readInt64()

读取序列化数据中long类型的值。

Returns

Type

Description

long

返回序列化数据中long类型的值。

[h2]readFloat

Method

public float readFloat()

读取序列化数据中float类型的值。

Returns

Type

Description

float

返回序列化数据中float类型的值。

[h2]readDouble

Method

public double readDouble()

读取序列化数据中double类型的值。

Returns

Type

Description

double

返回序列化数据中double类型的值。

[h2]readByteBuffer

Method

public ByteBuffer readByteBuffer(int size)

读取序列化数据中ByteBuffer类型的数据。

Returns

Type

Description

ByteBuffer

返回序列化数据中ByteBuffer类型的数据。

[h2]getDataSize

Method

public int getDataSize()

获取序列化数据的长度。

Returns

Type

Description

int

返回序列化数据的长度。

[h2]getDataPos

Method

public int getDataPos()

获取序列化数据当前的读取位置。

Returns

Type

Description

int

返回序列化数据的当前读取位置,取值范围为[0, getDataSize())。