org.modeshape.jcr

## Class BackupDocumentWriter

- java.lang.Object
- - org.modeshape.jcr.BackupDocumentWriter

-     @NotThreadSafe
      public final class BackupDocumentWriter
      extends Object

  A utility that writes `Document` instances to one or more sequential files in a backup directory.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `count`
    `static String` | `DOCUMENTS_EXTENSION`
    `protected long` | `fileCount`
    `static String` | `GZIP_EXTENSION`
    `protected long` | `maxDocumentsPerFile`
    `protected OutputStream` | `stream`
    `protected long` | `totalCount`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BackupDocumentWriter(File parentDirectory, String filenamePrefix, long documentsPerFile, boolean compress, Problems problems)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close this writer, which flushes and closes any currently-open streams.
    `long` | `getDocumentCount()` Return the number of documents that have been written so far.
    `long` | `getFileCount()` Return the number of files that have been written so far.
    `void` | `write(Document document)` Append the supplied document to the files.

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

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

- - ### Field Detail

    - #### GZIP_EXTENSION

          public static final String GZIP_EXTENSION

      See Also:
        Constant Field Values

    - #### DOCUMENTS_EXTENSION

          public static final String DOCUMENTS_EXTENSION

      See Also:
        Constant Field Values

    - #### maxDocumentsPerFile

          protected final long maxDocumentsPerFile

    - #### stream

          protected OutputStream stream

    - #### count

          protected long count

    - #### totalCount

          protected long totalCount

    - #### fileCount

          protected long fileCount

  - ### Constructor Detail

    - #### BackupDocumentWriter

          public BackupDocumentWriter(File parentDirectory,
                              String filenamePrefix,
                              long documentsPerFile,
                              boolean compress,
                              Problems problems)

  - ### Method Detail

    - #### write

          public void write(Document document)

      Append the supplied document to the files.
      Parameters:
        `document` - the document to be written; may not be null

    - #### close

          public void close()

      Close this writer, which flushes and closes any currently-open streams. Even after this is called, additional documents can be written to additional files.

    - #### getDocumentCount

          public long getDocumentCount()

      Return the number of documents that have been written so far.
      Returns:
        the number of documents written; never negative

    - #### getFileCount

          public long getFileCount()

      Return the number of files that have been written so far.
      Returns:
        the number of files; never negative

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.