/** * For audio data, append more audio data to the one currently present. If no audio data is set * yet, this call is equivalent to setAudio(). * * @param audioToAppend the new audio data to append */ public void appendAudio(AudioInputStream audioToAppend) { if (this.audio == null) setAudio(audioToAppend); else if (this.audio instanceof AppendableSequenceAudioInputStream) ((AppendableSequenceAudioInputStream) this.audio).append(audioToAppend); else this.audio = new SequenceAudioInputStream( this.audio.getFormat(), Arrays.asList(new AudioInputStream[] {this.audio, audioToAppend})); }
/** * Read data from input stream <code>is</code>, in the appropriate way as determined by our <code> * type</code>. * * @param is the InputStream from which to read. * @param endMarker a string marking end of file. If this is null, read until end-of-file; if it * is non-null, read up to (and including) the first line containing the end marker string. * This will be ignored for audio data. * @throws ParserConfigurationException ParserConfigurationException * @throws SAXException SAXException * @throws IOException IOException * @throws TransformerConfigurationException TransformerConfigurationException * @throws TransformerException TransformerException */ public void readFrom(InputStream is, String endMarker) throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException, TransformerException { if (type.isXMLType() || type.isTextType()) readFrom(new InputStreamReader(is, "UTF-8"), endMarker); else { // audio // ignore endMarker setAudio((AudioInputStream) is); } }