Examples of InputStreamDataInput


Examples of org.apache.lucene.store.InputStreamDataInput

      return false;
    }

    InputStream is = new BufferedInputStream(new FileInputStream(data));
    try {
      this.automaton = new FST<Object>(new InputStreamDataInput(is), NoOutputs.getSingleton());
      cacheRootArcs();
    } finally {
      IOUtils.closeSafely(false, is);
    }
    return true;
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

    return true;
  }

  @Override
  public boolean load(InputStream input) throws IOException {
    DataInput in = new InputStreamDataInput(input);
    CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_START);
    byte separatorOrig = in.readByte();
    if (separatorOrig != separator) {
      throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
    }
    int gramsOrig = in.readVInt();
    if (gramsOrig != grams) {
      throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
    }
    totTokens = in.readVLong();

    fst = new FST<Long>(in, PositiveIntOutputs.getSingleton());

    return true;
  }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

   */
  public static <T> FST<T> read(File file, Outputs<T> outputs) throws IOException {
    InputStream is = new BufferedInputStream(new FileInputStream(file));
    boolean success = false;
    try {
      FST<T> fst = new FST<T>(new InputStreamDataInput(is), outputs);
      success = true;
      return fst;
    } finally {
      if (success) {
        IOUtils.close(is);
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

    InputStream is = null;
    FST<Long> fst = null;
    try {
      is = getResource(FST_FILENAME_SUFFIX);
      is = new BufferedInputStream(is);
      fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
    } catch (IOException ioe) {
      priorE = ioe;
    } finally {
      IOUtils.closeWhileHandlingException(priorE, is);
    }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

    return true;
  }

  @Override
  public boolean load(InputStream input) throws IOException {
    DataInput dataIn = new InputStreamDataInput(input);
    try {
      this.fst = new FST<Pair<Long,BytesRef>>(dataIn, new PairOutputs<Long,BytesRef>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
      maxAnalyzedPathsForOneInput = dataIn.readVInt();
      hasPayloads = dataIn.readByte() == 1;
    } finally {
      IOUtils.close(input);
    }
    return true;
  }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

  @Override
  public synchronized boolean load(InputStream input) throws IOException {
    try {
      this.higherWeightsCompletion = new FSTCompletion(new FST<Object>(
          new InputStreamDataInput(input), NoOutputs.getSingleton()));
      this.normalCompletion = new FSTCompletion(
          higherWeightsCompletion.getFST(), false, exactMatchFirst);
    } finally {
      IOUtils.close(input);
    }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

  }

  @Override
  public boolean load(InputStream input) throws IOException {
    try {
      this.fst = new FST<Long>(new InputStreamDataInput(input), PositiveIntOutputs.getSingleton());
    } finally {
      IOUtils.close(input);
    }
    return true;
  }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

   */
  public static <T> FST<T> read(File file, Outputs<T> outputs) throws IOException {
    InputStream is = new BufferedInputStream(new FileInputStream(file));
    boolean success = false;
    try {
      FST<T> fst = new FST<T>(new InputStreamDataInput(is), outputs);
      success = true;
      return fst;
    } finally {
      if (success) {
        IOUtils.close(is);
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

  /**
   * Calls {@link #load(DataInput)} after converting
   * {@link InputStream} to {@link DataInput}
   */
  public boolean load(InputStream input) throws IOException {
    DataInput dataIn = new InputStreamDataInput(input);
    try {
      return load(dataIn);
    } finally {
      IOUtils.close(input);
    }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

      return false;
    }

    InputStream is = new BufferedInputStream(new FileInputStream(data));
    try {
      this.automaton = new FST<Object>(new InputStreamDataInput(is), NoOutputs.getSingleton());
      cacheRootArcs();
    } finally {
      IOUtils.close(is);
    }
    return true;
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.