Home | History | Annotate | Download | only in io
      1 /*
      2  * Copyright (C) 2009 The Guava Authors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.google.common.io;
     18 
     19 import java.io.DataInput;
     20 import java.io.IOException;
     21 
     22 /**
     23  * An extension of {@code DataInput} for reading from in-memory byte arrays; its
     24  * methods offer identical functionality but do not throw {@link IOException}.
     25  *
     26  * <p><b>Warning:<b> The caller is responsible for not attempting to read past
     27  * the end of the array. If any method encounters the end of the array
     28  * prematurely, it throws {@link IllegalStateException} to signify <i>programmer
     29  * error</i>. This behavior is a technical violation of the supertype's
     30  * contract, which specifies a checked exception.
     31  *
     32  * @author Kevin Bourrillion
     33  * @since 1.0
     34  */
     35 public interface ByteArrayDataInput extends DataInput {
     36   @Override void readFully(byte b[]);
     37 
     38   @Override void readFully(byte b[], int off, int len);
     39 
     40   @Override int skipBytes(int n);
     41 
     42   @Override boolean readBoolean();
     43 
     44   @Override byte readByte();
     45 
     46   @Override int readUnsignedByte();
     47 
     48   @Override short readShort();
     49 
     50   @Override int readUnsignedShort();
     51 
     52   @Override char readChar();
     53 
     54   @Override int readInt();
     55 
     56   @Override long readLong();
     57 
     58   @Override float readFloat();
     59 
     60   @Override double readDouble();
     61 
     62   @Override String readLine();
     63 
     64   @Override String readUTF();
     65 }
     66