|
1 | 1 | /** |
2 | | - * Copyright 2015-2019 Kaitai Project: MIT license |
| 2 | + * Copyright 2015-2020 Kaitai Project: MIT license |
3 | 3 | * |
4 | 4 | * Permission is hereby granted, free of charge, to any person obtaining |
5 | 5 | * a copy of this software and associated documentation files (the |
@@ -55,18 +55,47 @@ public ByteBufferKaitaiStream(String fileName) throws IOException { |
55 | 55 | /** |
56 | 56 | * Initializes a stream that will get data from given byte array when read. |
57 | 57 | * Internally, ByteBuffer wrapping given array will be used. |
| 58 | + * |
58 | 59 | * @param arr byte array to read |
59 | 60 | */ |
60 | 61 | public ByteBufferKaitaiStream(byte[] arr) { |
| 62 | + this(arr, 0); |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * Initializes a stream that will get data from given byte array when read. |
| 67 | + * Internally, ByteBuffer wrapping given array will be used. |
| 68 | + * |
| 69 | + * @param arr byte array to read |
| 70 | + * @param offset offset from the root stream where this stream begins |
| 71 | + * |
| 72 | + * @since 0.10 |
| 73 | + */ |
| 74 | + public ByteBufferKaitaiStream(byte[] arr, long offset) { |
| 75 | + super(offset); |
61 | 76 | fc = null; |
62 | 77 | bb = ByteBuffer.wrap(arr); |
63 | 78 | } |
64 | 79 |
|
65 | 80 | /** |
66 | 81 | * Initializes a stream that will get data from given ByteBuffer when read. |
| 82 | + * |
67 | 83 | * @param buffer ByteBuffer to read |
68 | 84 | */ |
69 | 85 | public ByteBufferKaitaiStream(ByteBuffer buffer) { |
| 86 | + this(buffer, 0); |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * Initializes a stream that will get data from given ByteBuffer when read. |
| 91 | + * |
| 92 | + * @param buffer ByteBuffer to read |
| 93 | + * @param offset offset from the root stream where this stream begins |
| 94 | + * |
| 95 | + * @since 0.10 |
| 96 | + */ |
| 97 | + public ByteBufferKaitaiStream(ByteBuffer buffer, long offset) { |
| 98 | + super(offset); |
70 | 99 | fc = null; |
71 | 100 | bb = buffer; |
72 | 101 | } |
|
0 commit comments