⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sourcedataline.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="open(javax.sound.sampled.AudioFormat, int)"><!-- --></A><H3>open</H3><PRE>public void <B>open</B>(<A HREF="../../../javax/sound/sampled/AudioFormat.html">AudioFormat</A>&nbsp;format,                 int&nbsp;bufferSize)          throws <A HREF="../../../javax/sound/sampled/LineUnavailableException.html">LineUnavailableException</A></PRE><DL><DD>Opens the line with the specified format and suggested buffer size, causing the line to acquire any required system resources and become operational. <p> The buffer size is specified in bytes, but must represent an integral  number of sample frames.  Invoking this method with a requested buffer  size that does not meet this requirement may result in an  IllegalArgumentException.  The actual buffer size for the open line may  differ from the requested buffer size.  The value actually set may be  queried by subsequently calling <code><A HREF="../../../javax/sound/sampled/DataLine.html#getBufferSize()"><CODE>DataLine.getBufferSize()</CODE></A></code>.   <p> If this operation succeeds, the line is marked as open, and an  <code><A HREF="../../../javax/sound/sampled/LineEvent.Type.html#OPEN"><CODE>OPEN</CODE></A></code> event is dispatched to the  line's listeners. <p> Invoking this method on a line which is already open is illegal and may result in an <code>IllegalStateException</code>. <p> Note that some lines, once closed, cannot be reopened.  Attempts to reopen such a line will always result in a  <code>LineUnavailableException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>format</CODE> - the desired audio format<DD><CODE>bufferSize</CODE> - the desired buffer size<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/sampled/LineUnavailableException.html">LineUnavailableException</A></CODE> - if the line cannot be opened due to resource restrictions<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the buffer size does not represent  an integral number of sample frames<DD><CODE><A HREF="../../../java/lang/IllegalStateException.html">IllegalStateException</A></CODE> - if the line is already open<DD><CODE><A HREF="../../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the line cannot be opened due to security restrictions<DT><B>See Also: </B><DD><A HREF="../../../javax/sound/sampled/SourceDataLine.html#open(javax.sound.sampled.AudioFormat)"><CODE>open(AudioFormat)</CODE></A>, <A HREF="../../../javax/sound/sampled/Line.html#open()"><CODE>Line.open()</CODE></A>, <A HREF="../../../javax/sound/sampled/Line.html#close()"><CODE>Line.close()</CODE></A>, <A HREF="../../../javax/sound/sampled/Line.html#isOpen()"><CODE>Line.isOpen()</CODE></A>, <A HREF="../../../javax/sound/sampled/LineEvent.html"><CODE>LineEvent</CODE></A></DL></DD></DL><HR><A NAME="open(javax.sound.sampled.AudioFormat)"><!-- --></A><H3>open</H3><PRE>public void <B>open</B>(<A HREF="../../../javax/sound/sampled/AudioFormat.html">AudioFormat</A>&nbsp;format)          throws <A HREF="../../../javax/sound/sampled/LineUnavailableException.html">LineUnavailableException</A></PRE><DL><DD>Opens the line with the specified format, causing the line to acquire any  required system resources and become operational.      <p> The implementation chooses a buffer size, which is measured in bytes but  which encompasses an integral number of sample frames.  The buffer size  that the system has chosen may be queried by subsequently calling  <code><A HREF="../../../javax/sound/sampled/DataLine.html#getBufferSize()"><CODE>DataLine.getBufferSize()</CODE></A></code>. <p> If this operation succeeds, the line is marked as open, and an  <code><A HREF="../../../javax/sound/sampled/LineEvent.Type.html#OPEN"><CODE>OPEN</CODE></A></code> event is dispatched to the  line's listeners. <p> Invoking this method on a line which is already open is illegal and may result in an <code>IllegalStateException</code>. <p> Note that some lines, once closed, cannot be reopened.  Attempts to reopen such a line will always result in a  <code>LineUnavailableException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>format</CODE> - the desired audio format<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/sampled/LineUnavailableException.html">LineUnavailableException</A></CODE> - if the line cannot be opened due to resource restrictions<DD><CODE><A HREF="../../../java/lang/IllegalStateException.html">IllegalStateException</A></CODE> - if the line is already open<DD><CODE><A HREF="../../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the line cannot be opened due to security restrictions<DT><B>See Also: </B><DD><A HREF="../../../javax/sound/sampled/SourceDataLine.html#open(javax.sound.sampled.AudioFormat, int)"><CODE>open(AudioFormat, int)</CODE></A>, <A HREF="../../../javax/sound/sampled/Line.html#open()"><CODE>Line.open()</CODE></A>, <A HREF="../../../javax/sound/sampled/Line.html#close()"><CODE>Line.close()</CODE></A>, <A HREF="../../../javax/sound/sampled/Line.html#isOpen()"><CODE>Line.isOpen()</CODE></A>, <A HREF="../../../javax/sound/sampled/LineEvent.html"><CODE>LineEvent</CODE></A></DL></DD></DL><HR><A NAME="write(byte[], int, int)"><!-- --></A><H3>write</H3><PRE>public int <B>write</B>(byte[]&nbsp;b,                 int&nbsp;off,                 int&nbsp;len)</PRE><DL><DD>Writes audio data to the mixer via this source data line.  The requested  number of bytes of data are read from the specified array,  starting at the given offset into the array, and written to the data  line's buffer.  If the caller attempts to write more data than can  currently be written (see <code><A HREF="../../../javax/sound/sampled/DataLine.html#available()"><CODE>available</CODE></A></code>),  this method blocks until the requested amount of data has been written.   This applies even if the requested amount of data to write is greater  than the data line's buffer size.  However, if the data line is closed,  stopped, or flushed before the requested amount has been written, the method no longer blocks, but returns the number of bytes  written thus far.  <p> The number of bytes that can be written without blocking can be ascertained using the <code><A HREF="../../../javax/sound/sampled/DataLine.html#available()"><CODE>available</CODE></A></code> method of the <code>DataLine</code> interface.  (While it is guaranteed that this number of bytes can be written without blocking, there is no guarantee that attempts to write additional data will block.) <p> The number of bytes to write must represent an integral number of sample frames, such that: <br> <center><code>[ bytes written ] % [frame size in bytes ] == 0</code></center> <br> The return value will always meet this requirement.  A request to write a  number of bytes representing a non-integral number of sample frames cannot  be fulfilled and may result in an <code>IllegalArgumentException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>b</CODE> - a byte array containing data to be written to the data line<DD><CODE>len</CODE> - the length, in bytes, of the valid data in the array  (in other words, the requested amount of data to write, in bytes)<DT><B>Returns:</B><DD>the number of bytes actually written<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the requested number of bytes does not represent an integral number of sample frames.<DT><B>See Also: </B><DD><A HREF="../../../javax/sound/sampled/TargetDataLine.html#read(byte[], int, int)"><CODE>TargetDataLine.read(byte[], int, int)</CODE></A>, <A HREF="../../../javax/sound/sampled/DataLine.html#available()"><CODE>DataLine.available()</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/SourceDataLine.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/sound/sampled/Port.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../javax/sound/sampled/TargetDataLine.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="SourceDataLine.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation  contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -