Package org.eclipse.rdf4j.rio.helpers

## Class BufferedGroupingRDFHandler

- java.lang.Object
- - org.eclipse.rdf4j.rio.helpers.RDFHandlerWrapper
  - - org.eclipse.rdf4j.rio.helpers.BufferedGroupingRDFHandler

- All Implemented Interfaces:
    `RDFHandler`

      public class BufferedGroupingRDFHandler
      extends RDFHandlerWrapper

  An `RDFHandlerWrapper` that buffers statements internally and passes them to underlying handlers grouped by context, then subject, then predicate.
  Author:
    Jeen Broekstra

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_BUFFER_SIZE` | Default buffer size.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BufferedGroupingRDFHandler​(int bufferSize, RDFHandler... handlers)` | Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the supplied buffer size.
    `BufferedGroupingRDFHandler​(RDFHandler... handlers)` | Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the default buffer size.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `endRDF()` | Signals the end of the RDF data.
    `protected Model` | `getBufferedStatements()` |
    `void` | `handleStatement​(Statement st)` | Handles a statement.
    `protected void` | `processBuffer()` |

    - ### Methods inherited from class org.eclipse.rdf4j.rio.helpers.RDFHandlerWrapper

      `getModelFactory, handleComment, handleNamespace, startRDF`

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

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

- - ### Field Detail

    - #### DEFAULT_BUFFER_SIZE

          public static final int DEFAULT_BUFFER_SIZE

      Default buffer size. Buffer size is expressed in number of RDF statements. The default is set to 1024.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BufferedGroupingRDFHandler

          public BufferedGroupingRDFHandler​(RDFHandler... handlers)

      Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the default buffer size.
      Parameters:
        `handlers` - one or more wrapped RDFHandlers

    - #### BufferedGroupingRDFHandler

          public BufferedGroupingRDFHandler​(int bufferSize,
                                            RDFHandler... handlers)

      Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the supplied buffer size.
      Parameters:
        `bufferSize` - size of the buffer expressed in number of RDF statements
        `handlers` - one or more wrapped RDFHandlers

  - ### Method Detail

    - #### getBufferedStatements

          protected Model getBufferedStatements()

    - #### handleStatement

          public void handleStatement​(Statement st)
                               throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Handles a statement.
      Specified by:
        `handleStatement` in interface `RDFHandler`
      Overrides:
        `handleStatement` in class `RDFHandlerWrapper`
      Parameters:
        `st` - The statement.
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.

    - #### processBuffer

          protected void processBuffer()
                                throws RDFHandlerException

      Throws:
        `RDFHandlerException`

    - #### endRDF

          public void endRDF()
                      throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Signals the end of the RDF data. This method is called when all data has been reported.
      Specified by:
        `endRDF` in interface `RDFHandler`
      Overrides:
        `endRDF` in class `RDFHandlerWrapper`
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.