1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.internal.sound.sampled; 18 19import java.net.URL; 20 21import javax.sound.sampled.AudioFormat; 22import javax.sound.sampled.AudioInputStream; 23 24/** 25 * Implements an AudioInputStream for Android. Its internal InputStream is 26 * unused (at least we don't care about the contents). Instead, we store the 27 * URL to the original audio data in it, so we can feed it into the Android 28 * MediaPlayer. 29 */ 30public class AndroidAudioInputStream extends AudioInputStream { 31 32 /** 33 * Holds the URL to the MIDI data. 34 */ 35 private URL url; 36 37 /** 38 * Creates a new AndroidAudioInputStream. 39 * 40 * @param url The URL that points to the audio data. 41 */ 42 public AndroidAudioInputStream(URL url) { 43 super(null, new AudioFormat(0.0f, 0, 0, false, false), 0); 44 45 this.url = url; 46 } 47 48 /** 49 * Returns the URL pointing to the audio data. 50 * 51 * @return The URL. 52 */ 53 URL getURL() { 54 return url; 55 } 56 57} 58