Creates a clip buffer for the sound clip loaded via the specified provider with the
specified path. The clip buffer may come from the cache, and it will immediately be queued
for loading if it is not already loaded.
505373
protected ClipBuffer getClip (ClipProvider provider, String path, Observer observer)
    {
        String ckey = ClipBuffer.makeKey(provider, path);
        ClipBuffer buffer = _clips.get(ckey);
        try {
            if (buffer == null) {
                // check to see if this clip is currently loading
                buffer = _loading.get(ckey);
                if (buffer == null) {
                    buffer = new ClipBuffer(this, provider, path);
                    _loading.put(ckey, buffer);
                }
            }
            buffer.resolve(observer);
            return buffer;

        } catch (Throwable t) {
            log.warning("Failure resolving buffer [key=" + ckey + "].", t);
            return null;
        }
    }
1246255
public static void playSound(String fileName, long offset, long length,
                                 boolean sync) {

        FileInputStream fis = null;
        try {
            if (player == null) {
                player = new MediaPlayer();
            }

            player.reset();
            fis = new FileInputStream(fileName);
            int available = fis.available();

            if (available < offset)
                return;

            if (length == -1 || length + offset > available) {
                length = available - offset;
            }

            player.setDataSource(fis.getFD(), offset, length);
            player.prepare();
            player.start();

            if (sync) {
                while (player.isPlaying()) {
                    Thread.sleep(30);
                }
            }

        } catch (Exception e) {
            Log.e(TAG, "", e);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
642501
@Nullable
    protected Uri createAttachmentFromString(@NonNull Context context, @NonNull String name, @NonNull String content) {
        final File cache = new File(context.getCacheDir(), name);
        try {
            IOUtils.writeStringToFile(cache, content);
            return AcraContentProvider.getUriForFile(context, cache);
        } catch (IOException ignored) {
        }
        return null;
    }
8788
static Config loadOvercastConfigFromClasspath(String path) {
        try {
            // resource.toURI().getPath() so path gets URL decoded so spaces are no issue
            // using resource.getPath() runs into a bug with guava
            return loadOvercastConfigFromFile(Resources.getResource(path).toURI().getPath());
        } catch (IllegalArgumentException | NullPointerException | URISyntaxException e) {
            logger.warn("File '{}' not found on classpath.", path);
        }
        return ConfigFactory.empty();
    }
595649
public void addClassPreload(final String path, final byte array[]) {
		try {
			this.preload.put(path, new SoftReference(
					new CGCCleaner(path, array)));
		} catch (Exception ignore) {
		}
	}
448565
public void loadPath(File path, String suffix, boolean recursively) {
    loadPath(path, new ExtensionFileFilter(suffix, recursively));
  }
139367
public static Request forAsset(String path) {
        String url = createUrl(ContentResolver.SCHEME_FILE, "/android_asset/", path);
        return new Request(url).addFlag(Flag.SKIP_DISK_CACHE);
    }
304233
private static InputStream getResourceAsStream(String path) throws IOException {
    if (StringUtils.isEmpty(path)) {
      return null;
    }

    // first try to load as file
    File file = new File(path);
    if (file.exists() && file.isFile()) {
      return new FileInputStream(file);
    }

    // if not a file fallback to classloader resource
    return CertificateLoader.class.getResourceAsStream(path);
  }
1140420
public Sound getSound (String path)
    {
        ClipBuffer buffer = null;
        if (_manager.isInitialized()) {
            buffer = _manager.getClip(_provider, path);
        }
        return (buffer == null) ? new BlankSound() : new Sound(this, buffer);
    }
943419
@Override
    protected void play (String pkgPath, String key, float pan)
    {
        addToPlayQueue(new SoundKey(PLAY, pkgPath, key, 0, _clipVol, pan));
    }
1363318
def _serve_file(self, path):
        
        fapp = paste.fileapp.FileApp(path)
        return fapp(request.environ, self.start_response)
653153
private synchronized ProviderLoader rescanForItem(final ProviderIdent ident) throws ProviderLoaderException {
        File candidate = null;
        PluginScanner cscanner = null;
        for (final PluginScanner scanner : getScanners()) {
            final File file = scanner.scanForFile(ident);
            if (null != file) {
                if (null != candidate) {
                    throw new ProviderLoaderException(
                            "More than one plugin file matched: " + file + ", and " + candidate,
                            ident.getService(), ident.getProviderName()
                    );
                }
                candidate = file;
                cscanner = scanner;
            }
        }
        if (null != candidate) {
            final cacheItem cacheItem = new cacheItem(candidate, cscanner);
            cache.put(ident, cacheItem);
            return loadFileProvider(cacheItem);
        }
        return null;
    }
239920
function(self) {
    var url = self._src;

    // Check if the buffer has already been cached and use it instead.
    if (cache[url]) {
      // Set the duration from the cache.
      self._duration = cache[url].duration;

      // Load the sound into this Howl.
      loadSound(self);

      return;
    }

    if (/^data:[^;]+;base64,/.test(url)) {
      // Decode the base64 data URI without XHR, since some browsers don't support it.
      var data = atob(url.split(',')[1]);
      var dataView = new Uint8Array(data.length);
      for (var i=0; i<data.length; ++i) {
        dataView[i] = data.charCodeAt(i);
      }

      decodeAudioData(dataView.buffer, self);
    } else {
      // Load the buffer from the URL.
      var xhr = new XMLHttpRequest();
      xhr.open('GET', url, true);
      xhr.withCredentials = self._xhrWithCredentials;
      xhr.responseType = 'arraybuffer';
      xhr.onload = function() {
        // Make sure we get a successful response back.
        var code = (xhr.status + '')[0];
        if (code !== '0' && code !== '2' && code !== '3') {
          self._emit('loaderror', null, 'Failed loading audio file with status: ' + xhr.status + '.');
          return;
        }

        decodeAudioData(xhr.response, self);
      };
      xhr.onerror = function() {
        // If there is an error, switch to HTML5 Audio.
        if (self._webAudio) {
          self._html5 = true;
          self._webAudio = false;
          self._sounds = [];
          delete cache[url];
          self.load();
        }
      };
      safeXhrSend(xhr);
    }
  }
505508
private function loadFromCache($fq_classlike_name_lc, $file_path)
    {
        $cache_location = $this->getCacheLocationForClass($fq_classlike_name_lc, $file_path);

        if (file_exists($cache_location)) {
            if ($this->config->use_igbinary) {
                $storage = igbinary_unserialize((string)file_get_contents($cache_location));

                if ($storage instanceof ClassLikeStorage) {
                    return $storage;
                }

                return null;
            }

            $storage = unserialize((string)file_get_contents($cache_location));

            if ($storage instanceof ClassLikeStorage) {
                return $storage;
            }

            return null;
        }

        return null;
    }
1142615
protected void queueClipFailure (final ClipBuffer buffer)
    {
        _rqueue.postRunnable(new Runnable() {
            public void run () {
                _loading.remove(buffer.getKey());
                buffer.failed();
            }
        });
    }
633657
protected byte[] getClipData (SoundKey key)
        throws IOException, UnsupportedAudioFileException
    {
        byte[][] data;
        synchronized (_clipCache) {
            // if we're testing, clear all non-locked sounds every time
            if (isTesting()) {
                _clipCache.clear();
            }

            data = _clipCache.get(key);

            // see if it's in the locked cache (we first look in the regular
            // clip cache so that locked clips that are still cached continue
            // to be moved to the head of the LRU queue)
            if (data == null) {
                data = _lockedClips.get(key);
            }

            if (data == null) {
                // if there is a test sound, JUST use the test sound.
                InputStream stream = getTestClip(key);
                if (stream != null) {
                    data = new byte[1][];
                    data[0] = StreamUtil.toByteArray(stream);

                } else {
                    data = _loader.load(key.pkgPath, key.key);
                }

                _clipCache.put(key, data);
            }
        }

        return (data.length > 0) ? data[RandomUtil.getInt(data.length)] : null;
    }
132361
function loadSample(url, doAfterLoading) {
    var fetchSound = new XMLHttpRequest(); // Load the Sound with XMLHttpRequest
    fetchSound.open("GET", url, true); // Path to Audio File
    fetchSound.responseType = "arraybuffer"; // Read as Binary Data
    fetchSound.onload = function() {
        context.decodeAudioData(fetchSound.response, doAfterLoading);
    }
    fetchSound.send();
}