private long getAssetSize()

in src/android/AssetFilesystem.java [101:135]


    private long getAssetSize(String assetPath) throws FileNotFoundException {
        if (assetPath.startsWith("/")) {
            assetPath = assetPath.substring(1);
        }
        lazyInitCaches();
        if (lengthCache != null) {
            Long ret = lengthCache.get(assetPath);
            if (ret == null) {
                throw new FileNotFoundException("Asset not found: " + assetPath);
            }
            return ret;
        }
        CordovaResourceApi.OpenForReadResult offr = null;
        try {
            offr = resourceApi.openForRead(nativeUriForFullPath(assetPath));
            long length = offr.length;
            if (length < 0) {
                // available() doesn't always yield the file size, but for assets it does.
                length = offr.inputStream.available();
            }
            return length;
        } catch (IOException e) {
            FileNotFoundException fnfe = new FileNotFoundException("File not found: " + assetPath);
            fnfe.initCause(e);
            throw fnfe;
        } finally {
            if (offr != null) {
                try {
                    offr.inputStream.close();
                } catch (IOException e) {
                    LOG.d(LOG_TAG, e.getLocalizedMessage());
                }
            }
        }
    }