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

Nicolas Capponi
09.22.2014 15ad9b53748b474cf78d89fc9350d0c0ca10cb3b
Add ByteStringBuilder#copyTo(WritableByteChannel) method
to align class with ByteStringBuilder class from server 2.x
1 files modified
16 ■■■■■ changed files
opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java 16 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java
@@ -32,6 +32,7 @@
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
/**
@@ -824,6 +825,21 @@
    }
    /**
     * Copies the entire contents of this byte string to the provided
     * {@code WritableByteChannel}.
     *
     * @param channel
     *            The {@code WritableByteChannel} to copy to.
     * @return The number of bytes written, possibly zero
     * @throws IOException
     *             If some other I/O error occurs
     * @see WritableByteChannel#write(java.nio.ByteBuffer)
     */
    public int copyTo(WritableByteChannel channel) throws IOException {
        return channel.write(ByteBuffer.wrap(buffer, 0, length));
    }
    /**
     * Ensures that the specified number of additional bytes will fit in this
     * byte string builder and resizes it if necessary.
     *