class DataInputStream extends InputStream {

		private RandomAccessFile file;

		private int position;

		DataInputStream(ResourceAccess access) throws IOException {
			if (access == ResourceAccess.ONCE) {
				this.file = new RandomAccessFile(RandomAccessDataFile.this.file, "r");
				this.file.seek(RandomAccessDataFile.this.offset);
			}
		}

		@Override
		public int read() throws IOException {
			return doRead(null, 0, 1);
		}

		@Override
		public int read(byte[] b) throws IOException {
			return read(b, 0, b != null ? b.length : 0);
		}

		@Override
		public int read(byte[] b, int off, int len) throws IOException {
			if (b == null) {
				throw new NullPointerException("Bytes must not be null");
			}
			return doRead(b, off, len);
		}

		/**
		 * Perform the actual read.
		 * @param b the bytes to read or {@code null} when reading a single byte
		 * @param off the offset of the byte array
		 * @param len the length of data to read
		 * @return the number of bytes read into {@code b} or the actual read byte if
		 * {@code b} is {@code null}. Returns -1 when the end of the stream is reached
		 * @throws IOException in case of I/O errors
		 */
		public int doRead(byte[] b, int off, int len) throws IOException {<FILL_FUNCTION_BODY>}

		@Override
		public long skip(long n) throws IOException {
			return (n <= 0 ? 0 : moveOn(cap(n)));
		}

		@Override
		public void close() throws IOException {
			if (this.file != null) {
				this.file.close();
			}
		}

		/**
		 * Cap the specified value such that it cannot exceed the number of bytes
		 * remaining.
		 * @param n the value to cap
		 * @return the capped value
		 */
		private int cap(long n) {
			return (int) Math.min(RandomAccessDataFile.this.length - this.position, n);
		}

		/**
		 * Move the stream position forwards the specified amount.
		 * @param amount the amount to move
		 * @return the amount moved
		 */
		private long moveOn(int amount) {
			this.position += amount;
			return amount;
		}

	}

			if (len == 0) {
				return 0;
			}
			int cappedLen = cap(len);
			if (cappedLen <= 0) {
				return -1;
			}
			RandomAccessFile file = this.file;
			try {
				if (file == null) {
					file = RandomAccessDataFile.this.filePool.acquire();
					file.seek(RandomAccessDataFile.this.offset + this.position);
				}
				if (b == null) {
					int rtn = file.read();
					moveOn(rtn != -1 ? 1 : 0);
					return rtn;
				}
				else {
					return (int) moveOn(file.read(b, off, cappedLen));
				}
			}
			finally {
				if (this.file == null && file != null) {
					RandomAccessDataFile.this.filePool.release(file);
				}
			}
		
<no_super_class>