| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | import java.io.OutputStream; |
| | | import java.nio.channels.ReadableByteChannel; |
| | | import java.nio.channels.WritableByteChannel; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.opends.server.types.ByteSequence; |
| | | import org.opends.server.types.ByteString; |
| | |
| | | * |
| | | * @param channel |
| | | * The writable byte channel. |
| | | * @param writeLock |
| | | * The write lock to use when flushing to the destination. |
| | | * @return The new ASN.1 writer. |
| | | */ |
| | | public static ASN1Writer getWriter(WritableByteChannel channel) |
| | | public static ASN1Writer getWriter(WritableByteChannel channel, |
| | | ReentrantLock writeLock) |
| | | { |
| | | return new ASN1ByteChannelWriter(channel, 4096); |
| | | return new ASN1ByteChannelWriter(channel, writeLock, 4096); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * @param channel |
| | | * The writable byte channel. |
| | | * @param writeLock |
| | | * The write lock to use when flushing to the destination. |
| | | * @param bufferSize |
| | | * The buffer size to use when writing to the channel. |
| | | * @return The new ASN.1 writer. |
| | | */ |
| | | public static ASN1Writer getWriter(WritableByteChannel channel, |
| | | ReentrantLock writeLock, |
| | | int bufferSize) |
| | | { |
| | | return new ASN1ByteChannelWriter(channel, bufferSize); |
| | | return new ASN1ByteChannelWriter(channel, writeLock, bufferSize); |
| | | } |
| | | |
| | | |