public int length(RelativeFile path) throws IOException {
        lock.lock();
        try {
            Entry entry = getZipIndexEntry(path);
            if (entry == null)
                throw new FileNotFoundException();

            if (entry.isDir) {
                return 0;
            }

            byte[] header = getHeader(entry);
            // entry is not compressed?
            if (get2ByteLittleEndian(header, 8) == 0) {
                return entry.compressedSize;
            } else {
                return entry.size;
            }
        }
        finally {
            lock.unlock();
        }
    }