uTools-Manuals/docs/java/javax/sound/sampled/AudioFileFormat.html

469 lines
22 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
javax.sound.sampled
</div>
<h2 class="title" title="Class AudioFileFormat">Class AudioFileFormat</h2>
</div><div class="contentContainer">
<ul class="inheritance">
<li><a href="../../../java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>javax.sound.sampled.AudioFileFormat</li>
</ul> </li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr/> <br/> <pre>public class <span class="typeNameLabel">AudioFileFormat</span>
extends <a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></pre>
<div class="block">
<span><code>AudioFileFormat</code>类的一个实例描述了一个音频文件,包括文件类型,文件的长度(以字节为单位),文件中包含的音频数据的采样帧长度以及音频数据的格式。</span>
<p> <span><code><a href="../../../javax/sound/sampled/AudioSystem.html" title="class in javax.sound.sampled"><code>AudioSystem</code></a></code>类包括用于确定音频文件的格式,从音频文件获得音频输入流以及从音频输入流写入音频文件的方法。</span> </p>
<p> <span>一个<code>AudioFileFormat</code>对象可以包括一组属性。</span> <span>属性是一对键和值:键的类型为<code>String</code> ,关联的属性值是任意对象。</span> <span>属性指定附加的信息元数据(如作者,版权或文件持续时间)。</span> <span>属性是可选信息,文件读取器和文件写入器实现不需要提供或识别属性。</span> </p>
<p> <span>下表列出了在实现中应该使用的一些常见属性:</span> </p>
<span> Audio File Format Properties Property key Value type Description "duration" <a href="../../../java/lang/Long.html" title="class in java.lang"><code>Long</code></a> playback duration of the file in microseconds "author" <a href="../../../java/lang/String.html" title="class in java.lang"><code>String</code></a> name of the author of this file "title" <a href="../../../java/lang/String.html" title="class in java.lang"><code>String</code></a> title of this file "copyright" <a href="../../../java/lang/String.html" title="class in java.lang"><code>String</code></a> copyright message "date" <a href="../../../java/util/Date.html" title="class in java.util"><code>Date</code></a> date of the recording or release "comment" <a href="../../../java/lang/String.html" title="class in java.lang"><code>String</code></a> an arbitrary text </span>
<table border="1">
</table>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.3
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../javax/sound/sampled/AudioInputStream.html" title="javax.sound.sampled中的类"><code>AudioInputStream</code></a></span>
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- --> </a> <h3>Nested Class Summary</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption>
<span>Nested Classes</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a></span></code>
<div class="block">
<code>Type</code>类的一个实例表示音频文件的标准类型之一。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- --> </a> <h3>构造方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Constructor Summary table, listing constructors, and an explanation">
<caption>
<span>构造方法</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colLast" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code> </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#AudioFileFormat-javax.sound.sampled.AudioFileFormat.Type-javax.sound.sampled.AudioFormat-int-">AudioFileFormat</a></span>(<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> type, <a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> format, int frameLength)</code>
<div class="block">
构造音频文件格式对象。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code> </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#AudioFileFormat-javax.sound.sampled.AudioFileFormat.Type-javax.sound.sampled.AudioFormat-int-java.util.Map-">AudioFileFormat</a></span>(<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> type, <a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> format, int frameLength, <a href="../../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../../java/lang/String.html" title="class in java.lang">String</a>,<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a>&gt; properties)</code>
<div class="block">
使用一组定义的属性构建音频文件格式对象。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#AudioFileFormat-javax.sound.sampled.AudioFileFormat.Type-int-javax.sound.sampled.AudioFormat-int-">AudioFileFormat</a></span>(<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> type, int byteLength, <a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> format, int frameLength)</code>
<div class="block">
构造音频文件格式对象。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t2"><span><a href="javascript:show(2);">接口方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t4"><span><a href="javascript:show(8);">具体的方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#getByteLength--">getByteLength</a></span>()</code>
<div class="block">
获取整个音频文件(不仅仅是其音频数据)的字节大小。
</div> </td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code><a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#getFormat--">getFormat</a></span>()</code>
<div class="block">
获取包含在音频文件中的音频数据的格式。
</div> </td>
</tr>
<tr class="altColor" id="i2">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#getFrameLength--">getFrameLength</a></span>()</code>
<div class="block">
获取包含在文件中的音频数据的长度,以样本帧表示。
</div> </td>
</tr>
<tr class="rowColor" id="i3">
<td class="colFirst"><code><a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#getProperty-java.lang.String-">getProperty</a></span>(<a href="../../../java/lang/String.html" title="class in java.lang">String</a> key)</code>
<div class="block">
获取由密钥指定的属性值。
</div> </td>
</tr>
<tr class="altColor" id="i4">
<td class="colFirst"><code><a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#getType--">getType</a></span>()</code>
<div class="block">
获取音频文件类型,如
<code>WAVE</code>
<code>AU</code>
</div> </td>
</tr>
<tr class="rowColor" id="i5">
<td class="colFirst"><code><a href="../../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../../java/lang/String.html" title="class in java.lang">String</a>,<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#properties--">properties</a></span>()</code>
<div class="block">
获取不可修改的属性地图。
</div> </td>
</tr>
<tr class="altColor" id="i6">
<td class="colFirst"><code><a href="../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/sound/sampled/AudioFileFormat.html#toString--">toString</a></span>()</code>
<div class="block">
提供文件格式的字符串表示形式。
</div> </td>
</tr>
</tbody>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- --> </a> <h3>Methods inherited from class java.lang.<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></h3> <code><a href="../../../java/lang/Object.html#clone--">clone</a>, <a href="../../../java/lang/Object.html#equals-java.lang.Object-">equals</a>, <a href="../../../java/lang/Object.html#finalize--">finalize</a>, <a href="../../../java/lang/Object.html#getClass--">getClass</a>, <a href="../../../java/lang/Object.html#hashCode--">hashCode</a>, <a href="../../../java/lang/Object.html#notify--">notify</a>, <a href="../../../java/lang/Object.html#notifyAll--">notifyAll</a>, <a href="../../../java/lang/Object.html#wait--">wait</a>, <a href="../../../java/lang/Object.html#wait-long-">wait</a>, <a href="../../../java/lang/Object.html#wait-long-int-">wait</a></code></li>
</ul> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- --> </a> <h3>构造方法详细信息</h3> <a name="AudioFileFormat-javax.sound.sampled.AudioFileFormat.Type-int-javax.sound.sampled.AudioFormat-int-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>AudioFileFormat</h4> <pre>protected AudioFileFormat(<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> type,
int byteLength,
<a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> format,
int frameLength)</pre>
<div class="block">
<span>构造音频文件格式对象。</span>
<span>当返回有关音频文件的信息或支持的音频文件格式时,此受保护的构造函数旨在供文件读取服务提供者使用。</span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>type</code> - 音频文件的类型
</dd>
<dd>
<code>byteLength</code> - 以字节为单位的文件长度,或
<code>AudioSystem.NOT_SPECIFIED</code>
</dd>
<dd>
<code>format</code> - 文件中包含的音频数据的格式
</dd>
<dd>
<code>frameLength</code> - 样本帧中的音频数据长度,或
<code>AudioSystem.NOT_SPECIFIED</code>
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../javax/sound/sampled/AudioFileFormat.html#getType--"><code>getType()</code></a>
</dd>
</dl> </li>
</ul> <a name="AudioFileFormat-javax.sound.sampled.AudioFileFormat.Type-javax.sound.sampled.AudioFormat-int-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>AudioFileFormat</h4> <pre>public AudioFileFormat(<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> type,
<a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> format,
int frameLength)</pre>
<div class="block">
<span>构造音频文件格式对象。</span>
<span>应用程序可以使用该公共构造函数来描述所请求的音频文件的属性。</span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>type</code> - 音频文件的类型
</dd>
<dd>
<code>format</code> - 文件中包含的音频数据的格式
</dd>
<dd>
<code>frameLength</code> - 样本帧中的音频数据长度,或
<code>AudioSystem.NOT_SPECIFIED</code>
</dd>
</dl> </li>
</ul> <a name="AudioFileFormat-javax.sound.sampled.AudioFileFormat.Type-javax.sound.sampled.AudioFormat-int-java.util.Map-">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>AudioFileFormat</h4> <pre>public AudioFileFormat(<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> type,
<a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> format,
int frameLength,
<a href="../../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../../java/lang/String.html" title="class in java.lang">String</a>,<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a>&gt; properties)</pre>
<div class="block">
<span>使用一组定义的属性构建音频文件格式对象。</span>
<span>应用程序可以使用该公共构造函数来描述所请求的音频文件的属性。</span>
<span>将复制属性图以防止对其进行任何更改。</span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>type</code> - 音频文件的类型
</dd>
<dd>
<code>format</code> - 文件中包含的音频数据的格式
</dd>
<dd>
<code>frameLength</code> - 样本帧中的音频数据长度,或
<code>AudioSystem.NOT_SPECIFIED</code>
</dd>
<dd>
<code>properties</code> - 一个
<code>Map&lt;String,Object&gt;</code>具有
<code>Map&lt;String,Object&gt;</code>对象
</dd>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.5
</dd>
</dl> </li>
</ul> </li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="getType--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getType</h4> <pre>public <a href="../../../javax/sound/sampled/AudioFileFormat.Type.html" title="class in javax.sound.sampled">AudioFileFormat.Type</a> getType()</pre>
<div class="block">
获取音频文件类型,如
<code>WAVE</code>
<code>AU</code>
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
音频文件类型
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html#WAVE"><code>AudioFileFormat.Type.WAVE</code></a>
<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html#AU"><code>AudioFileFormat.Type.AU</code></a>
<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html#AIFF"><code>AudioFileFormat.Type.AIFF</code></a>
<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html#AIFC"><code>AudioFileFormat.Type.AIFC</code></a>
<a href="../../../javax/sound/sampled/AudioFileFormat.Type.html#SND"><code>AudioFileFormat.Type.SND</code></a>
</dd>
</dl> </li>
</ul> <a name="getByteLength--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getByteLength</h4> <pre>public int getByteLength()</pre>
<div class="block">
获取整个音频文件(不仅仅是其音频数据)的字节大小。
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
音频文件长度以字节为单位
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../javax/sound/sampled/AudioSystem.html#NOT_SPECIFIED"><code>AudioSystem.NOT_SPECIFIED</code></a>
</dd>
</dl> </li>
</ul> <a name="getFormat--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getFormat</h4> <pre>public <a href="../../../javax/sound/sampled/AudioFormat.html" title="class in javax.sound.sampled">AudioFormat</a> getFormat()</pre>
<div class="block">
获取包含在音频文件中的音频数据的格式。
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
音频数据格式
</dd>
</dl> </li>
</ul> <a name="getFrameLength--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getFrameLength</h4> <pre>public int getFrameLength()</pre>
<div class="block">
获取包含在文件中的音频数据的长度,以样本帧表示。
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
文件中音频数据的采样帧数
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../javax/sound/sampled/AudioSystem.html#NOT_SPECIFIED"><code>AudioSystem.NOT_SPECIFIED</code></a>
</dd>
</dl> </li>
</ul> <a name="properties--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>properties</h4> <pre>public <a href="../../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../../java/lang/String.html" title="class in java.lang">String</a>,<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a>&gt; properties()</pre>
<div class="block">
<span>获取不可修改的属性地图。</span>
<span>属性的概念在<code>class description</code>中进一步<a href="../../../javax/sound/sampled/AudioFileFormat.html" title="javax.sound.sampled中的类">解释</a></span>
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
<span>一个<code>Map&lt;String,Object&gt;</code>所有属性的<code>Map&lt;String,Object&gt;</code>对象。</span>
<span>如果没有属性被识别,则返回空的地图。</span>
</dd>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.5
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../javax/sound/sampled/AudioFileFormat.html#getProperty-java.lang.String-"><code>getProperty(String)</code></a>
</dd>
</dl> </li>
</ul> <a name="getProperty-java.lang.String-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getProperty</h4> <pre>public <a href="../../../java/lang/Object.html" title="class in java.lang">Object</a> getProperty(<a href="../../../java/lang/String.html" title="class in java.lang">String</a> key)</pre>
<div class="block">
<span>获取由密钥指定的属性值。</span>
<span>属性的概念在<code>class description</code>进一步<a href="../../../javax/sound/sampled/AudioFileFormat.html" title="javax.sound.sampled中的类">解释</a></span>
<p> <span>如果未为特定文件格式定义指定的属性,则此方法返回<code>null</code></span> </p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>key</code> - 所需属性的关键
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
具有指定键的属性值,如果属性不存在,
<code>null</code>
</dd>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.5
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../javax/sound/sampled/AudioFileFormat.html#properties--"><code>properties()</code></a>
</dd>
</dl> </li>
</ul> <a name="toString--">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>toString</h4> <pre>public <a href="../../../java/lang/String.html" title="class in java.lang">String</a> toString()</pre>
<div class="block">
提供文件格式的字符串表示形式。
</div>
<dl>
<dt>
<span class="overrideSpecifyLabel">重写:</span>
</dt>
<dd>
<code><a href="../../../java/lang/Object.html#toString--">toString</a></code>在类别
<code><a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></code>
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
文件格式为字符串
</dd>
</dl> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>