Package org.apache.derby.iapi.services.io

Examples of org.apache.derby.iapi.services.io.FormatIdOutputStream


    if (SanityManager.DEBUG)
      SanityManager.ASSERT(a.length >= CONTAINER_INFO_SIZE,
                 "header won't fit in array");

    ArrayOutputStream a_out = new ArrayOutputStream(a);
    FormatIdOutputStream outStream = new FormatIdOutputStream(a_out);

    int status = 0;
    if (getDroppedState()) status |= FILE_DROPPED;
    if (getCommittedDropState()) status |= FILE_COMMITTED_DROP;
    if (isReusableRecordId()) status |= FILE_REUSABLE_RECORDID;

    a_out.setPosition(0);
    a_out.setLimit(CONTAINER_INFO_SIZE);
    outStream.writeInt(formatIdInteger);
    outStream.writeInt(status);
    outStream.writeInt(pageSize);
    outStream.writeInt(spareSpace);
    outStream.writeInt(minimumRecordSize);
    outStream.writeShort(initialPages);
    outStream.writeShort(PreAllocSize);    // write spare1
    outStream.writeLong(firstAllocPageNumber);
    outStream.writeLong(firstAllocPageOffset);
    outStream.writeLong(containerVersion);
    outStream.writeLong(estimatedRowCount);
    outStream.writeLong(reusableRecordIdSequenceNumber);
    outStream.writeLong(0);    //Write spare3

    checksum.reset();
    checksum.update(a, 0, CONTAINER_INFO_SIZE - CHECKSUM_SIZE);

    // write the checksum to the array
    outStream.writeLong(checksum.getValue());

    a_out.clearLimit();
  }
View Full Code Here


    if (SanityManager.DEBUG)
      SanityManager.ASSERT(a.length >= CONTAINER_INFO_SIZE,
                 "header won't fit in array");

    ArrayOutputStream a_out = new ArrayOutputStream(a);
    FormatIdOutputStream outStream = new FormatIdOutputStream(a_out);

    int status = 0;
    if (getDroppedState()) status |= FILE_DROPPED;
    if (getCommittedDropState()) status |= FILE_COMMITTED_DROP;
    if (isReusableRecordId()) status |= FILE_REUSABLE_RECORDID;

    a_out.setPosition(0);
    a_out.setLimit(CONTAINER_INFO_SIZE);
    outStream.writeInt(formatIdInteger);
    outStream.writeInt(status);
    outStream.writeInt(pageSize);
    outStream.writeInt(spareSpace);
    outStream.writeInt(minimumRecordSize);
    outStream.writeShort(initialPages);
    outStream.writeShort(PreAllocSize);    // write spare1
    outStream.writeLong(firstAllocPageNumber);
    outStream.writeLong(firstAllocPageOffset);
    outStream.writeLong(containerVersion);
    outStream.writeLong(estimatedRowCount);
    outStream.writeLong(reusableRecordIdSequenceNumber);
    outStream.writeLong(0);    //Write spare3

    checksum.reset();
    checksum.update(a, 0, CONTAINER_INFO_SIZE - CHECKSUM_SIZE);

    // write the checksum to the array
    outStream.writeLong(checksum.getValue());

    a_out.clearLimit();
  }
View Full Code Here

      }
      checksumLogRecordSize = checksumLength  + LOG_RECORD_FIXED_OVERHEAD_SIZE;

      //streams required to convert a log record to raw byte array.
      logOutputBuffer = new ArrayOutputStream();
      logicalOut = new FormatIdOutputStream(logOutputBuffer);

      /** initialize the buffer with space reserved for checksum log record in
       * the beginning of the log buffer; checksum record is written into
       * this space when buffer is switched or while doing direct write to the log file.
       */
 
View Full Code Here

      }
      checksumLogRecordSize = checksumLength  + LOG_RECORD_FIXED_OVERHEAD_SIZE;

      //streams required to convert a log record to raw byte array.
      logOutputBuffer = new ArrayOutputStream();
      logicalOut = new FormatIdOutputStream(logOutputBuffer);

      /** initialize the buffer with space reserved for checksum log record in
       * the beginning of the log buffer; checksum record is written into
       * this space when buffer is switched
       */
 
View Full Code Here

    private void createOutStreams()
    {
        rawDataOut = new ArrayOutputStream();
        rawDataOut.setData(pageData);

        logicalDataOut = new FormatIdOutputStream(rawDataOut);
    }
View Full Code Here

  private void createOutStreams()
  {
    rawDataOut = new ArrayOutputStream();
    rawDataOut.setData(pageData);

    logicalDataOut = new FormatIdOutputStream(rawDataOut);
  }
View Full Code Here

  private void createOutStreams()
  {
    rawDataOut = new ArrayOutputStream();
    rawDataOut.setData(pageData);

    logicalDataOut = new FormatIdOutputStream(rawDataOut);
  }
View Full Code Here

      }
      checksumLogRecordSize = checksumLength  + LOG_RECORD_FIXED_OVERHEAD_SIZE;

      //streams required to convert a log record to raw byte array.
      logOutputBuffer = new ArrayOutputStream();
      logicalOut = new FormatIdOutputStream(logOutputBuffer);

      /** initialize the buffer with space reserved for checksum log record in
       * the beginning of the log buffer; checksum record is written into
       * this space when buffer is switched or while doing direct write to the log file.
       */
 
View Full Code Here

  public void load(RowSource rowSource)
        throws StandardException
    {
    // use this output stream to buffer rows before inserting into file.
    out                 = new DynamicByteArrayOutputStream(bufferSize);
    logicalDataOut      = new FormatIdOutputStream(out);
    boolean encrypted   = dataFactory.databaseEncrypted();

    // reserve the first dataFactory.getEncryptionBlockSize() - 1 bytes, if the database is
        // encrypted These reserved bytes will be used to pad the byte array if
        // it is not dataFactory.getEncryptionBlockSize() aligned.
View Full Code Here

  */
  public FileLogger(LogToFile logFactory) {

    this.logFactory = logFactory;
    logOutputBuffer = new DynamicByteArrayOutputStream(1024); // init size 1K
    logicalOut = new FormatIdOutputStream(logOutputBuffer);

    // logIn and logOutputBuffer must share the same buffer because they
    // combined to form an IO stream to access the same log record.
    //
    // Before each use of logIn, you must reset logIn's data to the
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.io.FormatIdOutputStream

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.