1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/rt/emul/compact/src/main/java/java/io/FilterReader.java Tue Oct 22 19:37:49 2013 +0200
1.3 @@ -0,0 +1,124 @@
1.4 +/*
1.5 + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.7 + *
1.8 + * This code is free software; you can redistribute it and/or modify it
1.9 + * under the terms of the GNU General Public License version 2 only, as
1.10 + * published by the Free Software Foundation. Oracle designates this
1.11 + * particular file as subject to the "Classpath" exception as provided
1.12 + * by Oracle in the LICENSE file that accompanied this code.
1.13 + *
1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.17 + * version 2 for more details (a copy is included in the LICENSE file that
1.18 + * accompanied this code).
1.19 + *
1.20 + * You should have received a copy of the GNU General Public License version
1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.23 + *
1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.25 + * or visit www.oracle.com if you need additional information or have any
1.26 + * questions.
1.27 + */
1.28 +
1.29 +package java.io;
1.30 +
1.31 +
1.32 +/**
1.33 + * Abstract class for reading filtered character streams.
1.34 + * The abstract class <code>FilterReader</code> itself
1.35 + * provides default methods that pass all requests to
1.36 + * the contained stream. Subclasses of <code>FilterReader</code>
1.37 + * should override some of these methods and may also provide
1.38 + * additional methods and fields.
1.39 + *
1.40 + * @author Mark Reinhold
1.41 + * @since JDK1.1
1.42 + */
1.43 +
1.44 +public abstract class FilterReader extends Reader {
1.45 +
1.46 + /**
1.47 + * The underlying character-input stream.
1.48 + */
1.49 + protected Reader in;
1.50 +
1.51 + /**
1.52 + * Creates a new filtered reader.
1.53 + *
1.54 + * @param in a Reader object providing the underlying stream.
1.55 + * @throws NullPointerException if <code>in</code> is <code>null</code>
1.56 + */
1.57 + protected FilterReader(Reader in) {
1.58 + super(in);
1.59 + this.in = in;
1.60 + }
1.61 +
1.62 + /**
1.63 + * Reads a single character.
1.64 + *
1.65 + * @exception IOException If an I/O error occurs
1.66 + */
1.67 + public int read() throws IOException {
1.68 + return in.read();
1.69 + }
1.70 +
1.71 + /**
1.72 + * Reads characters into a portion of an array.
1.73 + *
1.74 + * @exception IOException If an I/O error occurs
1.75 + */
1.76 + public int read(char cbuf[], int off, int len) throws IOException {
1.77 + return in.read(cbuf, off, len);
1.78 + }
1.79 +
1.80 + /**
1.81 + * Skips characters.
1.82 + *
1.83 + * @exception IOException If an I/O error occurs
1.84 + */
1.85 + public long skip(long n) throws IOException {
1.86 + return in.skip(n);
1.87 + }
1.88 +
1.89 + /**
1.90 + * Tells whether this stream is ready to be read.
1.91 + *
1.92 + * @exception IOException If an I/O error occurs
1.93 + */
1.94 + public boolean ready() throws IOException {
1.95 + return in.ready();
1.96 + }
1.97 +
1.98 + /**
1.99 + * Tells whether this stream supports the mark() operation.
1.100 + */
1.101 + public boolean markSupported() {
1.102 + return in.markSupported();
1.103 + }
1.104 +
1.105 + /**
1.106 + * Marks the present position in the stream.
1.107 + *
1.108 + * @exception IOException If an I/O error occurs
1.109 + */
1.110 + public void mark(int readAheadLimit) throws IOException {
1.111 + in.mark(readAheadLimit);
1.112 + }
1.113 +
1.114 + /**
1.115 + * Resets the stream.
1.116 + *
1.117 + * @exception IOException If an I/O error occurs
1.118 + */
1.119 + public void reset() throws IOException {
1.120 + in.reset();
1.121 + }
1.122 +
1.123 + public void close() throws IOException {
1.124 + in.close();
1.125 + }
1.126 +
1.127 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/rt/emul/compact/src/main/java/java/io/FilterWriter.java Tue Oct 22 19:37:49 2013 +0200
2.3 @@ -0,0 +1,107 @@
2.4 +/*
2.5 + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2.7 + *
2.8 + * This code is free software; you can redistribute it and/or modify it
2.9 + * under the terms of the GNU General Public License version 2 only, as
2.10 + * published by the Free Software Foundation. Oracle designates this
2.11 + * particular file as subject to the "Classpath" exception as provided
2.12 + * by Oracle in the LICENSE file that accompanied this code.
2.13 + *
2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2.17 + * version 2 for more details (a copy is included in the LICENSE file that
2.18 + * accompanied this code).
2.19 + *
2.20 + * You should have received a copy of the GNU General Public License version
2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2.23 + *
2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2.25 + * or visit www.oracle.com if you need additional information or have any
2.26 + * questions.
2.27 + */
2.28 +
2.29 +package java.io;
2.30 +
2.31 +
2.32 +/**
2.33 + * Abstract class for writing filtered character streams.
2.34 + * The abstract class <code>FilterWriter</code> itself
2.35 + * provides default methods that pass all requests to the
2.36 + * contained stream. Subclasses of <code>FilterWriter</code>
2.37 + * should override some of these methods and may also
2.38 + * provide additional methods and fields.
2.39 + *
2.40 + * @author Mark Reinhold
2.41 + * @since JDK1.1
2.42 + */
2.43 +
2.44 +public abstract class FilterWriter extends Writer {
2.45 +
2.46 + /**
2.47 + * The underlying character-output stream.
2.48 + */
2.49 + protected Writer out;
2.50 +
2.51 + /**
2.52 + * Create a new filtered writer.
2.53 + *
2.54 + * @param out a Writer object to provide the underlying stream.
2.55 + * @throws NullPointerException if <code>out</code> is <code>null</code>
2.56 + */
2.57 + protected FilterWriter(Writer out) {
2.58 + super(out);
2.59 + this.out = out;
2.60 + }
2.61 +
2.62 + /**
2.63 + * Writes a single character.
2.64 + *
2.65 + * @exception IOException If an I/O error occurs
2.66 + */
2.67 + public void write(int c) throws IOException {
2.68 + out.write(c);
2.69 + }
2.70 +
2.71 + /**
2.72 + * Writes a portion of an array of characters.
2.73 + *
2.74 + * @param cbuf Buffer of characters to be written
2.75 + * @param off Offset from which to start reading characters
2.76 + * @param len Number of characters to be written
2.77 + *
2.78 + * @exception IOException If an I/O error occurs
2.79 + */
2.80 + public void write(char cbuf[], int off, int len) throws IOException {
2.81 + out.write(cbuf, off, len);
2.82 + }
2.83 +
2.84 + /**
2.85 + * Writes a portion of a string.
2.86 + *
2.87 + * @param str String to be written
2.88 + * @param off Offset from which to start reading characters
2.89 + * @param len Number of characters to be written
2.90 + *
2.91 + * @exception IOException If an I/O error occurs
2.92 + */
2.93 + public void write(String str, int off, int len) throws IOException {
2.94 + out.write(str, off, len);
2.95 + }
2.96 +
2.97 + /**
2.98 + * Flushes the stream.
2.99 + *
2.100 + * @exception IOException If an I/O error occurs
2.101 + */
2.102 + public void flush() throws IOException {
2.103 + out.flush();
2.104 + }
2.105 +
2.106 + public void close() throws IOException {
2.107 + out.close();
2.108 + }
2.109 +
2.110 +}