Code example for RandomAccessFile

Methods: readIntseek

   * Returns the Element for the given offset. 
  private Element readElement(int position) throws IOException {
    if (position == 0) return Element.NULL;;
    return new Element(position, raf.readInt());
  /** Atomically initializes a new file. */ 
  private static void initialize(File file) throws IOException {
    // Use a temp file so we don't leave a partially-initialized file. 
    File tempFile = new File(file.getPath() + ".tmp");
    RandomAccessFile raf = open(tempFile);
    try { 
      byte[] headerBuffer = new byte[16];
      writeInts(headerBuffer, INITIAL_LENGTH, 0, 0, 0);
Stop searching for code, let great code find you!  Add Codota to your java IDE