Package org.entityfs.util.io

Examples of org.entityfs.util.io.RandomAccessToOutputStreamAdapter


  }

  public long writeContentsTo(RandomAccess ra)
  {
    assertNotClosed();
    return m_tree.writeContentsTo(new RandomAccessToOutputStreamAdapter(ra));
  }
View Full Code Here


  public void replaceContentsWith(InputStream is, long dataLen)
  {
    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);
    }
View Full Code Here

  public long writeContentsTo(RandomAccess ra)
  {
    assertNotClosed();
    m_dbFile.seek(m_startPosOfDb);
    return StreamUtil.copyStreams(new RandomAccessToInputStreamAdapter(m_dbFile), new RandomAccessToOutputStreamAdapter(ra), m_bufferSize);
  }
View Full Code Here

    assertNotClosed();
    assertNotReadOnly();
    assert dataSize > 0;
    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

  public long writeContentsTo(RandomAccess ra)
  {
    assertNotClosed();
    m_dbFile.seek(m_startPosOfDb);
    return StreamUtil.copyStreams(new RandomAccessToInputStreamAdapter(m_dbFile), new RandomAccessToOutputStreamAdapter(ra), m_bufferSize);
  }
View Full Code Here

    {
      throw new IllegalArgumentException("Invalid data size " + dataSize + ". It must be a multiple of the key size + record size");
    }
    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 DatabaseException("Wanted to copy " + dataSize + " bytes. Got " + noCopied);
    }
    updateContentsVersion();
View Full Code Here

    long res = getProxied().writeContentsTo(ra);
    ra.seek(startPos);
    // Write the length of the B+ Tree
    ra.write(LongSerializer.INSTANCE.serialize(res));
    ra.seek(ra.length());
    return res + m_tree.writeContentsTo(new RandomAccessToOutputStreamAdapter(ra)) + LongSerializer.DATA_SIZE;
  }
View Full Code Here

TOP

Related Classes of org.entityfs.util.io.RandomAccessToOutputStreamAdapter

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.