Implements ArrayInput by wrapping java.io.DataInput. This adapter wraps a specified data input to provide methods for reading values and arrays of values with an optionally specified byte order. Byte order should rarely be specified. Most applications should simply use the defaul
| 33 | * @version 2006.08.05 |
| 34 | */ |
| 35 | public class ArrayInputAdapter implements ArrayInput { |
| 36 | |
| 37 | /** |
| 38 | * Constructs an adapter for the specified data input. |
| 39 | * The default byte order is BIG_ENDIAN. |
| 40 | * @param input the data input. |
| 41 | */ |
| 42 | public ArrayInputAdapter(DataInput input) { |
| 43 | this(input,ByteOrder.BIG_ENDIAN); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Constructs an adapter for the specified random-access file. |
| 48 | * The file channel of the random-access file enables more efficient reads. |
| 49 | * @param file the random-access file. |
| 50 | */ |
| 51 | public ArrayInputAdapter(RandomAccessFile file) { |
| 52 | this(file,ByteOrder.BIG_ENDIAN); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Constructs an adapter for the specified file input stream and byte order. |
| 57 | * The file channel of the file input stream enables more efficient reads. |
| 58 | * @param stream the file input stream. |
| 59 | */ |
| 60 | public ArrayInputAdapter(FileInputStream stream) { |
| 61 | this(stream,ByteOrder.BIG_ENDIAN); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Constructs an adapter for the specified data input and byte order. |
| 66 | * @param input the data input. |
| 67 | * @param order the byte order. |
| 68 | */ |
| 69 | public ArrayInputAdapter(DataInput input, ByteOrder order) { |
| 70 | this(null,input,order); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Constructs an adapter for the specified random-access file and byte order. |
| 75 | * The file channel of the random-access file enables more efficient reads. |
| 76 | * @param file the random-access file. |
| 77 | * @param order the byte order. |
| 78 | */ |
| 79 | public ArrayInputAdapter(RandomAccessFile file, ByteOrder order) { |
| 80 | this(file.getChannel(),file,order); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Constructs an adapter for the specified file input stream and byte order. |
| 85 | * The file channel of the file input stream enables more efficient reads. |
| 86 | * @param stream the file input stream. |
| 87 | * @param order the byte order. |
| 88 | */ |
| 89 | public ArrayInputAdapter(FileInputStream stream, ByteOrder order) { |
| 90 | this(stream.getChannel(),new DataInputStream(stream),order); |
| 91 | } |
| 92 |
nothing calls this directly
no outgoing calls
no test coverage detected