MCPcopy Index your code
hub / github.com/Gagravarr/VorbisJava / close

Method close

core/src/main/java/org/gagravarr/speex/SpeexFile.java:194–226  ·  view source on GitHub ↗

In Reading mode, will close the underlying ogg file and free its resources. In Writing mode, will write out the Info and Tags objects, and then the audio data.

()

Source from the content-addressed store, hash-verified

192 * Tags objects, and then the audio data.
193 */
194 public void close() throws IOException {
195 if(r != null) {
196 r = null;
197 ogg.close();
198 ogg = null;
199 }
200 if(w != null) {
201 w.bufferPacket(info.write(), true);
202 w.bufferPacket(tags.write(), false);
203
204 long lastGranule = 0;
205 for(SpeexAudioData vd : writtenPackets) {
206 // Update the granule position as we go
207 if(vd.getGranulePosition() >= 0 &&
208 lastGranule != vd.getGranulePosition()) {
209 w.flush();
210 lastGranule = vd.getGranulePosition();
211 w.setGranulePosition(lastGranule);
212 }
213
214 // Write the data, flushing if needed
215 w.bufferPacket(vd.write());
216 if(w.getSizePendingFlush() > 16384) {
217 w.flush();
218 }
219 }
220
221 w.close();
222 w = null;
223 ogg.close();
224 ogg = null;
225 }
226 }
227
228 /**
229 * Returns the underlying Ogg File instance

Callers 3

testReadWriteMethod · 0.95
testReadWriteReadMethod · 0.95
parseMethod · 0.95

Calls 6

bufferPacketMethod · 0.80
flushMethod · 0.80
getSizePendingFlushMethod · 0.80
writeMethod · 0.65
getGranulePositionMethod · 0.45
setGranulePositionMethod · 0.45

Tested by 2

testReadWriteMethod · 0.76
testReadWriteReadMethod · 0.76