diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-03 17:17:26 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-03 17:17:26 +0000 |
commit | 39fc636106eb94c1e4a62ed7b080f2f88cbadda8 (patch) | |
tree | 3805fede04e83f80412222e1802d60cc9be51e2e /libjava/java/io/PipedOutputStream.java | |
parent | 2196a3bb7c4f2f1fdacb2677f8ff140a563424f4 (diff) | |
download | ppe42-gcc-39fc636106eb94c1e4a62ed7b080f2f88cbadda8.tar.gz ppe42-gcc-39fc636106eb94c1e4a62ed7b080f2f88cbadda8.zip |
* java/io/PipedOutputStream.java (write(byte[], int, int)): New
method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31774 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/PipedOutputStream.java')
-rw-r--r-- | libjava/java/io/PipedOutputStream.java | 17 |
1 files changed, 10 insertions, 7 deletions
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; |