Package org.jenkinsci.remoting.nio
Class SelectableFileChannelFactory
java.lang.Object
org.jenkinsci.remoting.nio.SelectableFileChannelFactory
Extracts out
SelectableChannel from InputStream or OutputStream.
This hides the hack that works around the fact that FileChannel is not a SelectableChannel.
JDK didn't make FileChannel selectable because it's not selectable on Windows.
But on POSIX, select API does support arbitrary file descriptors, including pipes and regular files.
Methods on this class takes various JDK objects that own FileDescriptor and
creates a SocketChannel object that points to the same file descriptor, as a hack.
Note that since it is not a real socket, various socket specific operations on SocketChannel
will fail, most notably Object.toString()
- Since:
- 2.38
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(FileDescriptor fd) Create channel using the specified file descriptor.create(FileOutputStream out) create(InputStream in) create(OutputStream out) protected FileInputStreamprotected FileOutputStream
-
Constructor Details
-
SelectableFileChannelFactory
public SelectableFileChannelFactory()
-
-
Method Details
-
unwrap
-
unwrap
-
create
- Throws:
IOException
-
create
- Throws:
IOException
-
create
- Throws:
IOException
-
create
- Throws:
IOException
-
create
Create channel using the specified file descriptor.- Parameters:
fd- File Descriptor- Returns:
nullif the platform does not support it (e.g. Windows) OR the socket channel cannot be created. In the latter case the error message will be printed toLOGGERthen.
-