| 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 | #ifndef INCLUDE_DATA_SOURCE_H_ |
| 18 | #define INCLUDE_DATA_SOURCE_H_ |
| 19 |
| 20 | #include <jni.h> |
| 21 | #include <sys/types.h> |
| 22 |
| 23 | class DataSource { |
| 24 | public: |
| 25 | virtual ~DataSource() {} |
| 26 | // Returns the number of bytes read, or -1 on failure. It's not an error if |
| 27 | // this returns zero; it just means the given offset is equal to, or |
| 28 | // beyond, the end of the source. |
| 29 | virtual ssize_t readAt(off64_t offset, void* const data, size_t size) = 0; |
| 30 | }; |
| 31 |
| 32 | #endif // INCLUDE_DATA_SOURCE_H_ |
| 33 |