Code example for RandomAccessFile

Methods: close, seek, writeInt

0
    output.writeInt(0); // Data chunk size not known yet, write 0
  } 
 
  private void finalizeFilePart(final RandomAccessFile output,
      int bytesWritten) throws IOException {
    output.seek(4); // Write size to RIFF header
    output.writeInt(Integer.reverseBytes(36 + bytesWritten));
    output.seek(40); // Write size to Subchunk2Size field
    output.writeInt(Integer.reverseBytes(bytesWritten));
    output.close();
  } 
 
  public void stopRecording(CountDownLatch latch) {
    mStopLatch.set(latch);
  } 
 
  public boolean finalize(Location location) {
    if (location == null) {
      throw new IllegalStateException("Trying to rename temp file without a "
          + "location."); 
    }