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

Method close

core/src/main/java/org/gagravarr/opus/OpusFile.java:193–225  ·  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

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

Callers 4

mainMethod · 0.95
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