mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
28.47.2010 cc556edc003e4fb8df13611167fab0d9fd3890f9
opendj-sdk/sdk/src/org/opends/sdk/ldif/AbstractLDIFWriter.java
@@ -58,9 +58,8 @@
  {
    /**
     * Closes any resources associated with this LDIF writer
     * implementation.
     *
     * Closes any resources associated with this LDIF writer implementation.
     *
     * @throws IOException
     *           If an error occurs while closing.
     */
@@ -69,17 +68,16 @@
    /**
     * Flushes this LDIF writer implementation so that any buffered data
     * is written immediately to underlying stream, flushing the stream
     * if it is also {@code Flushable}.
     * Flushes this LDIF writer implementation so that any buffered data is
     * written immediately to underlying stream, flushing the stream if it is
     * also {@code Flushable}.
     * <p>
     * If the intended destination of this stream is an abstraction
     * provided by the underlying operating system, for example a file,
     * then flushing the stream guarantees only that bytes previously
     * written to the stream are passed to the operating system for
     * writing; it does not guarantee that they are actually written to
     * a physical device such as a disk drive.
     *
     * If the intended destination of this stream is an abstraction provided by
     * the underlying operating system, for example a file, then flushing the
     * stream guarantees only that bytes previously written to the stream are
     * passed to the operating system for writing; it does not guarantee that
     * they are actually written to a physical device such as a disk drive.
     *
     * @throws IOException
     *           If an error occurs while flushing.
     */
@@ -88,9 +86,9 @@
    /**
     * Prints the provided {@code CharSequence}. Implementations must
     * not add a new-line character sequence.
     *
     * Prints the provided {@code CharSequence}. Implementations must not add a
     * new-line character sequence.
     *
     * @param s
     *          The {@code CharSequence} to be printed.
     * @throws IOException
@@ -102,10 +100,10 @@
    /**
     * Prints a new-line character sequence.
     *
     *
     * @throws IOException
     *           If an error occurs while printing the new-line
     *           character sequence.
     *           If an error occurs while printing the new-line character
     *           sequence.
     */
    void println() throws IOException;
  }
@@ -115,7 +113,7 @@
  /**
   * LDIF string list writer implementation.
   */
  private final class LDIFWriterListImpl implements LDIFWriterImpl
  private static final class LDIFWriterListImpl implements LDIFWriterImpl
  {
    private final StringBuilder builder = new StringBuilder();
@@ -126,11 +124,11 @@
    /**
     * Creates a new LDIF list writer.
     *
     *
     * @param ldifLines
     *          The string list.
     */
    LDIFWriterListImpl(List<String> ldifLines)
    LDIFWriterListImpl(final List<String> ldifLines)
    {
      this.ldifLines = ldifLines;
    }
@@ -160,7 +158,7 @@
    /**
     * {@inheritDoc}
     */
    public void print(CharSequence s) throws IOException
    public void print(final CharSequence s) throws IOException
    {
      builder.append(s);
    }
@@ -182,7 +180,7 @@
  /**
   * LDIF output stream writer implementation.
   */
  private final class LDIFWriterOutputStreamImpl implements
  private static final class LDIFWriterOutputStreamImpl implements
      LDIFWriterImpl
  {
@@ -192,11 +190,11 @@
    /**
     * Creates a new LDIF output stream writer.
     *
     *
     * @param out
     *          The output stream.
     */
    LDIFWriterOutputStreamImpl(OutputStream out)
    LDIFWriterOutputStreamImpl(final OutputStream out)
    {
      this.writer = new BufferedWriter(new OutputStreamWriter(out));
    }
@@ -226,7 +224,7 @@
    /**
     * {@inheritDoc}
     */
    public void print(CharSequence s) throws IOException
    public void print(final CharSequence s) throws IOException
    {
      writer.append(s);
    }
@@ -242,9 +240,10 @@
    }
  }
  // Regular expression used for splitting comments on line-breaks.
  private static final Pattern SPLIT_NEWLINE =
      Pattern.compile("\\r?\\n");
  private static final Pattern SPLIT_NEWLINE = Pattern.compile("\\r?\\n");
  boolean addUserFriendlyComments = false;
@@ -257,13 +256,13 @@
  /**
   * Creates a new LDIF entry writer which will append lines of LDIF to
   * the provided list.
   *
   * Creates a new LDIF entry writer which will append lines of LDIF to the
   * provided list.
   *
   * @param ldifLines
   *          The list to which lines of LDIF should be appended.
   */
  public AbstractLDIFWriter(List<String> ldifLines)
  public AbstractLDIFWriter(final List<String> ldifLines)
  {
    Validator.ensureNotNull(ldifLines);
    this.impl = new LDIFWriterListImpl(ldifLines);
@@ -272,13 +271,13 @@
  /**
   * Creates a new LDIF entry writer whose destination is the provided
   * output stream.
   *
   * Creates a new LDIF entry writer whose destination is the provided output
   * stream.
   *
   * @param out
   *          The output stream to use.
   */
  public AbstractLDIFWriter(OutputStream out)
  public AbstractLDIFWriter(final OutputStream out)
  {
    Validator.ensureNotNull(out);
    this.impl = new LDIFWriterOutputStreamImpl(out);
@@ -301,7 +300,7 @@
  final void writeComment0(CharSequence comment) throws IOException,
  final void writeComment0(final CharSequence comment) throws IOException,
      NullPointerException
  {
    Validator.ensureNotNull(comment);
@@ -379,8 +378,7 @@
  final void writeControls(Iterable<Control> controls)
      throws IOException
  final void writeControls(final List<Control> controls) throws IOException
  {
    for (final Control control : controls)
    {
@@ -401,7 +399,7 @@
  final void writeKeyAndValue(CharSequence key, ByteSequence value)
  final void writeKeyAndValue(final CharSequence key, final ByteSequence value)
      throws IOException
  {
    builder.setLength(0);
@@ -438,7 +436,7 @@
  final void writeKeyAndValue(CharSequence key, CharSequence value)
  final void writeKeyAndValue(final CharSequence key, final CharSequence value)
      throws IOException
  {
    // FIXME: We should optimize this at some point.
@@ -447,7 +445,7 @@
  final void writeLine(CharSequence line) throws IOException
  final void writeLine(final CharSequence line) throws IOException
  {
    final int length = line.length();
    if (shouldWrap() && length > wrapColumn)
@@ -473,7 +471,7 @@
  private boolean needsBase64Encoding(ByteSequence bytes)
  private boolean needsBase64Encoding(final ByteSequence bytes)
  {
    final int length = bytes.length();
    if (length == 0)
@@ -532,7 +530,7 @@
  @SuppressWarnings("unused")
  private void writeKeyAndURL(CharSequence key, CharSequence url)
  private void writeKeyAndURL(final CharSequence key, final CharSequence url)
      throws IOException
  {
    builder.setLength(0);