An input stream that implements ArrayInput. @author Dave Hale, Colorado School of Mines @version 2006.08.05
| 23 | * @version 2006.08.05 |
| 24 | */ |
| 25 | public class ArrayInputStream |
| 26 | extends FilterInputStream |
| 27 | implements ArrayInput |
| 28 | { |
| 29 | |
| 30 | /** |
| 31 | * Constructs an array input stream for the specified stream. |
| 32 | * The default byte order is BIG_ENDIAN. |
| 33 | * @param is the input stream. |
| 34 | */ |
| 35 | public ArrayInputStream(InputStream is) { |
| 36 | this(is,ByteOrder.BIG_ENDIAN); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Constructs an array input stream for the specified file input stream. |
| 41 | * The default byte order is BIG_ENDIAN. |
| 42 | * @param fis the file input stream. |
| 43 | */ |
| 44 | public ArrayInputStream(FileInputStream fis) { |
| 45 | this(fis,ByteOrder.BIG_ENDIAN); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Constructs an array input stream for the specified file name. |
| 50 | * The default byte order is BIG_ENDIAN. |
| 51 | * @param name the file name. |
| 52 | */ |
| 53 | public ArrayInputStream(String name) throws FileNotFoundException { |
| 54 | this(new FileInputStream(name)); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Constructs an array input stream for the specified file. |
| 59 | * The default byte order is BIG_ENDIAN. |
| 60 | * @param file the file. |
| 61 | */ |
| 62 | public ArrayInputStream(File file) throws FileNotFoundException { |
| 63 | this(new FileInputStream(file)); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Constructs an array input stream for the specified stream and byte order. |
| 68 | * @param is the input stream. |
| 69 | * @param bo the byte order. |
| 70 | */ |
| 71 | public ArrayInputStream(InputStream is, ByteOrder bo) { |
| 72 | super(is); |
| 73 | _dis = new DataInputStream(new BufferedInputStream(is)); |
| 74 | _ai = new ArrayInputAdapter(_dis,bo); |
| 75 | _bo = bo; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Constructs an array input stream for the specified file name |
| 80 | * and byte order. |
| 81 | * The default byte order is BIG_ENDIAN. |
| 82 | * @param name the file name. |
no outgoing calls
no test coverage detected