Package at.jku.sii.sqlitereader.io

Examples of at.jku.sii.sqlitereader.io.ArrayDataInput


    file.seek(0); // seek to start
    for (int i = 0; i < numPages; ++i) {
      byte[] data = new byte[pageSize];
      file.readFully(data);
      // file.annotateLast(data.length, "Page", i + 1);
      ArrayDataInput din = new ArrayDataInput(data, file.createLastSubAnnotator(data.length));
      pages.add(new RawDataPage(i, din));
    }
    return pages;
  }
View Full Code Here


  public static List<PayloadOverflowPage> readOverflowPages(SqliteDataBase db, int startPage) {
    List<PayloadOverflowPage> list = new ArrayList<PayloadOverflowPage>();
    int page = startPage;
    while (page > 0) {
      ArrayDataInput block = db.getPageBlock(page);
      int nextPage = block.readInt();
      block.annotateLastInt("nextPage", nextPage);

      int size = block.size() - 4;
      byte[] content = new byte[size];
      block.readFully(content);
      block.annotateLast(content.length, "Payload");
      ArrayDataInput in = new ArrayDataInput(content, block.createLastSubAnnotator(content.length));
      PayloadOverflowPage p = new PayloadOverflowPage(page, nextPage, in);
      list.add(p);
      db.resolvePage(page, p);
      page = nextPage;
    }
View Full Code Here

  public static List<FreeListPage> readPages(SqliteDataBase db, int firstFreeListPage, int numFreeListPages) {
    List<FreeListPage> pages = new ArrayList<FreeListPage>(numFreeListPages);
    int nextFreePage = firstFreeListPage;
    for (int i = 0; i < numFreeListPages; ++i) {
      ArrayDataInput block = db.getPageBlock(nextFreePage);
      int nextFreePage2 = block.readInt();
      block.annotateLastInt("nextFreePage", nextFreePage2);

      int numEntries = block.readInt("numEntries");
      List<FreePage> freePages = new ArrayList<FreePage>(numEntries);
      for (int j = 0; j < numEntries; ++j) {
        int freePage = block.readInt("freePage");
        FreePage p = new FreePage(freePage);
        db.resolvePage(freePage, p);
        freePages.add(p);
      }
      FreeListPage p = new FreeListPage(nextFreePage, nextFreePage2, freePages);
View Full Code Here

    int pmpPage = 2; //start at 2
    int pageOffset = 3;
    while (pmpPage < numPages) {

      ArrayDataInput block = db.getPageBlock(pmpPage);

      PointerMapPage page = read(pmpPage, pageOffset, Math.min(numPages - pageOffset + 1, j), block);
      db.resolvePage(pmpPage, page);

      pages.add(page);
View Full Code Here

  PayloadCell(Varint numPayloadBytes, Type type, ArrayDataInput in, SqliteDataBase db) {
    this.numPayloadBytes = numPayloadBytes.value;
    int payloadSize = getInternalPayloadSize(type, db, this.numPayloadBytes);
    byte[] data = new byte[payloadSize];
    in.readFully(data);
    this.payload = new ArrayDataInput(data, in.createLastSubAnnotator(payloadSize));
    in.annotateLast(payloadSize, "Payload");

    if (payloadSize < this.numPayloadBytes) {
      this.overflowPage = in.readInt("overflowPage");
      this.overflowPages = new ArrayList<PayloadOverflowPage>();
View Full Code Here

  private BTreePages() {

  }

  public static BTreePage<TableCell> readMaster(SqliteDataBase db) {
    final ArrayDataInput block = db.getPageBlock(1);
    block.seek(SqliteDataBase.HEADER_SIZE); // as we have the first block skip the header
    @SuppressWarnings("unchecked")
    BTreePage<TableCell> tree = (BTreePage<TableCell>) read(db, 1, block);
    db.resolvePage(1, tree);
    return tree;
  }
View Full Code Here

    db.resolvePage(1, tree);
    return tree;
  }

  public static BTreePage<? extends Cell> read(SqliteDataBase db, int page) {
    ArrayDataInput block = db.getPageBlock(page);
    BTreePage<? extends Cell> tree = read(db, page, block);
    db.resolvePage(page, tree);
    return tree;
  }
View Full Code Here

TOP

Related Classes of at.jku.sii.sqlitereader.io.ArrayDataInput

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.