1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.util.binary;
14 import java.io.DataInput;
15 import java.io.EOFException;
16 import java.io.IOException;
17 import java.nio.ByteBuffer;
20 * BinaryReadable is a readable stream of bytes.
22 * Common interface for ByteBuffer, byte[], InputStream, RandomAccessFile.
24 * @see ByteBufferReadable
25 * @see InputStreamReadable
26 * @author Toni Kalajainen (toni.kalajainen@vtt.fi)
28 public interface BinaryReadable extends DataInput {
30 long skipBytes(long bytes) throws IOException;
36 * @throws EOFException if this stream reaches the end before reading all
38 * @throws IOException if an I/O error occurs.
40 void readFully(ByteBuffer buf)
44 * Read fully length bytes
48 * @throws EOFException if this stream reaches the end before reading
50 * @throws IOException if an I/O error occurs.
52 void readFully(ByteBuffer buf, int length)
55 long length() throws IOException;
57 long position() throws IOException;