Package lupos.datastructures.buffermanager

Examples of lupos.datastructures.buffermanager.ContinousPagesInputStream


   */
  public final Quadruple<K, Long, Long, Long> getKey(final long address) {
    final int pagenumber = (int) (address / PageManager.getDefaultPageSize());
    final int index = (int) (address % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      final long numberOfKeyElements = InputHelper.readLuposLong(in);
      final long addressOfNextKey = InputHelper.readLuposLong(in);
      final K key = Registration.deserializeWithoutId(this.classOfKeys, in);
      in.close();
      return new Quadruple<K, Long, Long, Long>(key, addressOfValues, numberOfKeyElements, addressOfNextKey);
    } catch (final IOException e) {
      System.err.println(e);
      e.printStackTrace();
    } catch (final ClassNotFoundException e) {
View Full Code Here


*/
private final Triple<V, Long, Long> getElement(final long address) {
    final int pagenumber = (int) (address / PageManager.getDefaultPageSize());
    final int index = (int) (address % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      final long numberOfElements = InputHelper.readLuposLong(in);
      final long addressOfNextElement = InputHelper.readLuposLong(in);
      final V element = Registration.deserializeWithoutId(this.classOfValues, in);
      in.close();
      return new Triple<V, Long, Long>(element, numberOfElements, addressOfNextElement);
    } catch (final IOException e) {
      System.err.println(e);
      e.printStackTrace();
    } catch (final ClassNotFoundException e) {
View Full Code Here

    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.keysFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      long numberOfKeyElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfKeyElements>0){
        numberOfKeyElements--;
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
        OutHelper.writeLuposLong(addressOfValues, out);
        OutHelper.writeLuposLong(numberOfKeyElements, out);
View Full Code Here

    final int index = (int) (addressElement % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.valuesFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      long numberOfElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfElements>0){
        numberOfElements--;
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
        OutHelper.writeLuposLong(numberOfElements, out);
        out.close();
View Full Code Here

    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.keysFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      final long numberOfKeyElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfKeyElements>0){
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
        OutHelper.writeLuposLong(addressOfValues, out);
        OutHelper.writeLuposLong(0, out);
        out.close();
View Full Code Here

    final int index = (int) (addressElement % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.valuesFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      final long numberOfElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfElements>0){
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
        OutHelper.writeLuposLong(0, out);
        out.close();
        BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
View Full Code Here

   */
  public long getAddressOfValues(final long addressKey){
    final int pagenumber = (int) (addressKey / PageManager.getDefaultPageSize());
    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      in.close();
      return addressOfValues;
    } catch (final IOException e) {
      System.err.println(e);
      e.printStackTrace();
    }
View Full Code Here

   */
  public long getNumberOfKeyElements(final long addressKey){
    final int pagenumber = (int) (addressKey / PageManager.getDefaultPageSize());
    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      @SuppressWarnings("unused")
      final long addressOfValues = InputHelper.readLuposLong(in);
      final long numberOfKeyElements = InputHelper.readLuposLong(in);
      in.close();
      return numberOfKeyElements;
    } catch (final IOException e) {
      System.err.println(e);
      e.printStackTrace();
    }
View Full Code Here

  @SuppressWarnings("unused")
  private long getAddressOfNextKey(final long address){
    final int pagenumber = (int) (address / PageManager.getDefaultPageSize());
    final int index = (int) (address % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      final long numberOfKeyElements = InputHelper.readLuposLong(in);
      final long addressOfNextKey = InputHelper.readLuposLong(in);
      in.close();
      return addressOfNextKey;
    } catch (final IOException e) {
      System.err.println(e);
      e.printStackTrace();
    }
View Full Code Here

   */
  private long getNumberOfElements(final long addressElement){
    final int pagenumber = (int) (addressElement / PageManager.getDefaultPageSize());
    final int index = (int) (addressElement % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      final long numberOfElements = InputHelper.readLuposLong(in);
      in.close();
      return numberOfElements;
    } catch (final IOException e) {
      System.err.println(e);
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of lupos.datastructures.buffermanager.ContinousPagesInputStream

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.