/**
  * This method initiates the next ogg-file that should be streamed. It always initiates the second
  * ogg file, because this file is the one that should loop.
  */
 private void initNext() {
   int tempCurrent = Math.abs(current - 1);
   try {
     URL ur = url[1];
     CachedUrlStream os = new CachedUrlStream(ur);
     loStream[tempCurrent] = os.getLogicalStreams().iterator().next();
     vStream[tempCurrent] = new VorbisStream(loStream[tempCurrent]);
     ais[tempCurrent] =
         new AudioInputStream(new VorbisInputStream(vStream[tempCurrent]), audioFormat, -1);
   } catch (OggFormatException e) {
     e.printStackTrace();
   } catch (VorbisFormatException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
  /** This method creates the streams from the URLs given in the constructor. */
  private void init() {
    try {
      CachedUrlStream os = new CachedUrlStream(url[current]);
      loStream[current] = os.getLogicalStreams().iterator().next();
      vStream[current] = new VorbisStream(loStream[current]);
      vStreamHdr = vStream[current].getIdentificationHeader();

      audioFormat =
          new AudioFormat(vStreamHdr.getSampleRate(), 16, vStreamHdr.getChannels(), true, true);

      ais[current] = new AudioInputStream(new VorbisInputStream(vStream[current]), audioFormat, -1);
      initNext();
    } catch (OggFormatException e) {
      e.printStackTrace();
    } catch (VorbisFormatException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }