diff options
author | Andrew Haley <aph@redhat.com> | 2016-09-30 16:24:48 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2016-09-30 16:24:48 +0000 |
commit | 07b78716af6a9d7c9fd1e94d9baf94a52c873947 (patch) | |
tree | 3f22b3241c513ad168c8353805614ae1249410f4 /libjava/classpath/javax/imageio/stream | |
parent | eae993948bae8b788c53772bcb9217c063716f93 (diff) | |
download | gcc-07b78716af6a9d7c9fd1e94d9baf94a52c873947.zip gcc-07b78716af6a9d7c9fd1e94d9baf94a52c873947.tar.gz gcc-07b78716af6a9d7c9fd1e94d9baf94a52c873947.tar.bz2 |
Makefile.def: Remove libjava.
2016-09-30 Andrew Haley <aph@redhat.com>
* Makefile.def: Remove libjava.
* Makefile.tpl: Likewise.
* Makefile.in: Regenerate.
* configure.ac: Likewise.
* configure: Likewise.
* gcc/java: Remove.
* libjava: Likewise.
From-SVN: r240662
Diffstat (limited to 'libjava/classpath/javax/imageio/stream')
12 files changed, 0 insertions, 2745 deletions
diff --git a/libjava/classpath/javax/imageio/stream/FileCacheImageInputStream.java b/libjava/classpath/javax/imageio/stream/FileCacheImageInputStream.java deleted file mode 100644 index 2717e07..0000000 --- a/libjava/classpath/javax/imageio/stream/FileCacheImageInputStream.java +++ /dev/null @@ -1,109 +0,0 @@ -/* FileCacheImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileCacheImageInputStream extends ImageInputStreamImpl -{ - private InputStream stream; - private File cacheDir; - - public FileCacheImageInputStream(InputStream stream, File cacheDir) - throws IOException - { - super(); - this.stream = stream; - // FIXME: We do not support caching yet. - this.cacheDir = cacheDir; - } - - public void close() - throws IOException - { - if (stream != null) - { - stream.close(); - stream = null; - } - } - - private void checkStreamClosed() - throws IOException - { - if (stream == null) - throw new IOException("stream closed"); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return true; - } - - public boolean isCachedMemory() - { - return false; - } - - public int read() - throws IOException - { - checkStreamClosed(); - setBitOffset(0); - return stream.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - checkStreamClosed(); - setBitOffset(0); - return stream.read(data, offset, len); - } -} diff --git a/libjava/classpath/javax/imageio/stream/FileCacheImageOutputStream.java b/libjava/classpath/javax/imageio/stream/FileCacheImageOutputStream.java deleted file mode 100644 index 1d73a05..0000000 --- a/libjava/classpath/javax/imageio/stream/FileCacheImageOutputStream.java +++ /dev/null @@ -1,178 +0,0 @@ -/* FileCacheImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.RandomAccessFile; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileCacheImageOutputStream extends ImageOutputStreamImpl -{ - private OutputStream stream; - private File cacheFile; - private RandomAccessFile cache; - private long maxPos; - - public FileCacheImageOutputStream(OutputStream s, File cacheDir) - throws IOException - { - stream = s; - cacheFile = File.createTempFile("imageio", ".tmp", cacheDir); - cache = new RandomAccessFile(cacheFile, "rw"); - maxPos = 0; - } - - public void close() - throws IOException - { - maxPos = cache.length(); - seek(maxPos); - flushBefore(maxPos); - super.close(); - cache.close(); - cacheFile.delete(); - stream.flush(); - stream = null; - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return true; - } - - public boolean isCachedMemory() - { - return false; - } - - public int read() - throws IOException - { - bitOffset = 0; - int val = cache.read(); - if (val != -1) - streamPos++; - return val; - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - bitOffset = 0; - int num = cache.read(data, offset, len); - if (num != -1) - streamPos += num; - return num; - } - - public void write(byte[] data, int offset, int len) - throws IOException - { - flushBits(); - cache.write(data, offset, len); - streamPos += len; - maxPos = Math.max(streamPos, maxPos); - } - - public void write(int value) - throws IOException - { - flushBits(); - cache.write(value); - streamPos++; - maxPos = Math.max(streamPos, maxPos); - } - - public long length() - { - long l; - try - { - l = cache.length(); - } - catch (IOException ex) - { - l = -1; - } - return l; - } - - public void seek(long pos) - throws IOException - { - checkClosed(); - if (pos < flushedPos) - throw new IndexOutOfBoundsException(); - cache.seek(pos); - streamPos = cache.getFilePointer(); - maxPos = Math.max(streamPos, maxPos); - bitOffset = 0; - } - - public void flushBefore(long pos) - throws IOException - { - long oldPos = flushedPos; - super.flushBefore(pos); - long flushed = flushedPos - oldPos; - if (flushed > 0) - { - int len = 512; - byte[] buf = new byte[len]; - cache.seek(oldPos); - while (flushed > 0) - { - int l = (int) Math.min(flushed, len); - cache.readFully(buf, 0, l); - stream.write(buf, 0, l); - flushed -= l; - } - stream.flush(); - } - } -} diff --git a/libjava/classpath/javax/imageio/stream/FileImageInputStream.java b/libjava/classpath/javax/imageio/stream/FileImageInputStream.java deleted file mode 100644 index abdd997..0000000 --- a/libjava/classpath/javax/imageio/stream/FileImageInputStream.java +++ /dev/null @@ -1,108 +0,0 @@ -/* FileImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileImageInputStream extends ImageInputStreamImpl -{ - private RandomAccessFile file; - - public FileImageInputStream(File file) - throws FileNotFoundException, IOException - { - if (file == null) - throw new IllegalArgumentException ("file may not be null"); - - this.file = new RandomAccessFile(file, "r"); - } - - public FileImageInputStream(RandomAccessFile file) - { - if (file == null) - throw new IllegalArgumentException ("file may not be null"); - - this.file = file; - } - - public void close() - throws IOException - { - file.close(); - } - - public long length() - { - try - { - return file.length(); - } - catch (IOException e) - { - return -1L; - } - } - - public int read() - throws IOException - { - setBitOffset(0); - return file.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - setBitOffset(0); - return file.read(data, offset, len); - } - - public void seek(long position) - throws IOException - { - super.seek(position); - file.seek(position); - } -} diff --git a/libjava/classpath/javax/imageio/stream/FileImageOutputStream.java b/libjava/classpath/javax/imageio/stream/FileImageOutputStream.java deleted file mode 100644 index 7d5d8fb..0000000 --- a/libjava/classpath/javax/imageio/stream/FileImageOutputStream.java +++ /dev/null @@ -1,133 +0,0 @@ -/* FileImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileImageOutputStream extends ImageOutputStreamImpl -{ - private RandomAccessFile file; - - public FileImageOutputStream(File file) - throws FileNotFoundException, IOException - { - if (file == null) - throw new IllegalArgumentException("file may not be null"); - - // Do security check. - file.canRead(); - - this.file = new RandomAccessFile(file, "r"); - } - - public FileImageOutputStream(RandomAccessFile file) - { - if (file == null) - throw new IllegalArgumentException("file may not be null"); - - this.file = file; - } - - public void close() - throws IOException - { - file.close(); - } - - public long length() - { - try - { - return file.length(); - } - catch (IOException e) - { - return -1L; - } - } - - public int read() - throws IOException - { - checkClosed(); - - setBitOffset(0); - return file.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - checkClosed(); - - setBitOffset(0); - return file.read(data, offset, len); - } - - public void seek(long position) - throws IOException - { - super.seek(position); - file.seek(position); - } - - public void write(byte[] data, int offset, int len) - throws IOException - { - checkClosed(); - - flushBits(); - file.write(data, offset, len); - } - - public void write(int value) - throws IOException - { - checkClosed(); - - // FIXME: Flush pending bits. - file.write(value); - } -} diff --git a/libjava/classpath/javax/imageio/stream/IIOByteBuffer.java b/libjava/classpath/javax/imageio/stream/IIOByteBuffer.java deleted file mode 100644 index f783653..0000000 --- a/libjava/classpath/javax/imageio/stream/IIOByteBuffer.java +++ /dev/null @@ -1,94 +0,0 @@ -/* IIOByteBuffer.java - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -/** - * A data structure for holding a reference to a byte array, an index - * into that array, and a number of bytes, that can be passed to one - * specific variant of the {@link - * javax.imageio.stream.ImageInputStream#readBytes(IIOByteBuffer, int) - * readBytes} method. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public class IIOByteBuffer -{ - private byte[] data; - private int offset; - private int length; - - public IIOByteBuffer(byte[] data, int offset, int length) - { - this.data = data; - this.offset = offset; - this.length = length; - } - - public byte[] getData() - { - return data; - } - - public void setData(byte[] data) - { - this.data = data; - } - - public int getOffset() - { - return offset; - } - - public void setOffset(int offset) - { - this.offset = offset; - } - - public int getLength() - { - return length; - } - - public void setLength(int length) - { - this.length = length; - } -} diff --git a/libjava/classpath/javax/imageio/stream/ImageInputStream.java b/libjava/classpath/javax/imageio/stream/ImageInputStream.java deleted file mode 100644 index dd57ca6..0000000 --- a/libjava/classpath/javax/imageio/stream/ImageInputStream.java +++ /dev/null @@ -1,651 +0,0 @@ -/* ImageInputStream.java - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.DataInput; -import java.io.EOFException; -import java.io.IOException; -import java.nio.ByteOrder; - - -/** - * An input stream for use by {@link javax.imageio.ImageReader - * ImageReaders}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public interface ImageInputStream - extends DataInput -{ - void setByteOrder(ByteOrder order); - - ByteOrder getByteOrder(); - - int read() - throws IOException; - - int read(byte[] b) - throws IOException; - - int read(byte[] b, int offset, int length) - throws IOException; - - - /** - * Reads up to a specified number of bytes, and modifies a - * {@link IIOByteBuffer} to hold the read data. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param buf an <code>IIOByteBuffer</code> that will hold the read - * data. - * - * @param numBytes the maximum number of bytes to read. - * - * @throws IndexOutOfBoundsException if <code>numBytes</code> is - * negative. - * - * @throws NullPointerException if <code>buf</code> is - * <code>null</code>. - * - * @throws IOException if some general problem happens with - * accessing data. - */ - void readBytes(IIOByteBuffer buf, int numBytes) - throws IOException; - - - /** - * Reads a byte and checks whether or not its value is zero. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before the byte is read. - * - * @throws EOFException if the input stream is at its end. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readBit() - * @see #readByte() - * @see #readFully(byte[], int, int) - */ - boolean readBoolean() - throws IOException; - - - /** - * Reads a signed byte. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream is at its end. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readUnsignedByte() - * @see #readFully(byte[], int, int) - */ - byte readByte() - throws IOException; - - - /** - * Reads an unsigned byte. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream is at its end. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readByte() - * @see #readFully(byte[], int, int) - */ - int readUnsignedByte() - throws IOException; - - - /** - * Reads an signed 16-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all two - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readUnsignedShort() - * @see #readChar() - * @see #readFully(short[], int, int) - */ - short readShort() - throws IOException; - - - /** - * Reads an unsigned 16-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * <p>This method does the same as {@link #readChar()}. - * - * @throws EOFException if the input stream ends before all two - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readShort() - * @see #readChar() - * @see #readFully(char[], int, int) - */ - int readUnsignedShort() - throws IOException; - - - /** - * Reads an unsigned 16-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * <p>This method does the same as {@link #readUnsignedShort()}. - * - * @throws EOFException if the input stream ends before all two - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(char[], int, int) - */ - char readChar() - throws IOException; - - - /** - * Reads a signed 32-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all four - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readUnsignedInt() - * @see #readFully(int[], int, int) - */ - int readInt() - throws IOException; - - - /** - * Reads an unsigned 32-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all four - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readInt() - * @see #readFully(int[], int, int) - */ - long readUnsignedInt() - throws IOException; - - - /** - * Reads a signed 64-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all eight - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(long[], int, int) - */ - long readLong() - throws IOException; - - - /** - * Reads an IEEE 32-bit single-precision floating point number. If - * necessary, the value gets converted from the stream’s - * {@linkplain #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all four - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(float[], int, int) - */ - float readFloat() - throws IOException; - - - /** - * Reads an IEEE 64-bit double-precision floating point number. If - * necessary, the value gets converted from the stream’s - * {@linkplain #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all eight - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(double[], int, int) - */ - double readDouble() - throws IOException; - - String readLine() - throws IOException; - - String readUTF() - throws IOException; - - - /** - * Reads a sequence of signed 8-bit integers into a - * <code>byte[]</code> array. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param b an array for storing the read values. - * - * @param offset the index of the first element in <code>b</code> - * that will hold read data. - * - * @param numBytes the number of bytes to read. - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numBytes</code> is negative, or if <code>offset + - * numBytes</code> exceeds <code>b.length</code>. - * - * @throws NullPointerException if <code>b</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readByte() - */ - void readFully(byte[] b, int offset, int numBytes) - throws IOException; - - - /** - * Reads a sequence of signed 8-bit integers into a - * <code>byte[]</code> array. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param b an array for storing the read values. - * - * @throws NullPointerException if <code>b</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readByte() - * @see #readFully(byte[], int, int) - */ - void readFully(byte[] b) - throws IOException; - - - /** - * Reads a sequence of signed 16-bit integers into a - * <code>short[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param s an array for storing the read values. - * - * @param offset the index of the first element in <code>s</code> - * that will hold read data. - * - * @param numShorts the number of signed 16-bit integers to read - * (which is one half of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numShorts</code> is negative, or if <code>offset + - * numShorts</code> exceeds <code>s.length</code>. - * - * @throws NullPointerException if <code>s</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readShort() - */ - void readFully(short[] s, int offset, int numShorts) - throws IOException; - - - /** - * Reads a sequence of unsigned 16-bit integers into a - * <code>char[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param c an array for storing the read values. - * - * @param offset the index of the first element in <code>c</code> - * that will hold read data. - * - * @param numChars the number of unsigned 16-bit integers to read - * (which is one half of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numChars</code> is negative, or if <code>offset + - * numChars</code> exceeds <code>c.length</code>. - * - * @throws NullPointerException if <code>c</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readChar() - */ - void readFully(char[] c, int offset, int numChars) - throws IOException; - - - /** - * Reads a sequence of signed 32-bit integers into a - * <code>long[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param i an array for storing the read values. - * - * @param offset the index of the first element in <code>i</code> - * that will hold read data. - * - * @param numInts the number of signed 32-bit integers to read - * (which is one fourth of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numInts</code> is negative, or if <code>offset + - * numInts</code> exceeds <code>i.length</code>. - * - * @throws NullPointerException if <code>i</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readInt() - */ - void readFully(int[] i, int offset, int numInts) - throws IOException; - - - /** - * Reads a sequence of signed 64-bit integers into a - * <code>long[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param l an array for storing the read values. - * - * @param offset the index of the first element in <code>l</code> - * that will hold read data. - * - * @param numLongs the number of signed 64-bit integers to read - * (which is one eight of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numLongs</code> is negative, or if <code>offset + - * numLongs</code> exceeds <code>l.length</code>. - * - * @throws NullPointerException if <code>l</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readLong() - */ - void readFully(long[] l, int offset, int numLongs) - throws IOException; - - - /** - * Reads a sequence of IEEE 32-bit single-precision floating point - * numbers into a <code>float[]</code> array. If necessary, values - * are converted from the stream’s {@linkplain - * #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param d an array for storing the read values. - * - * @param offset the index of the first element in <code>d</code> - * that will hold read data. - * - * @param numFloats the number of IEEE 32-bit single-precision - * floating point numbers to read (which is one fourth of the number - * of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numFloats</code> is negative, or if <code>offset + - * numFloats</code> exceeds <code>f.length</code>. - * - * @throws NullPointerException if <code>f</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFloat() - */ - void readFully(float[] f, int offset, int numFloats) - throws IOException; - - - /** - * Reads a sequence of IEEE 64-bit double-precision floating point - * numbers into a <code>double[]</code> array. If necessary, values - * are converted from the stream’s {@linkplain - * #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param d an array for storing the read values. - * - * @param offset the index of the first element in <code>d</code> - * that will hold read data. - * - * @param numDoubles the number of IEEE 64-bit double-precision - * floating point numbers to read (which is one eight of the number - * of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numDoubles</code> is negative, or if <code>offset + - * numDoubles</code> exceeds <code>d.length</code>. - * - * @throws NullPointerException if <code>d</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readDouble() - */ - void readFully(double[] d, int offset, int numDoubles) - throws IOException; - - long getStreamPosition() - throws IOException; - - int getBitOffset() - throws IOException; - - void setBitOffset(int bitOffset) - throws IOException; - - int readBit() - throws IOException; - - long readBits(int numBits) - throws IOException; - - long length() - throws IOException; - - int skipBytes(int numBytes) - throws IOException; - - long skipBytes(long numBytes) - throws IOException; - - void seek(long pos) - throws IOException; - - void mark(); - - void reset() - throws IOException; - - void flushBefore(long pos) - throws IOException; - - void flush() - throws IOException; - - long getFlushedPosition(); - - boolean isCached(); - - boolean isCachedMemory(); - - boolean isCachedFile(); - - void close() - throws IOException; -} diff --git a/libjava/classpath/javax/imageio/stream/ImageInputStreamImpl.java b/libjava/classpath/javax/imageio/stream/ImageInputStreamImpl.java deleted file mode 100644 index 72fd6de..0000000 --- a/libjava/classpath/javax/imageio/stream/ImageInputStreamImpl.java +++ /dev/null @@ -1,542 +0,0 @@ -/* ImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import gnu.java.lang.CPStringBuilder; - -import java.io.DataInputStream; -import java.io.EOFException; -import java.io.IOException; -import java.nio.ByteOrder; -import java.util.Stack; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class ImageInputStreamImpl implements ImageInputStream -{ - private boolean closed; - private Stack markStack = new Stack(); - - byte[] buffer = new byte[8]; - - protected int bitOffset; - protected ByteOrder byteOrder = ByteOrder.BIG_ENDIAN; - protected long flushedPos; - protected long streamPos; - - public ImageInputStreamImpl() - { - // Do nothing here. - } - - protected final void checkClosed() - throws IOException - { - if (closed) - throw new IOException("stream closed"); - } - - public void close() - throws IOException - { - checkClosed(); - closed = true; - } - - protected void finalize() - throws Throwable - { - if (!closed) - close(); - } - - public void flush() - throws IOException - { - flushBefore(getStreamPosition()); - } - - public void flushBefore(long position) - throws IOException - { - if (position < flushedPos) - throw new IndexOutOfBoundsException(); - - if (position > streamPos) - throw new IndexOutOfBoundsException(); - - flushedPos = position; - } - - public int getBitOffset() - throws IOException - { - checkClosed(); - return bitOffset; - } - - public ByteOrder getByteOrder() - { - return byteOrder; - } - - public long getFlushedPosition() - { - return flushedPos; - } - - public long getStreamPosition() - throws IOException - { - checkClosed(); - return streamPos; - } - - public boolean isCached() - { - return false; - } - - public boolean isCachedFile() - { - return false; - } - - public boolean isCachedMemory() - { - return false; - } - - public long length() - { - return -1L; - } - - public void mark() - { - try - { - markStack.push(new Long(getStreamPosition())); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } - - public abstract int read() - throws IOException; - - public abstract int read(byte[] data, int offset, int len) - throws IOException; - - public int read(byte[] data) - throws IOException - { - return read(data, 0, data.length); - } - - public int readBit() - throws IOException - { - checkClosed(); - - // Calculate new bit offset here as readByte clears it. - int newOffset = (bitOffset + 1) & 0x7; - - // Clears bitOffset. - byte data = readByte(); - - // If newOffset is 0 it means we just read the 8th bit in a byte - // and therefore we want to advance to the next byte. Otherwise - // we want to roll back the stream one byte so that future readBit - // calls read bits from the same current byte. - if (newOffset != 0) - { - seek(getStreamPosition() - 1); - data = (byte) (data >> (8 - newOffset)); - } - - bitOffset = newOffset; - return data & 0x1; - } - - public long readBits(int numBits) - throws IOException - { - checkClosed(); - - if (numBits < 0 || numBits > 64) - throw new IllegalArgumentException(); - - long bits = 0L; - - for (int i = 0; i < numBits; i++) - { - bits <<= 1; - bits |= readBit(); - } - return bits; - } - - public boolean readBoolean() - throws IOException - { - byte data = readByte(); - - return data != 0; - } - - public byte readByte() - throws IOException - { - checkClosed(); - - int data = read(); - - if (data == -1) - throw new EOFException(); - - return (byte) data; - } - - public void readBytes(IIOByteBuffer buffer, int len) - throws IOException - { - readFullyPrivate(buffer.getData(), buffer.getOffset(), len); - - buffer.setLength(len); - } - - public char readChar() - throws IOException - { - return (char) readShort(); - } - - public double readDouble() - throws IOException - { - return Double.longBitsToDouble(readLong()); - } - - public float readFloat() - throws IOException - { - return Float.intBitsToFloat(readInt()); - } - - public void readFully(byte[] data) - throws IOException - { - readFully(data, 0, data.length); - } - - public void readFully(byte[] data, int offset, int len) - throws IOException - { - readFullyPrivate(data, offset, len); - } - - public void readFully(char[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readChar(); - } - - public void readFully(double[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readDouble(); - } - - public void readFully(float[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readFloat(); - } - - public void readFully(int[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readInt(); - } - - public void readFully(long[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readLong(); - } - - public void readFully(short[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readShort(); - } - - public int readInt() - throws IOException - { - readFullyPrivate(buffer, 0, 4); - - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - return (int) - (((int) (buffer[0] & 0xff) << 0) - | ((int) (buffer[1] & 0xff) << 8) - | ((int) (buffer[2] & 0xff) << 16) - | ((int) (buffer[3] & 0xff) << 24)); - - return (int) - (((int) (buffer[0] & 0xff) << 24) - + ((int) (buffer[1] & 0xff) << 16) - + ((int) (buffer[2] & 0xff) << 8) - + ((int) (buffer[3] & 0xff) << 0)); - } - - public String readLine() - throws IOException - { - checkClosed(); - - int c = -1; - boolean eol = false; - CPStringBuilder buffer = new CPStringBuilder(); - - c = read(); - if (c == -1) - return null; - - while (!eol) - { - switch(c) - { - case '\r': - // Check for following '\n'. - long oldPosition = getStreamPosition(); - c = read(); - if (c == -1 || c == '\n') - eol = true; - else - { - seek(oldPosition); - eol = true; - } - continue; - - case '\n': - eol = true; - continue; - - default: - buffer.append((char) c); - break; - } - c = read(); - if (c == -1) - eol = true; - } - - return buffer.toString(); - } - - public long readLong() - throws IOException - { - readFullyPrivate(buffer, 0, 8); - - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - return (long) - (((long) (buffer[0] & 0xff) << 0) - | ((long) (buffer[1] & 0xff) << 8) - | ((long) (buffer[2] & 0xff) << 16) - | ((long) (buffer[3] & 0xff) << 24) - | ((long) (buffer[4] & 0xff) << 32) - | ((long) (buffer[5] & 0xff) << 40) - | ((long) (buffer[6] & 0xff) << 48) - | ((long) (buffer[7] & 0xff) << 56)); - - return (long) - (((long) (buffer[0] & 0xff) << 56) - | ((long) (buffer[1] & 0xff) << 48) - | ((long) (buffer[2] & 0xff) << 40) - | ((long) (buffer[3] & 0xff) << 32) - | ((long) (buffer[4] & 0xff) << 24) - | ((long) (buffer[5] & 0xff) << 16) - | ((long) (buffer[6] & 0xff) << 8) - | ((long) (buffer[7] & 0xff) << 0)); - } - - public short readShort() - throws IOException - { - readFullyPrivate(buffer, 0, 2); - - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - return (short) - (((short) (buffer[0] & 0xff) << 0) - | ((short) (buffer[1] & 0xff) << 8)); - - return (short) - (((short) (buffer[0] & 0xff) << 8) - | ((short) (buffer[1] & 0xff) << 0)); - } - - public int readUnsignedByte() - throws IOException - { - return (int) readByte() & 0xff; - } - - public long readUnsignedInt() - throws IOException - { - return (long) readInt() & 0xffffffffL; - } - - public int readUnsignedShort() - throws IOException - { - return (int) readShort() & 0xffff; - } - - public String readUTF() - throws IOException - { - checkClosed(); - - String data; - ByteOrder old = getByteOrder(); - // Strings are always big endian. - setByteOrder(ByteOrder.BIG_ENDIAN); - - try - { - data = DataInputStream.readUTF(this); - } - finally - { - setByteOrder(old); - } - - return data; - } - - public void reset() - throws IOException - { - checkClosed(); - - long mark = ((Long) markStack.pop()).longValue(); - seek(mark); - } - - public void seek(long position) - throws IOException - { - checkClosed(); - - if (position < getFlushedPosition()) - throw new IndexOutOfBoundsException("position < flushed position"); - - streamPos = position; - bitOffset = 0; - } - - public void setBitOffset (int bitOffset) - throws IOException - { - checkClosed(); - - if (bitOffset < 0 || bitOffset > 7) - throw new IllegalArgumentException("bitOffset not between 0 and 7 inclusive"); - - this.bitOffset = bitOffset; - } - - public void setByteOrder(ByteOrder byteOrder) - { - this.byteOrder = byteOrder; - } - - public int skipBytes(int num) - throws IOException - { - checkClosed(); - - seek(getStreamPosition() + num); - bitOffset = 0; - return num; - } - - public long skipBytes(long num) - throws IOException - { - checkClosed(); - - seek(getStreamPosition() + num); - bitOffset = 0; - return num; - } - - private void readFullyPrivate (byte[] buf, int offset, int len) throws IOException - { - checkClosed(); - - if (len < 0) - throw new IndexOutOfBoundsException("Negative length: " + len); - - while (len > 0) - { - // read will block until some data is available. - int numread = read (buf, offset, len); - if (numread < 0) - throw new EOFException (); - len -= numread; - offset += numread; - } - bitOffset = 0; - } -} diff --git a/libjava/classpath/javax/imageio/stream/ImageOutputStream.java b/libjava/classpath/javax/imageio/stream/ImageOutputStream.java deleted file mode 100644 index 4688ad9..0000000 --- a/libjava/classpath/javax/imageio/stream/ImageOutputStream.java +++ /dev/null @@ -1,269 +0,0 @@ -/* ImageOutputStream.java - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.DataOutput; -import java.io.IOException; - - -/** - * An output stream for use by {@link javax.imageio.ImageWriter - * ImageWriters}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public interface ImageOutputStream - extends ImageInputStream, DataOutput -{ - /** - * @param position - * - * @throws IOException if an errror occurs - */ - void flushBefore(long position) throws IOException; - - /** - * Writes an array into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void write(byte[] data) throws IOException; - - /** - * Writes a region of data from an array into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the length in the array - * - * @throws IOException if an errror occurs - */ - void write(byte[] data, int offset, int len) throws IOException; - - /** - * Writes an <code>int</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void write(int data) throws IOException; - - /** - * Writes a bit value to the stream. - * - * @throws IOException if an error occurs - */ - void writeBit(int bit) throws IOException; - - /** - * Writes a number of bit values to the stream. - * - * @throws IOException if an errror occurs - */ - void writeBits(long bits, int numBits) throws IOException; - - /** - * Writes a <code>boolean</code> value into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeBoolean(boolean data) throws IOException; - - /** - * Writes a <code>byte</code> value into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeByte(int data) throws IOException; - - /** - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeBytes(String data) throws IOException; - - /** - * Writes a character into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeChar(int data) throws IOException; - - /** - * Writes characters to the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeChars(char[] data, int offset, int len) throws IOException; - - /** - * Writes characters from a given <code>String</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeChars(String data) throws IOException; - - /** - * Writes a <code>double</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeDouble(double data) throws IOException; - - /** - * Writes an array of <code>double</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeDoubles(double[] data, int offset, int len) - throws IOException; - - /** - * Writes a <code>float</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeFloat(float data) throws IOException; - - /** - * Writes an array of <code>float</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeFloats(float[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>int</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeInt(int data) throws IOException; - - /** - * Writes an array of <code>int</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeInts(int[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>long</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeLong(long data) throws IOException; - - /** - * Writes an array of <code>long</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeLongs(long[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>short</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeShort(int data) throws IOException; - - /** - * Writes an array of <code>short</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeShorts(short[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>String</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeUTF(String data) throws IOException; -} diff --git a/libjava/classpath/javax/imageio/stream/ImageOutputStreamImpl.java b/libjava/classpath/javax/imageio/stream/ImageOutputStreamImpl.java deleted file mode 100644 index 5bf7e44..0000000 --- a/libjava/classpath/javax/imageio/stream/ImageOutputStreamImpl.java +++ /dev/null @@ -1,374 +0,0 @@ -/* ImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.IOException; -import java.io.UTFDataFormatException; -import java.nio.ByteOrder; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl - implements ImageOutputStream -{ - public ImageOutputStreamImpl() - { - // Do nothing here. - } - - protected final void flushBits() - throws IOException - { - checkClosed(); - if (bitOffset != 0) - { - int offset = bitOffset; - int partial = read(); - if (partial < 0) - { - partial = 0; - bitOffset = 0; - } - else - { - seek(getStreamPosition() - 1); - partial &= -1 << (8 - offset); - } - write(partial); - } - } - - public void write(byte[] data) - throws IOException - { - write(data, 0, data.length); - } - - public abstract void write(byte[] data, int offset, int len) - throws IOException; - - public abstract void write(int value) - throws IOException; - - public void writeBit(int bit) - throws IOException - { - writeBits(1L & bit, 1); - } - - public void writeBits(long bits, int numBits) - throws IOException - { - checkClosed(); - // Append chunk of bits to any preexisting bits, if any. - if (getStreamPosition() > 0 || bitOffset > 0) - { - int offs = bitOffset; - int partial = read(); - if (partial != -1) - seek(getStreamPosition() - 1); - else - partial = 0; - if (numBits + offs < 8) - { - // Append complete bits to partial byte. - int shift = 8 - (offs + numBits); - int mask = -1 >>> (32 - numBits); - partial &= ~(mask << shift); - partial |= (bits & mask) << shift; - write(partial); - seek(getStreamPosition() - 1); - bitOffset = offs + numBits; - numBits = 0; - } - else - { - // Append bits and decrease numBits accordingly. - int num = 8 - offs; - int mask = -1 >>> (32 - num); - partial &= ~mask; - partial |= (bits >> (numBits - num)) & mask; - write(partial); - numBits -= num; - } - } - - // Write out whole chunks, if any. - if (numBits > 7) - { - int remaining = numBits % 8; - for (int numBytes = numBits / 8; numBytes > 0; numBytes--) - { - int shift = (numBytes - 1) * 8 + remaining; - int value = (int) ((shift == 0) ? bits & 0xff - : (bits >> shift) & 0xff); - write(value); - } - numBits = remaining; - } - - // Write remaing partial bytes. - if (numBits != 0) - { - int partial = read(); - if (partial == -1) - { - seek(getStreamPosition() - 1); - } - else - { - partial = 0; - } - int shift = 8 - numBits; - int mask = -1 >>> (32 - numBits); - partial &= ~(mask << shift); - partial |= (bits & mask) << shift; - write(partial); - seek(getStreamPosition() - 1); - bitOffset = numBits; - } - } - - public void writeBoolean(boolean value) - throws IOException - { - writeByte(value ? 1 : 0); - } - - public void writeByte(int value) - throws IOException - { - write(value & 0xff); - } - - public void writeBytes(String data) - throws IOException - { - // This is bogus, but it is how the method is specified. - // Sun ought to deprecate this method. - int len = data.length(); - for (int i = 0; i < len; ++i) - writeByte(data.charAt(i)); - } - - public void writeChar(int value) - throws IOException - { - writeShort(value); - } - - public void writeChars(char[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeChar(data[offset + i]); - } - - public void writeChars(String data) - throws IOException - { - int len = data.length(); - for (int i = 0; i < len; ++i) - writeChar(data.charAt(i)); - } - - public void writeDouble(double value) - throws IOException - { - writeLong(Double.doubleToLongBits(value)); - } - - public void writeDoubles(double[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeDouble(data[offset + i]); - } - - public void writeFloat(float value) - throws IOException - { - writeInt(Float.floatToIntBits(value)); - } - - public void writeFloats(float[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeFloat(data[offset + i]); - } - - public void writeInt(int value) - throws IOException - { - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - buffer[0] = ((byte) value); - buffer[1] = ((byte) (value >> 8)); - buffer[2] = ((byte) (value >> 16)); - buffer[3] = ((byte) (value >> 24)); - } - else - { - buffer[0] = ((byte) (value >> 24)); - buffer[1] = ((byte) (value >> 16)); - buffer[2] = ((byte) (value >> 8)); - buffer[3] = ((byte) value); - } - - write(buffer, 0, 4); - } - - public void writeInts(int[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeInt(data[offset + i]); - } - - public void writeLong(long value) - throws IOException - { - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - buffer[0] = ((byte) value); - buffer[1] = ((byte) (value >> 8)); - buffer[2] = ((byte) (value >> 16)); - buffer[3] = ((byte) (value >> 24)); - buffer[4] = ((byte) (value >> 32)); - buffer[5] = ((byte) (value >> 40)); - buffer[6] = ((byte) (value >> 48)); - buffer[7] = ((byte) (value >> 56)); - } - else - { - buffer[0] = ((byte) (value >> 56)); - buffer[1] = ((byte) (value >> 48)); - buffer[2] = ((byte) (value >> 40)); - buffer[3] = ((byte) (value >> 32)); - buffer[4] = ((byte) (value >> 24)); - buffer[5] = ((byte) (value >> 16)); - buffer[6] = ((byte) (value >> 8)); - buffer[7] = ((byte) value); - } - - write(buffer, 0, 8); - } - - public void writeLongs(long[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeLong(data[offset + i]); - } - - public void writeShort(int value) - throws IOException - { - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - buffer[0] = ((byte) value); - buffer[1] = ((byte) (value >> 8)); - } - else - { - buffer[0] = ((byte) (value >> 8)); - buffer[1] = ((byte) value); - } - - write(buffer, 0, 2); - } - - public void writeShorts(short[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeShort(data[offset + i]); - } - - public void writeUTF(String value) - throws IOException - { - // NOTE: this code comes directly from DataOutputStream. - int len = value.length(); - int sum = 0; - - for (int i = 0; i < len && sum <= 65535; ++i) - { - char c = value.charAt(i); - if (c >= '\u0001' && c <= '\u007f') - sum += 1; - else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) - sum += 2; - else - sum += 3; - } - - if (sum > 65535) - throw new UTFDataFormatException (); - - int pos = 0; - byte[] buf = new byte[sum]; - - for (int i = 0; i < len; ++i) - { - char c = value.charAt(i); - if (c >= '\u0001' && c <= '\u007f') - buf[pos++] = (byte) c; - else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) - { - buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6))); - buf[pos++] = (byte) (0x80 | (0x3f & c)); - } - else - { - // JSL says the first byte should be or'd with 0xc0, but - // that is a typo. Unicode says 0xe0, and that is what is - // consistent with DataInputStream. - buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12))); - buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6))); - buf[pos++] = (byte) (0x80 | (0x3f & c)); - } - } - - writeShort (sum); - write(buf, 0, sum); - } -} diff --git a/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java b/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java deleted file mode 100644 index e1ad71f..0000000 --- a/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java +++ /dev/null @@ -1,127 +0,0 @@ -/* MemoryCacheImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class MemoryCacheImageInputStream extends ImageInputStreamImpl -{ - private InputStream stream; - private BufferedInputStream buffer; - - private int READLIMIT = 2048; - - public MemoryCacheImageInputStream(InputStream stream) - { - this.stream = stream; - buffer = new BufferedInputStream(stream); - buffer.mark(READLIMIT); - } - - public void close() - throws IOException - { - super.close(); - stream.close(); - } - - public void flushBefore(long position) - throws IOException - { - long prevFlushedPosition = getFlushedPosition(); - super.flushBefore(position); - buffer.reset(); - buffer.skip(getFlushedPosition() - prevFlushedPosition); - buffer.mark(READLIMIT); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return false; - } - - public boolean isCachedMemory() - { - return true; - } - - public int read() - throws IOException - { - setBitOffset(0); - int retval = buffer.read(); - - if (retval != -1) - streamPos++; - - return retval; - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - setBitOffset(0); - int retval = buffer.read(data, offset, len); - - if (retval != -1) - { - streamPos += retval; - } - - return retval; - } - - public void seek(long position) - throws IOException - { - super.seek(position); - buffer.reset(); - buffer.skip(position - getFlushedPosition()); - } -} diff --git a/libjava/classpath/javax/imageio/stream/MemoryCacheImageOutputStream.java b/libjava/classpath/javax/imageio/stream/MemoryCacheImageOutputStream.java deleted file mode 100644 index 84e8360..0000000 --- a/libjava/classpath/javax/imageio/stream/MemoryCacheImageOutputStream.java +++ /dev/null @@ -1,114 +0,0 @@ -/* MemoryCacheImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import gnu.classpath.NotImplementedException; - -import java.io.IOException; -import java.io.OutputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl -{ - private OutputStream stream; - - public MemoryCacheImageOutputStream(OutputStream stream) - { - this.stream = stream; - } - - public void close() - throws IOException - { - super.close(); - stream.close(); - } - - public void flushBefore(long position) - throws IOException, NotImplementedException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return false; - } - - public boolean isCachedMemory() - { - return true; - } - - public int read() - throws IOException, NotImplementedException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public int read (byte[] data, int offset, int len) - throws IOException, NotImplementedException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void write(byte[] data, int offset, int len) - throws IOException - { - // FIXME: Flush pending bits. - stream.write(data, offset, len); - } - - public void write(int value) - throws IOException - { - // FIXME: Flush pending bits. - stream.write(value); - } -} diff --git a/libjava/classpath/javax/imageio/stream/package.html b/libjava/classpath/javax/imageio/stream/package.html deleted file mode 100644 index 63e53ca..0000000 --- a/libjava/classpath/javax/imageio/stream/package.html +++ /dev/null @@ -1,46 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -<!-- package.html - describes classes in javax.imageio.stream package. - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. --> - -<html> -<head><title>GNU Classpath - javax.imageio.stream</title></head> - -<body> -<p></p> - -</body> -</html> |