Up vote 0 down vote favorite share g+ share fb share tw.
I'm using java.nio.channels. FileChannel to open a file and lock it, then writing a InputStream to the output file. The InputStream may be opened by another file, URL, socket, or anything.
I've write the following codes: FileOutputStream outputStream = new FileOutputStream(outputFile); FileChannel outputChannel = outputStream.getChannel(); FileLock lock = outputChannel.lock(); try { outputChannel. TransferFrom(?); } finally { lock.release(); outputChannel.close(); outputStream.close(); } However, the first argument of outputChannel. TransferFrom(...) requests a ReadableByteChannel object.
Since I an using a InputStream as input, it do not have inputStream.getChannel() method to create the required channel. Is there any way to get a ReadableByteChannel from a InputStream? Java inputstream filelock filechannel link|improve this question asked Jul 8 '11 at 2:53KiKi786 86% accept rate.
You can use ReadableByteChannel readableChannel = Channels. NewChannel(myinputstream).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.