Package org.helidb.io

Examples of org.helidb.io.NotEnoughDataException


    int size = getLeafNodeSize(pos) - NODE_HEADER_SIZE;
    byte[] barr = new byte[size];
    int noRead = m_file.read(barr);
    if (noRead != size)
    {
      throw new NotEnoughDataException(size, noRead, pos + NODE_HEADER_SIZE);
    }
    return interpretLeafNodeData(pos, barr, 0);
  }
View Full Code Here


    int size = getNonLeafNodeSize(pos) - NODE_HEADER_SIZE;
    byte[] barr = new byte[size];
    int noRead = m_file.read(barr);
    if (noRead != size)
    {
      throw new NotEnoughDataException(size, noRead, pos);
    }
    int barrPos = 0;

    // Read the first pointer
    byte[] pointerBarr = new byte[m_nodePointerSize];
View Full Code Here

  private NodeHeader readNodeHeader(long pos)
  {
    int b = m_file.read();
    if (b == -1)
    {
      throw new NotEnoughDataException(1, 0, pos);
    }

    // Read the node header
    try
    {
View Full Code Here

    byte[] barr = new byte[nodeSize];
    m_file.seek(oldPos);
    int noRead = m_file.read(barr);
    if (noRead < nodeSize)
    {
      throw new NotEnoughDataException(nodeSize, noRead, oldPos);
    }
    m_file.seek(newPos);
    m_file.write(barr);
    m_file.seek(oldPos);
    m_file.write(deletedNodeHeader.getByte());
View Full Code Here

    m_file.seek(m_startPosOfData);
    m_file.setLength(0L);
    long noRead = StreamUtil.copyStreams(is, new RandomAccessToOutputStreamAdapter(m_file), m_bufSize, dataLen);
    if (noRead != dataLen)
    {
      throw new NotEnoughDataException(dataLen, noRead);
    }

    m_deletedNodes = scanDeletedNodes(m_file, m_startPosOfData, m_nodeSizeStrategy, getNodeSize(m_startPosOfData, null), m_logAdapterHolder);
    m_bookedLeafNodePositions.clear();
    m_bookedNonLeafNodePositions.clear();
View Full Code Here

      int noToMoveInPass = Math.min(noToMove, m_bufferSize);
      m_dbFile.seek(curReadPos);
      int noRead = m_dbFile.read(barr, 0, noToMoveInPass);
      if (noRead != noToMoveInPass)
      {
        throw new NotEnoughDataException(noToMoveInPass, noRead);
      }
      m_dbFile.seek(curWritePos);
      m_dbFile.write(barr, 0, noToMoveInPass);
      curReadPos += noToMoveInPass;
      curWritePos += noToMoveInPass;
      noToMove -= noToMoveInPass;
    }

    // Only bother to do this if we have record move listeners.
    if (hasRecordMoveListeners())
    {
      byte[] keySizeArr = new byte[KEY_SIZE_SIZE];
      long pos = writePos + 1 + RECORD_SIZE_SIZE;
      m_dbFile.seek(pos);
      int noRead = m_dbFile.read(keySizeArr);
      if (noRead != KEY_SIZE_SIZE)
      {
        throw new NotEnoughDataException(KEY_SIZE_SIZE, noRead, pos);
      }
      int keySize = IntegerSerializer.getInteger(keySizeArr);
      byte[] karr = new byte[keySize];
      noRead = m_dbFile.read(karr);
      if (noRead != keySize)
      {
        throw new NotEnoughDataException(KEY_SIZE_SIZE, noRead, pos + KEY_SIZE_SIZE);
      }
      K key = m_keySerializer.interpret(karr);
      notifyRecordMoveListeners(key, readPos, writePos);
    }
  }
View Full Code Here

    m_dbFile.seek(m_startPosOfDb);
    m_dbFile.setLength(m_startPosOfDb);
    long noCopied = StreamUtil.copyStreams(new RandomAccessToInputStreamAdapter(ra), new RandomAccessToOutputStreamAdapter(m_dbFile), m_bufferSize, dataSize);
    if (noCopied != dataSize)
    {
      throw new NotEnoughDataException(dataSize, noCopied, m_startPosOfDb);
    }
    updateContentsVersion();
  }
View Full Code Here

    validateDataSize(dataSize);
    byte[] barr = new byte[dataSize];
    int noRead = ra.read(barr);
    if (noRead != dataSize)
    {
      throw new NotEnoughDataException(dataSize, noRead);
    }
    return interpret(barr);
  }
View Full Code Here

    try
    {
      int noRead = is.read(barr);
      if (noRead != dataSize)
      {
        throw new NotEnoughDataException(dataSize, noRead);
      }
    }
    catch (IOException e)
    {
      throw new WrappedIOException(e);
View Full Code Here

  {
    byte[] larr = new byte[m_dataSize];
    int noRead = ra.read(larr);
    if (noRead != m_dataSize)
    {
      throw new NotEnoughDataException(m_dataSize, noRead);
    }
    return interpret(larr);
  }
View Full Code Here

TOP

Related Classes of org.helidb.io.NotEnoughDataException

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.