SourceForge.net Logo

Simplest client code example

// SimplestExample.java

package org.vorbis.tageditor;

import java.io.File;
import java.io.IOException;

import org.vorbis.tageditor.exception.InvalidOggFileException;

public class SimplestExample {

  public static void main(String[] args) {
    // Open the ogg file and read it
    try {
      OggFile ogg = new OggFile(new File("c:\\test.ogg"));
      // Set some comments ...
      ogg.addComment("ALBUM","test");
      ogg.addComment("ARTIST","test");
      // ... and write down the file on the filesystem
      ogg.writeFile();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (InvalidOggFileException e) {
      e.printStackTrace();
    }
  }

}