📄 midisystem.html
字号:
</TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/midi/MidiSystem.html#isFileTypeSupported(int, javax.sound.midi.Sequence)">isFileTypeSupported</A></B>(int fileType, <A HREF="../../../javax/sound/midi/Sequence.html">Sequence</A> sequence)</CODE><BR> Indicates whether a MIDI file of the file type specified can be written from the sequence indicated.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/midi/MidiSystem.html#write(javax.sound.midi.Sequence, int, java.io.File)">write</A></B>(<A HREF="../../../javax/sound/midi/Sequence.html">Sequence</A> in, int type, <A HREF="../../../java/io/File.html">File</A> out)</CODE><BR> Writes a stream of bytes representing a file of the MIDI file type indicated to the external file provided.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/midi/MidiSystem.html#write(javax.sound.midi.Sequence, int, java.io.OutputStream)">write</A></B>(<A HREF="../../../javax/sound/midi/Sequence.html">Sequence</A> in, int fileType, <A HREF="../../../java/io/OutputStream.html">OutputStream</A> out)</CODE><BR> Writes a stream of bytes representing a file of the MIDI file type indicated to the output stream provided.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><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#toString()">toString</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></TD></TR></TABLE> <P><!-- ============ 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="getMidiDeviceInfo()"><!-- --></A><H3>getMidiDeviceInfo</H3><PRE>public static <A HREF="../../../javax/sound/midi/MidiDevice.Info.html">MidiDevice.Info</A>[] <B>getMidiDeviceInfo</B>()</PRE><DL><DD>Obtains an array of information objects representing the set of all MIDI devices available on the system. A returned information object can then be used to obtain the corresponding device object, by invoking <A HREF="../../../javax/sound/midi/MidiSystem.html#getMidiDevice(javax.sound.midi.MidiDevice.Info)"><CODE>getMidiDevice</CODE></A>.<DD><DL><DT><B>Returns:</B><DD>an array of <code>MidiDevice.Info</code> objects, one for each installed MIDI device. If no such devices are installed, an array of length 0 is returned.</DL></DD></DL><HR><A NAME="getMidiDevice(javax.sound.midi.MidiDevice.Info)"><!-- --></A><H3>getMidiDevice</H3><PRE>public static <A HREF="../../../javax/sound/midi/MidiDevice.html">MidiDevice</A> <B>getMidiDevice</B>(<A HREF="../../../javax/sound/midi/MidiDevice.Info.html">MidiDevice.Info</A> info) throws <A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></PRE><DL><DD>Obtains the requested MIDI device.<DD><DL><DT><B>Parameters:</B><DD><CODE>info</CODE> - a device information object representing the desired device.<DT><B>Returns:</B><DD>the requested device<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></CODE> - if the requested device is not available due to resource restrictions<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the info object does not represent a MIDI device installed on the system<DT><B>See Also: </B><DD><A HREF="../../../javax/sound/midi/MidiSystem.html#getMidiDeviceInfo()"><CODE>getMidiDeviceInfo()</CODE></A></DL></DD></DL><HR><A NAME="getReceiver()"><!-- --></A><H3>getReceiver</H3><PRE>public static <A HREF="../../../javax/sound/midi/Receiver.html">Receiver</A> <B>getReceiver</B>() throws <A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></PRE><DL><DD>Obtains a MIDI receiver from an external MIDI port or other default source.<DD><DL><DT><B>Returns:</B><DD>the default MIDI receiver<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></CODE> - if the default receiver is not available due to resource restrictions</DL></DD></DL><HR><A NAME="getTransmitter()"><!-- --></A><H3>getTransmitter</H3><PRE>public static <A HREF="../../../javax/sound/midi/Transmitter.html">Transmitter</A> <B>getTransmitter</B>() throws <A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></PRE><DL><DD>Obtains a MIDI transmitter from an external MIDI port or other default source.<DD><DL><DT><B>Returns:</B><DD>the default MIDI transmitter<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></CODE> - if the default transmitter is not available due to resource restrictions</DL></DD></DL><HR><A NAME="getSynthesizer()"><!-- --></A><H3>getSynthesizer</H3><PRE>public static <A HREF="../../../javax/sound/midi/Synthesizer.html">Synthesizer</A> <B>getSynthesizer</B>() throws <A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></PRE><DL><DD>Obtains the default synthesizer.<DD><DL><DT><B>Returns:</B><DD>the default synthesizer<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></CODE> - if the synthesizer is not available due to resource restrictions</DL></DD></DL><HR><A NAME="getSequencer()"><!-- --></A><H3>getSequencer</H3><PRE>public static <A HREF="../../../javax/sound/midi/Sequencer.html">Sequencer</A> <B>getSequencer</B>() throws <A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></PRE><DL><DD>Obtains the default sequencer.<DD><DL><DT><B>Returns:</B><DD>the default sequencer<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/MidiUnavailableException.html">MidiUnavailableException</A></CODE> - if the sequencer is not available due to resource restrictions</DL></DD></DL><HR><A NAME="getSoundbank(java.io.InputStream)"><!-- --></A><H3>getSoundbank</H3><PRE>public static <A HREF="../../../javax/sound/midi/Soundbank.html">Soundbank</A> <B>getSoundbank</B>(<A HREF="../../../java/io/InputStream.html">InputStream</A> stream) throws <A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A>, <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Constructs a MIDI sound bank by reading it from the specified stream. The stream must point to a valid MIDI soundbank file. In general, MIDI soundbank providers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.<DD><DL><DT><B>Parameters:</B><DD><CODE>stream</CODE> - the source of the sound bank data.<DT><B>Returns:</B><DD>the sound bank<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A></CODE> - if the stream does not point to valid MIDI soundbank data recognized by the system<DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurred when loading the soundbank<DT><B>See Also: </B><DD><A HREF="../../../java/io/InputStream.html#markSupported()"><CODE>InputStream.markSupported()</CODE></A>, <A HREF="../../../java/io/InputStream.html#mark(int)"><CODE>InputStream.mark(int)</CODE></A></DL></DD></DL><HR><A NAME="getSoundbank(java.net.URL)"><!-- --></A><H3>getSoundbank</H3><PRE>public static <A HREF="../../../javax/sound/midi/Soundbank.html">Soundbank</A> <B>getSoundbank</B>(<A HREF="../../../java/net/URL.html">URL</A> url) throws <A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A>, <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Constructs a <code>Soundbank</code> by reading it from the specified URL. The URL must point to a valid MIDI soundbank file.<DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - the source of the sound bank data<DT><B>Returns:</B><DD>the sound bank<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A></CODE> - if the URL does not point to valid MIDI soundbank data recognized by the system<DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurred when loading the soundbank</DL></DD></DL><HR><A NAME="getSoundbank(java.io.File)"><!-- --></A><H3>getSoundbank</H3><PRE>public static <A HREF="../../../javax/sound/midi/Soundbank.html">Soundbank</A> <B>getSoundbank</B>(<A HREF="../../../java/io/File.html">File</A> file) throws <A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A>, <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Constructs a <code>Soundbank</code> by reading it from the specified <code>File</code>. The <code>File</code> must point to a valid MIDI soundbank file.<DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - the source of the sound bank data<DT><B>Returns:</B><DD>the sound bank<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A></CODE> - if the <code>File</code> does not point to valid MIDI soundbank data recognized by the system<DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurred when loading the soundbank</DL></DD></DL><HR><A NAME="getMidiFileFormat(java.io.InputStream)"><!-- --></A><H3>getMidiFileFormat</H3><PRE>public static <A HREF="../../../javax/sound/midi/MidiFileFormat.html">MidiFileFormat</A> <B>getMidiFileFormat</B>(<A HREF="../../../java/io/InputStream.html">InputStream</A> stream) throws <A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A>, <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Obtains the MIDI file format of the data in the specified input stream. The stream must point to valid MIDI file data for a file type recognized by the system. <p> This method and/or the code it invokes may need to read some data from the stream to determine whether its data format is supported. The implementation may therefore need to mark the stream, read enough data to determine whether it is in a supported format, and reset the stream's read pointer to its original position. If the input stream does not permit this set of operations, this method may fail with an <code>IOException</code>. <p> This operation can only succeed for files of a type which can be parsed by an installed file reader. It may fail with an InvalidMidiDataException even for valid files if no compatible file reader is installed. It will also fail with an InvalidMidiDataException if a compatible file reader is installed, but encounters errors while determining the file format.<DD><DL><DT><B>Parameters:</B><DD><CODE>stream</CODE> - the input stream from which file format information should be extracted<DT><B>Returns:</B><DD>an <code>MidiFileFormat</code> object describing the MIDI file format<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A></CODE> - if the stream does not point to valid MIDI file data recognized by the system<DD><CODE><A HREF="../../../java/io/IOException.html">IOException</A></CODE> - if an I/O exception occurs while accessing the stream<DT><B>See Also: </B><DD><A HREF="../../../javax/sound/midi/MidiSystem.html#getMidiFileFormat(java.net.URL)"><CODE>getMidiFileFormat(URL)</CODE></A>, <A HREF="../../../javax/sound/midi/MidiSystem.html#getMidiFileFormat(java.io.File)"><CODE>getMidiFileFormat(File)</CODE></A>, <A HREF="../../../java/io/InputStream.html#markSupported()"><CODE>InputStream.markSupported()</CODE></A>, <A HREF="../../../java/io/InputStream.html#mark(int)"><CODE>InputStream.mark(int)</CODE></A></DL></DD></DL><HR><A NAME="getMidiFileFormat(java.net.URL)"><!-- --></A><H3>getMidiFileFormat</H3><PRE>public static <A HREF="../../../javax/sound/midi/MidiFileFormat.html">MidiFileFormat</A> <B>getMidiFileFormat</B>(<A HREF="../../../java/net/URL.html">URL</A> url) throws <A HREF="../../../javax/sound/midi/InvalidMidiDataException.html">InvalidMidiDataException</A>, <A HREF="../../../java/io/IOException.html">IOException</A></PRE><DL><DD>Obtains the MIDI file format of the data in the specified URL. The URL must point to valid MIDI file data for a file type recognized by the system. <p> This operation can only succeed for files of a type which can be parsed by an installed file reader. It may fail with an InvalidMidiDataException even for valid files if no compatible file reader is installed. It will also fail with an InvalidMidiDataException if a compatible file reader is installed, but encounters errors while determining the file format.<DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL from which file format information should be
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -