Package org.apache.sling.sitemap.impl.builder

## Class SitemapImpl

- java.lang.Object
- - org.apache.sling.sitemap.impl.builder.SitemapImpl

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Sitemap`

    public class SitemapImpl
    extends Object
    implements Sitemap, Closeable

An `Sitemap` implementation based on a `Writer` that keeps the last `Url` object in memory until another location gets added to the `SitemapImpl`. Call `flush()` to write the pending `Url` to the underlying `Writer`.

### Field Summary

Fields
`protected Writer` `out`

### Constructor Summary

Constructors
`SitemapImpl​(Writer writer, ExtensionProviderManager extensionProviderManager)`
`SitemapImpl​(Writer writer, ExtensionProviderManager extensionProviderManager, boolean writeHeader)`

### Method Summary

All Methods Instance Methods Concrete Methods
`@NotNull Url` `addUrl​(@NotNull String location)` Adds a location to the `Sitemap`.
`void` `close()`
`void` `flush()`
`protected boolean` `writePendingUrl()`

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

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

### Field Detail

#### out

    protected final Writer out

### Constructor Detail

#### SitemapImpl

    public SitemapImpl​(Writer writer,
                       ExtensionProviderManager extensionProviderManager)
                throws IOException

Throws:
  `IOException`

#### SitemapImpl

    public SitemapImpl​(Writer writer,
                       ExtensionProviderManager extensionProviderManager,
                       boolean writeHeader)
                throws IOException

Throws:
  `IOException`

### Method Detail

#### close

    public void close()
               throws IOException

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

#### flush

    public void flush()
               throws IOException

Throws:
  `IOException`

#### addUrl

    @NotNull
    public @NotNull Url addUrl​(@NotNull
                               @NotNull String location)
                        throws SitemapException

Description copied from interface: `Sitemap`
Adds a location to the `Sitemap`. The returned `Url` can be used to add more details to the so created object.

Specified by:
  `addUrl` in interface `Sitemap`
Parameters:
  `location` - the required location of the entry to add.
Returns:
  an `Url` object giving access to the location's details
Throws:
  `SitemapException` - if any internal operation of the Sitemap fails

#### writePendingUrl

    protected boolean writePendingUrl()
                               throws SitemapException

Throws:
  `SitemapException`