org.apache.hadoop.mapred

## Class MapTask.MapOutputBuffer.BlockingBuffer

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - java.io.DataOutputStream
      - - org.apache.hadoop.mapred.MapTask.MapOutputBuffer.BlockingBuffer

- All Implemented Interfaces:
    Closeable, DataOutput, Flushable, AutoCloseable
  Enclosing class:
    MapTask.MapOutputBuffer<K,V>

      protected class MapTask.MapOutputBuffer.BlockingBuffer
      extends DataOutputStream

  Inner class managing the spill of serialized records to disk.

- - ### Field Summary

    - ### Fields inherited from class java.io.DataOutputStream

      `written`

    - ### Fields inherited from class java.io.FilterOutputStream

      `out`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockingBuffer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `markRecord()` Mark end of record.
    `protected void` | `shiftBufferedKey()` Set position from last mark to end of writable buffer, then rewrite the data between last mark and kvindex.

    - ### Methods inherited from class java.io.DataOutputStream

      `flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF`

    - ### Methods inherited from class java.io.FilterOutputStream

      `close, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.io.DataOutput

      `write`

- - ### Constructor Detail

    - #### BlockingBuffer

          public BlockingBuffer()

  - ### Method Detail

    - #### markRecord

          public int markRecord()

      Mark end of record. Note that this is required if the buffer is to cut the spill in the proper place.

    - #### shiftBufferedKey

          protected void shiftBufferedKey()
                                   throws IOException

      Set position from last mark to end of writable buffer, then rewrite the data between last mark and kvindex. This handles a special case where the key wraps around the buffer. If the key is to be passed to a RawComparator, then it must be contiguous in the buffer. This recopies the data in the buffer back into itself, but starting at the beginning of the buffer. Note that this method should only be called immediately after detecting this condition. To call it at any other time is undefined and would likely result in data loss or corruption.
      Throws:
        `IOException`
      See Also:
        `markRecord()`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.