ChannelInputStream.java: New file.
2003-12-19 Michael Koch <konqueror@gmx.de> * gnu/java/nio/ChannelInputStream.java: New file. * java/nio/channels/Channels.java (newInputStream): Implemented. * java/nio/channels/FileChannelImpl.java (readImpl): Only put data into buffer if something was read. * Makefile.am (ordinary_java_source_files): Added gnu/java/nio/ChannelInputStream.java. * Makefile.in: Regenerated. From-SVN: r74842
This commit is contained in:
parent
cc16f8b948
commit
26392535a7
6 changed files with 98 additions and 3 deletions
|
@ -37,6 +37,7 @@ exception statement from your version. */
|
|||
|
||||
package java.nio.channels;
|
||||
|
||||
import gnu.java.nio.ChannelInputStream;
|
||||
import gnu.java.nio.InputStreamChannel;
|
||||
import gnu.java.nio.OutputStreamChannel;
|
||||
import java.io.InputStream;
|
||||
|
@ -55,9 +56,9 @@ public final class Channels
|
|||
/**
|
||||
* Constructs a stream that reads bytes from the given channel.
|
||||
*/
|
||||
public static InputStream newInputStream (ReadableByteChannel ch)
|
||||
public static InputStream newInputStream(ReadableByteChannel ch)
|
||||
{
|
||||
throw new Error ("not implemented");
|
||||
return new ChannelInputStream(ch);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -169,7 +169,9 @@ public class FileChannelImpl extends FileChannel
|
|||
byte[] buffer = new byte [dst.remaining ()];
|
||||
|
||||
result = implRead (buffer, 0, buffer.length);
|
||||
dst.put (buffer, 0, result);
|
||||
|
||||
if (result > 0)
|
||||
dst.put (buffer, 0, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue