diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-02-03 17:17:26 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-02-03 17:17:26 +0000 |
commit | 7d3151e1c97ed21842b759aedecbc34588f85112 (patch) | |
tree | 3805fede04e83f80412222e1802d60cc9be51e2e /libjava | |
parent | 79f05c19ca1ee164031f0d3926bc5074c499da10 (diff) | |
download | gcc-7d3151e1c97ed21842b759aedecbc34588f85112.tar.gz |
PipedOutputStream.java (write(byte[], int, int)): New method.
* java/io/PipedOutputStream.java (write(byte[], int, int)): New
method.
From-SVN: r31774
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/io/PipedOutputStream.java | 17 |
2 files changed, 15 insertions, 7 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2723767a0ce..655ea87ce18 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2000-02-03 Tom Tromey <tromey@cygnus.com> + + * java/io/PipedOutputStream.java (write(byte[], int, int)): New + method. + 2000-02-01 Tom Tromey <tromey@cygnus.com> * include/java-interp.h (_Jv_JNI_conversion_call): Declare. diff --git a/libjava/java/io/PipedOutputStream.java b/libjava/java/io/PipedOutputStream.java index 221091fa10e..f620aba9d37 100644 --- a/libjava/java/io/PipedOutputStream.java +++ b/libjava/java/io/PipedOutputStream.java @@ -1,6 +1,6 @@ // PipedOutputStream.java - Write bytes to a pipe. -/* Copyright (C) 1998, 1999 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000 Red Hat, Inc. This file is part of libgcj. @@ -81,12 +81,15 @@ public class PipedOutputStream extends OutputStream destination.receive(oneByte); } - // This is mentioned in the JCL book, but we don't really need it. - // If there were a corresponding receive() method on - // PipedInputStream then we could get better performance using - // this. - // public void write (byte[] buffer, int offset, int count) - // throws IOException; + public void write (byte[] buffer, int offset, int count) throws IOException + { + if (closed) + throw new IOException (); + if (offset < 0 || count < 0 || offset + count > buffer.length) + throw new ArrayIndexOutOfBoundsException (); + for (int i = 0; i < count; ++i) + destination.receive (buffer[offset + i]); + } // Instance variables. private PipedInputStream destination; |