Example #1
0
 private TypeWrapper DefineDynamic(string name, java.net.URL url)
 {
     using (java.io.InputStream inp = url.openStream())
     {
         byte[] buf = new byte[inp.available()];
         inp.read(buf, 0, buf.Length);
         return TypeWrapper.FromClass(Java_java_lang_ClassLoader.defineClass1(GetJavaClassLoader(), name, buf, 0, buf.Length, GetProtectionDomain(), null));
     }
 }
 /// <summary>Obtains an audio input stream from the URL provided.</summary>
 /// <remarks>
 /// Obtains an audio input stream from the URL provided.
 /// The URL must point to valid audio file data.
 /// </remarks>
 /// <param name="url">the URL for which the AudioInputStream should be constructed.</param>
 /// <returns>
 /// an AudioInputStream object based on the audio file data pointed to
 /// by the URL.
 /// </returns>
 /// <exception>
 /// UnsupportedAudioFileException
 /// if the File does not point to
 /// a valid audio file data recognized by the system.
 /// </exception>
 /// <exception>
 /// IOException
 /// if an I/O exception occurs.
 /// </exception>
 /// <exception cref="javax.sound.sampled.UnsupportedAudioFileException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public override javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.net.URL
     url)
 {
     java.io.InputStream inputStream = url.openStream();
     try
     {
         return getAudioFileFormat(inputStream);
     }
     finally
     {
         inputStream.close();
     }
 }
		private TypeWrapper DefineDynamic(string name, java.net.URL url)
		{
			using (java.io.InputStream inp = url.openStream())
			{
				byte[] buf = new byte[inp.available()];
				for (int pos = 0; pos < buf.Length; )
				{
					int read = inp.read(buf, pos, buf.Length - pos);
					if (read <= 0)
					{
						break;
					}
					pos += read;
				}
				return TypeWrapper.FromClass(Java_java_lang_ClassLoader.defineClass1(GetJavaClassLoader(), name, buf, 0, buf.Length, GetProtectionDomain(), null));
			}
		}
 /// <summary>Obtains an audio input stream from the URL provided.</summary>
 /// <remarks>
 /// Obtains an audio input stream from the URL provided.
 /// The URL must point to valid audio file data.
 /// </remarks>
 /// <param name="url">the URL for which the AudioInputStream should be constructed.</param>
 /// <returns>
 /// an AudioInputStream object based on the audio file data pointed to
 /// by the URL.
 /// </returns>
 /// <exception>
 /// UnsupportedAudioFileException
 /// if the File does not point to
 /// a valid audio file data recognized by the system.
 /// </exception>
 /// <exception>
 /// IOException
 /// if an I/O exception occurs.
 /// </exception>
 /// <exception cref="javax.sound.sampled.UnsupportedAudioFileException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public override javax.sound.sampled.AudioInputStream getAudioInputStream(java.net.URL
     url)
 {
     java.io.InputStream inputStream = url.openStream();
     try
     {
         return getAudioInputStream(inputStream);
     }
     catch (javax.sound.sampled.UnsupportedAudioFileException e)
     {
         inputStream.close();
         throw;
     }
     catch (System.IO.IOException e)
     {
         inputStream.close();
         throw;
     }
 }