Giter VIP home page Giter VIP logo

java-ebml-editor's Introduction

Usage

try (EBMLEditor editor = new EBMLEditor("EBML filePath")) {

   // rootプロパティから各要素にアクセスします。
   UnsignedIntegerElement duration = editor.root.getU(Elements.Duration);
   System.out.println(duration.getValue());
    
   // 各要素の値を更新できます。
   duration.setValue(10000.0);
    
   // SimpleBlock/Block要素については、trackNumber、timecode、keyframe flag、invisible flag、discardable flagを取得・変更できます。
   BlockElement block = editor.root.getBlock(Elements.SimpleBlock);
   System.out.println(block.timecode);
   block.timecode = 2000;
    
   // 要素を生成し、新しく追加することもできます。
   DateElement dateUTC = (DateElement) Elements.createElementById(null, Elements.DateUTC);
   dateUTC.setValue(new Date());
   editor.root.getM(Elements.Info).children.add(dateUTC);
   
   // 要素の削除もできます。
   editor.root.getM(Elements.Cluster).children.remove(1);
   
   // "Elements"と何度も書くのが面倒であれば、"E"をエイリアスとして使用できます。
   editor.root.getM(E.Cluster);
   
   // outputメソッドで変更内容を出力します。
   editor.output("outputPath");
}

Memory

// メモリ消費を抑えるため、構造のみ読み込みます。
// 各要素のデータ部は読み込みません。
try (EBMLEditor editor = new EBMLEditor("EBML file")) {

    UnsignedIntegerElement duration = editor.root.getU(Elements.Duration);
    
    // getValue/getDataを呼び出した際にファイルからデータを読み込みます。
    // 読み込んだデータもキャッシュしません。呼び出す度にI/Oが発生します。
    System.out.pringln(duration.getValue());
    
    // setValue/setDataを使って値を設定した場合、次にgetValue/getDataを呼び出した際は設定した値を返します。I/Oは発生しません。
    // setValueを使用してgetDataを呼び出した場合、setValueを使用してgetDataを呼び出した場合も同様です。
    duration.setValue(10000.0);
    System.out.pringln(duration.getValue()); // not I/O
    System.out.pringln(duration.getData());  // not I/O
    
    // clearValueを呼び出すと、設定した値がクリアされ、再度データをファイルから読み込むようになります。
    duration.clearValue();
    System.out.pringln(duration.getValue()); // I/O
}

java-ebml-editor's People

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.