org.apache.avro.hadoop.file

## Class SortedKeyValueFile.Writer<K,V>

- java.lang.Object
- - org.apache.avro.hadoop.file.SortedKeyValueFile.Writer<K,V>

- Type Parameters:
    `K` - The key type.
    `V` - The value type.
  All Implemented Interfaces:
    Closeable, AutoCloseable
  Enclosing class:
    SortedKeyValueFile

      public static class SortedKeyValueFile.Writer<K,V>
      extends Object
      implements Closeable

  Writes a SortedKeyValueFile.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SortedKeyValueFile.Writer.Options` A class to encapsulate the various options of a SortedKeyValueFile.Writer.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Writer(SortedKeyValueFile.Writer.Options options)` Creates a writer for a new file.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(K key, V value)` Appends a record to the SortedKeyValueFile.
    `void` | `close()`

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

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

- - ### Constructor Detail

    - #### Writer

          public Writer(SortedKeyValueFile.Writer.Options options)
                 throws IOException

      Creates a writer for a new file.
      Parameters:
        `options` - The options.
      Throws:
        `IOException` - If there is an error.

  - ### Method Detail

    - #### append

          public void append(K key,
                             V value)
                      throws IOException

      Appends a record to the SortedKeyValueFile.
      Parameters:
        `key` - The key.
        `value` - The value.
      Throws:
        `IOException` - If there is an error.

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.