public class AudioFileFormat extends Object
AudioFileFormat
类的一个实例介绍了音频文件,包括文件类型,文件的字节长度,在文件中包含的音频样本数据帧的长度,和音频数据格式。
的
类包括确定音频文件格式的方法,从音频文件中获取音频输入流,从音频输入流写入一个音频文件。AudioSystem
一个AudioFileFormat
对象可以包括一组属性。房地产是一对键和值:关键是String
型,相关的属性值是一个任意的对象。属性指定额外的信息元数据(如作者、版权或文件持续时间)。属性是可选的信息,而文件阅读器和文件写入器实现不需要提供或识别属性。
下表列出了在实现中应使用的一些常见属性:
Property key | Value type | 描述 |
---|---|---|
"duration" | Long |
playback duration of the file in microseconds |
"author" | String |
name of the author of this file |
"title" | String |
title of this file |
"copyright" | String |
copyright message |
"date" | Date |
date of the recording or release |
"comment" | String |
an arbitrary text |
AudioInputStream
Modifier and Type | Class and Description |
---|---|
static class |
AudioFileFormat.Type
该
Type 类的实例表示一个音频文件的标准类型。
|
Modifier | Constructor and Description |
---|---|
|
AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength)
构建一个音频文件格式对象。
|
|
AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength, Map<String,Object> properties)
用一组定义的属性构造音频文件格式对象。
|
protected |
AudioFileFormat(AudioFileFormat.Type type, int byteLength, AudioFormat format, int frameLength)
构建一个音频文件格式对象。
|
Modifier and Type | Method and Description |
---|---|
int |
getByteLength()
获取整个音频文件的字节数(不只是它的音频数据)。
|
AudioFormat |
getFormat()
获取音频文件中包含的音频数据的格式。
|
int |
getFrameLength()
获取包含在文件中的音频数据的长度,在示例帧中表示。
|
Object |
getProperty(String key)
获取由键指定的属性值。
|
AudioFileFormat.Type |
getType()
得到的音频文件类型,如
WAVE 或
AU 。
|
Map<String,Object> |
properties()
获取一个属性不可修改的Map。
|
String |
toString()
提供文件格式的字符串表示形式。
|
protected AudioFileFormat(AudioFileFormat.Type type, int byteLength, AudioFormat format, int frameLength)
type
-音频文件的类型
byteLength
-文件长度的字节数,或
AudioSystem.NOT_SPECIFIED
format
-包含文件中的音频数据格式
frameLength
-样本帧的音频数据的长度,或
AudioSystem.NOT_SPECIFIED
getType()
public AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength)
type
-音频文件的类型
format
-包含文件中的音频数据格式
frameLength
-样本帧的音频数据的长度,或
AudioSystem.NOT_SPECIFIED
public AudioFileFormat(AudioFileFormat.Type type, AudioFormat format, int frameLength, Map<String,Object> properties)
type
-音频文件的类型
format
-包含文件中的音频数据格式
frameLength
-样本帧的音频数据的长度,或
AudioSystem.NOT_SPECIFIED
properties
-
Map<String,Object>
对象属性
public AudioFileFormat.Type getType()
WAVE
或
AU
。
public int getByteLength()
AudioSystem.NOT_SPECIFIED
public AudioFormat getFormat()
public int getFrameLength()
AudioSystem.NOT_SPECIFIED
public Map<String,Object> properties()
class description
进一步解释。
Map<String,Object>
对象。如果没有确认属性,则返回一个空的Map。
getProperty(String)
public Object getProperty(String key)
class description
进一步解释。
如果指定的属性不为特定的文件格式定义,此方法返回null
。
key
-预期性能的关键
null
如果属性不存在。
properties()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.