ObbScanner.java revision 02c8730c1bf19daf48bec8c6995df676a00a73b1
1/*
2 * Copyright (C) 2010 The Android Open Source Project
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
17package android.content.res;
18
19/**
20 * Class to scan Opaque Binary Blob (OBB) files.
21 * @hide
22 */
23public class ObbScanner {
24    // Don't allow others to instantiate this class
25    private ObbScanner() {}
26
27    public static ObbInfo getObbInfo(String filePath) {
28        if (filePath == null) {
29            return null;
30        }
31
32        ObbInfo obbInfo = new ObbInfo();
33        if (!getObbInfo_native(filePath, obbInfo)) {
34            throw new IllegalArgumentException("Could not read OBB file: " + filePath);
35        }
36        return obbInfo;
37    }
38
39    private native static boolean getObbInfo_native(String filePath, ObbInfo obbInfo);
40}
41