Examples of IndexInputStream


Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

            names.clear();
            indexes.clear();
            if (dir.fileExists(name))
            {
               // clear current lists
               InputStream in = new IndexInputStream(dir.openInput(name));
               DataInputStream di = null;
               try
               {
                  di = new DataInputStream(in);
                  counter = di.readInt();
                  for (int i = di.readInt(); i > 0; i--)
                  {
                     String indexName = di.readUTF();
                     indexes.add(indexName);
                     names.add(indexName);
                  }
               }
               finally
               {
                  if (di != null)
                     di.close();
                  in.close();
               }
            }
            return null;
         }
      });
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

    * @throws IOException
    */
   private void rename(String from, String to) throws IOException
   {
      IndexOutputStream out = null;
      IndexInputStream in = null;
      try
      {
         out = new IndexOutputStream(dir.createOutput(to));
         in = new IndexInputStream(dir.openInput(from));
         DirectoryHelper.transfer(in, out);
      }
      finally
      {
         if (in != null)
         {
            in.close();
         }

         if (out != null)
         {
            out.flush();
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

   {
      if (!dir.fileExists(REDO_LOG))
      {
         return;
      }
      InputStream in = new IndexInputStream(dir.openInput(REDO_LOG));
      try
      {
         BufferedReader reader = new BufferedReader(new InputStreamReader(in));
         String line;
         while ((line = reader.readLine()) != null)
         {
            try
            {
               collector.collect(MultiIndex.Action.fromString(line));
            }
            catch (IllegalArgumentException e)
            {
               log.warn("Malformed redo entry: " + e.getMessage());
            }
         }
      }
      finally
      {
         if (in != null)
         {
            try
            {
               in.close();
            }
            catch (IOException e)
            {
               log.warn("Exception while closing redo log: " + e.toString());
            }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

    */
   private void readStore() throws IOException
   {
      if (dir.fileExists(INDEXING_QUEUE_FILE))
      {
         InputStream in = new IndexInputStream(dir.openInput(INDEXING_QUEUE_FILE));
         BufferedReader reader = new BufferedReader(new InputStreamReader(in, ENCODING));
         try
         {
            String line;
            while ((line = reader.readLine()) != null)
            {
               int idx = line.indexOf(' ');
               if (idx == -1)
               {
                  // invalid line
                  log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
               }
               else
               {
                  String cmd = line.substring(0, idx);
                  String uuid = line.substring(idx + 1, line.length());
                  if (ADD.equals(cmd))
                  {
                     pending.add(uuid);
                  }
                  else if (REMOVE.equals(cmd))
                  {
                     pending.remove(uuid);
                  }
                  else
                  {
                     // invalid line
                     log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
                  }
               }
            }
         }
         finally
         {
            in.close();
         }
      }
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

        rand.nextBytes(data);
        Directory dir = new RAMDirectory();
        IndexOutput out = dir.createOutput("test");
        out.writeBytes(data, data.length);
        out.close();
        InputStream in = new IndexInputStream(dir.openInput("test"));
        if (buffer != 0) {
            in = new BufferedInputStream(in, buffer);
        }
        byte[] buf = new byte[3];
        int len;
        int pos = 0;
        while ((len = in.read(buf)) > -1) {
            for (int i = 0; i < len; i++, pos++) {
                assertEquals(data[pos], buf[i]);
            }
        }
        in.close();
        // assert length
        assertEquals(data.length, pos);
    }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

     *
     * @throws IOException if an error occurs while reading.
     */
    private void readStore() throws IOException {
        if (dir.fileExists(INDEXING_QUEUE_FILE)) {
            InputStream in = new IndexInputStream(dir.openInput(INDEXING_QUEUE_FILE));
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(in, ENCODING));
            try {
                String line;
                while ((line = reader.readLine()) != null) {
                    int idx = line.indexOf(' ');
                    if (idx == -1) {
                        // invalid line
                        log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
                    } else {
                        String cmd = line.substring(0, idx);
                        String uuid = line.substring(idx + 1, line.length());
                        if (ADD.equals(cmd)) {
                            pending.add(uuid);
                        } else if (REMOVE.equals(cmd)) {
                            pending.remove(uuid);
                        } else {
                            // invalid line
                            log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
                        }
                    }
                }
            } finally {
                in.close();
            }
        }
    }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

     */
    private void read(ActionCollector collector) throws IOException {
        if (!dir.fileExists(REDO_LOG)) {
            return;
        }
        InputStream in = new IndexInputStream(dir.openInput(REDO_LOG));
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
            String line;
            while ((line = reader.readLine()) != null) {
                try {
                    collector.collect(MultiIndex.Action.fromString(line));
                } catch (IllegalArgumentException e) {
                    log.warn("Malformed redo entry: " + e.getMessage());
                }
            }
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    log.warn("Exception while closing redo log: " + e.toString());
                }
            }
        }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

      names.clear();
      indexes.clear();
      if (dir.fileExists(name))
      {
         // clear current lists
         InputStream in = new IndexInputStream(dir.openInput(name));
         try
         {
            DataInputStream di = new DataInputStream(in);
            counter = di.readInt();
            for (int i = di.readInt(); i > 0; i--)
            {
               String indexName = di.readUTF();
               indexes.add(indexName);
               names.add(indexName);
            }
         }
         finally
         {
            in.close();
         }
      }
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

            {
            if (!dir.fileExists(REDO_LOG))
            {
               return null;
            }
            InputStream in = new IndexInputStream(dir.openInput(REDO_LOG));
            try
            {
               BufferedReader reader = new BufferedReader(new InputStreamReader(in));
               String line;
               while ((line = reader.readLine()) != null)
               {
                  try
                  {
                     collector.collect(MultiIndex.Action.fromString(line));
                  }
                  catch (IllegalArgumentException e)
                  {
                     log.warn("Malformed redo entry: " + e.getMessage());
                  }
               }
            }
            finally
            {
               if (in != null)
               {
                  try
                  {
                     in.close();
                  }
                  catch (IOException e)
                  {
                     log.warn("Exception while closing redo log: " + e.toString());
                  }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream

   {
      if (!dir.fileExists(REDO_LOG))
      {
         return;
      }
      InputStream in = new IndexInputStream(dir.openInput(REDO_LOG));
      try
      {
         BufferedReader reader = new BufferedReader(new InputStreamReader(in));
         String line;
         while ((line = reader.readLine()) != null)
         {
            try
            {
               collector.collect(MultiIndex.Action.fromString(line));
            }
            catch (IllegalArgumentException e)
            {
               log.warn("Malformed redo entry: " + e.getMessage());
            }
         }
      }
      finally
      {
         if (in != null)
         {
            try
            {
               in.close();
            }
            catch (IOException e)
            {
               log.warn("Exception while closing redo log: " + e.toString());
            }
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.