X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=libjava%2Fgnu%2Fgcj%2Fprotocol%2Fcore%2FCoreInputStream.java;fp=libjava%2Fgnu%2Fgcj%2Fprotocol%2Fcore%2FCoreInputStream.java;h=0000000000000000000000000000000000000000;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=3dd0524f162626483e29336b98520db0cb2a5144;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libjava/gnu/gcj/protocol/core/CoreInputStream.java b/libjava/gnu/gcj/protocol/core/CoreInputStream.java deleted file mode 100644 index 3dd0524f..00000000 --- a/libjava/gnu/gcj/protocol/core/CoreInputStream.java +++ /dev/null @@ -1,89 +0,0 @@ -// Handler.java - URLStreamHandler for core protocol. - -/* Copyright (C) 2001 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package gnu.gcj.protocol.core; - -import java.io.*; -import gnu.gcj.Core; -import gnu.gcj.RawData; - -public class CoreInputStream extends InputStream -{ - /* A pointer to the object in memory. */ - protected RawData ptr; - - /* Position of the next byte in core to be read. */ - protected int pos; - - /* The currently marked position in the stream. */ - protected int mark; - - /* The index in core one greater than the last valid character. */ - protected int count; - - private native int unsafeGetByte (long offset); - private native int copyIntoByteArray (byte[] dest, int offset, int numBytes); - - public CoreInputStream (Core core) - { - ptr = core.ptr; - count = core.length; - } - - public synchronized int available() - { - return count - pos; - } - - public synchronized void mark(int readAheadLimit) - { - // readAheadLimit is ignored per Java Class Lib. book, p.220. - mark = pos; - } - - public boolean markSupported() - { - return true; - } - - public synchronized int read() - { - if (pos < count) - return ((int) unsafeGetByte(pos++)) & 0xFF; - return -1; - } - - public synchronized int read(byte[] b, int off, int len) - { - if (pos >= count) - return -1; - - int numBytes = Math.min(count - pos, len); - copyIntoByteArray (b, off, numBytes); - pos += numBytes; - return numBytes; - } - - public synchronized void reset() - { - pos = mark; - } - - public synchronized long skip(long n) - { - // Even though the var numBytes is a long, in reality it can never - // be larger than an int since the result of subtracting 2 positive - // ints will always fit in an int. Since we have to return a long - // anyway, numBytes might as well just be a long. - long numBytes = Math.min((long) (count - pos), n < 0 ? 0L : n); - pos += numBytes; - return numBytes; - } -}