Package org.terrier.utility.io

Examples of org.terrier.utility.io.RandomDataInput


   * @param startBitOffset the bit offset in the starting byte
   */
  public BitIn readReset(long startByteOffset, byte startBitOffset) throws IOException
  {
    try{
      RandomDataInput rdi = (RandomDataInput)rdim.clone();
      rdi.seek(startByteOffset);
      BitIn in = new BitInputStream(rdi);
      in.skipBits(startBitOffset);
      return in;
    } catch (CloneNotSupportedException e) {
      throw new WrappedIOException(e);
View Full Code Here


        final DataInputStream di = new DataInputStream(Files.openFileStream(dataFilename));
        _dataSource = new RandomDataInputAccessor(new RandomDataInputMemory(di, dataFileLength));
      } catch (OutOfMemoryError oome) {
        //logger.warn("OutOfMemoryError: Structure "+ structureName + " reading data file directly from disk");
        //logger.debug("Metadata will be read directly from disk");
        RandomDataInput rfi = Files.openFileRandom(dataFilename);
        _dataSource = (rfi instanceof RandomAccessFile)
          ? new ChannelByteAccessor((RandomAccessFile)rfi)
          : new RandomDataInputAccessor(rfi);
      }
      dataSource = _dataSource;
    }
    else if (fileSource.equals("file"))
    {
      //logger.warn("Structure "+ structureName + " reading data file directly from disk (SLOW)");
      //logger.debug("Metadata will be read directly from disk");
      RandomDataInput rfi = Files.openFileRandom(dataFilename);
      dataSource = (rfi instanceof RandomAccessFile)
        ? new ChannelByteAccessor((RandomAccessFile)rfi)
        : new RandomDataInputAccessor(rfi);
    }
    else
View Full Code Here

          //finished with index file
          dis.close();
        } catch (OutOfMemoryError oome) {
          //logger.warn("OutOfMemoryError: Structure "+ structureName + " reading lookup file directly from disk");
          //logger.debug("Metadata lookup will be read directly from disk: "+ length +" entries, size "+ dataFileLength + " bytes");
          RandomDataInput rfi = Files.openFileRandom(indexFilename);
          offsetLookup = new OnDiskDocid2OffsetLookup(
            rfi instanceof RandomAccessFile
              ? new ChannelByteAccessor((RandomAccessFile)rfi)
              : new RandomDataInputAccessor(rfi),
            length, dataFileLength
            );
        }
      }
      else
      {
        try{
          DataInputStream dis = new DataInputStream(Files.openFileStream(indexFilename));
          offsetLookup = new OnDiskDocid2OffsetLookup(new RandomDataInputAccessor(new RandomDataInputMemory(dis, indexFileLength)),length, dataFileLength);
          dis.close();
        }
        catch (OutOfMemoryError oome) {
          //logger.warn("OutOfMemoryError: Structure "+ structureName + " reading lookup file directly from disk");
          //logger.debug("Metadata lookup will be read directly from disk: "+ length +" entries, size "+ dataFileLength + " bytes");
          RandomDataInput rfi = Files.openFileRandom(indexFilename);
          offsetLookup = new OnDiskDocid2OffsetLookup(
            rfi instanceof RandomAccessFile
              ? new ChannelByteAccessor((RandomAccessFile)rfi)
              : new RandomDataInputAccessor(rfi),
            length, dataFileLength
            );
        }
      } 
    } else {
      //logger.warn("Structure "+ structureName + " reading lookup file directly from disk (SLOW)");
      //logger.debug("Metadata lookup will be read directly from disk: "+ length +" entries, size "+ dataFileLength + " bytes");
      RandomDataInput rfi = Files.openFileRandom(indexFilename);
      offsetLookup = new OnDiskDocid2OffsetLookup(
        rfi instanceof RandomAccessFile
          ? new ChannelByteAccessor((RandomAccessFile)rfi)
          : new RandomDataInputAccessor(rfi),
        length, dataFileLength
View Full Code Here

TOP

Related Classes of org.terrier.utility.io.RandomDataInput

Copyright © 2018 www.massapicom. 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.