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    
017    package com.google.common.io;
018    
019    import java.io.DataInput;
020    import 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     */
035    public interface ByteArrayDataInput extends DataInput {
036      void readFully(byte b[]);
037    
038      void readFully(byte b[], int off, int len);
039    
040      int skipBytes(int n);
041    
042      boolean readBoolean();
043    
044      byte readByte();
045    
046      int readUnsignedByte();
047    
048      short readShort();
049    
050      int readUnsignedShort();
051    
052      char readChar();
053    
054      int readInt();
055    
056      long readLong();
057    
058      float readFloat();
059    
060      double readDouble();
061    
062      String readLine();
063    
064      String readUTF();
065    }