Package org.opends.server.extensions
Class RedirectingByteChannel
- java.lang.Object
-
- org.opends.server.extensions.RedirectingByteChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,ReadableByteChannel,WritableByteChannel
public class RedirectingByteChannel extends Object implements ByteChannel
This class redirects read and write requests either to a child byte channel, or a byte channel to be redirected to.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voiddisable()Disable redirection.static RedirectingByteChannelgetRedirectingByteChannel(ByteChannel bc)Create an instance of a redirecting byte channel using the specified byte channel as the child.booleanisOpen()intread(ByteBuffer buffer)voidredirect(ConnectionSecurityProvider provider)Redirects a byte channel to a byte channel associated with the specified provider.intwrite(ByteBuffer buffer)
-
-
-
Method Detail
-
getRedirectingByteChannel
public static RedirectingByteChannel getRedirectingByteChannel(ByteChannel bc)
Create an instance of a redirecting byte channel using the specified byte channel as the child.- Parameters:
bc- A byte channel to use as the child.- Returns:
- A redirecting byte channel.
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
disable
public final void disable()
Disable redirection.
-
read
public int read(ByteBuffer buffer) throws IOException
- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-
redirect
public final void redirect(ConnectionSecurityProvider provider)
Redirects a byte channel to a byte channel associated with the specified provider.- Parameters:
provider- The provider to redirect to.
-
write
public int write(ByteBuffer buffer) throws IOException
- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException
-
-