I have a FileChannel
object (which I need so I can apply a FileLock
to the file), and I want to write to the file it references using a simple OututStream
. How do I create an OutputStream
that writes to a FileChannel
?
This should be in the Java API somewhere, but I can't find it. FileChannel
does not have a suitable factory method. The FileOutputStream
class does not have a suitable constructor. The Files
class (of Java 7) has no suitable methods.