001/*
002 * Copyright (C) 2009 The Guava Authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.google.common.io;
018
019import java.io.DataInput;
020import java.io.IOException;
021
022/**
023 * An extension of {@code DataInput} for reading from in-memory byte arrays; its
024 * methods offer identical functionality but do not throw {@link IOException}.
025 *
026 * <p><b>Warning:</b> The caller is responsible for not attempting to read past
027 * the end of the array. If any method encounters the end of the array
028 * prematurely, it throws {@link IllegalStateException} to signify <i>programmer
029 * error</i>. This behavior is a technical violation of the supertype's
030 * contract, which specifies a checked exception.
031 *
032 * @author Kevin Bourrillion
033 * @since 1.0
034 */
035public interface ByteArrayDataInput extends DataInput {
036  @Override void readFully(byte b[]);
037
038  @Override void readFully(byte b[], int off, int len);
039
040  @Override int skipBytes(int n);
041
042  @Override boolean readBoolean();
043
044  @Override byte readByte();
045
046  @Override int readUnsignedByte();
047
048  @Override short readShort();
049
050  @Override int readUnsignedShort();
051
052  @Override char readChar();
053
054  @Override int readInt();
055
056  @Override long readLong();
057
058  @Override float readFloat();
059
060  @Override double readDouble();
061
062  @Override String readLine();
063
064  @Override String readUTF();
065}