Package org.apache.lucene.store

Examples of org.apache.lucene.store.Directory.createOutput()


   
    checkStopNodes(fst, outputs);

    // Make sure it still works after save/load:
    Directory dir = newDirectory();
    IndexOutput out = dir.createOutput("fst", IOContext.DEFAULT);
    fst.save(out);
    out.close();

    IndexInput in = dir.openInput("fst", IOContext.DEFAULT);
    final FST<Long> fst2 = new FST<Long>(in, outputs);
View Full Code Here


          w.close();
          System.out.println("Wrote FST to out.dot");
        }

        Directory dir = FSDirectory.open(new File(dirOut));
        IndexOutput out = dir.createOutput("fst.bin", IOContext.DEFAULT);
        fst.save(out);
        out.close();
        System.out.println("Saved FST to fst.bin.");

        if (!verify) {
View Full Code Here

        Directory dest = getDirectory();
        String[] files = dir.list();
        for (int i = 0; i < files.length; i++) {
            IndexInput in = dir.openInput(files[i]);
            try {
                IndexOutput out = dest.createOutput(files[i]);
                try {
                    long remaining = in.length();
                    while (remaining > 0) {
                        int num = (int) Math.min(remaining, buffer.length);
                        in.readBytes(buffer, 0, num);
View Full Code Here

    checkStopNodes(fst, outputs);

    // Make sure it still works after save/load:
    Directory dir = newDirectory();
    IndexOutput out = dir.createOutput("fst", IOContext.DEFAULT);
    fst.save(out);
    out.close();

    IndexInput in = dir.openInput("fst", IOContext.DEFAULT);
    final FST<Long> fst2 = new FST<>(in, outputs);
View Full Code Here

          w.close();
          System.out.println("Wrote FST to out.dot");
        }

        Directory dir = FSDirectory.open(new File(dirOut));
        IndexOutput out = dir.createOutput("fst.bin", IOContext.DEFAULT);
        fst.save(out);
        out.close();
        System.out.println("Saved FST to fst.bin.");

        if (!verify) {
View Full Code Here

          }
          assertEquals(count, upto);

          if (verify == 0) {
            System.out.println("\nTEST: save/load FST and re-verify");
            IndexOutput out = dir.createOutput("fst", IOContext.DEFAULT);
            fst.save(out);
            out.close();
            IndexInput in = dir.openInput("fst", IOContext.DEFAULT);
            fst = new FST<>(in, outputs);
            in.close();
View Full Code Here

          }
          assertEquals(count, upto);

          if (verify == 0) {
            System.out.println("\nTEST: save/load FST and re-verify");
            IndexOutput out = dir.createOutput("fst", IOContext.DEFAULT);
            fst.save(out);
            out.close();
            IndexInput in = dir.openInput("fst", IOContext.DEFAULT);
            fst = new FST<>(in, outputs);
            in.close();
View Full Code Here

          }
          assertEquals(count, upto);

          if (verify == 0) {
            System.out.println("\nTEST: save/load FST and re-verify");
            IndexOutput out = dir.createOutput("fst", IOContext.DEFAULT);
            fst.save(out);
            out.close();
            IndexInput in = dir.openInput("fst", IOContext.DEFAULT);
            fst = new FST<>(in, outputs);
            in.close();
View Full Code Here

 
  /** simple encode/decode */
  public void testSimple() throws Exception {
    Directory dir = newDirectory();
    int bitsPerValue = DirectWriter.bitsRequired(2);
    IndexOutput output = dir.createOutput("foo", IOContext.DEFAULT);
    DirectWriter writer = DirectWriter.getInstance(output, 5, bitsPerValue);
    writer.add(1);
    writer.add(0);
    writer.add(2);
    writer.add(1);
View Full Code Here

 
  /** test exception is delivered if you add the wrong number of values */
  public void testNotEnoughValues() throws Exception {
    Directory dir = newDirectory();
    int bitsPerValue = DirectWriter.bitsRequired(2);
    IndexOutput output = dir.createOutput("foo", IOContext.DEFAULT);
    DirectWriter writer = DirectWriter.getInstance(output, 5, bitsPerValue);
    writer.add(1);
    writer.add(0);
    writer.add(2);
    writer.add(1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.