Example usage for org.eclipse.jgit.internal.storage.dfs DfsPackDescription addFileExt

List of usage examples for org.eclipse.jgit.internal.storage.dfs DfsPackDescription addFileExt

Introduction

In this page you can find the example usage for org.eclipse.jgit.internal.storage.dfs DfsPackDescription addFileExt.

Prototype

public void addFileExt(PackExt ext) 

Source Link

Document

Adds the pack file extension to the known list.

Usage

From source file:com.benhumphreys.jgitcassandra.store.DescMapper.java

License:Apache License

/**
 * Calls addFileExt on the pack description for each PackExt indicated by
 * the bit field "bits"//ww w  .  j  a v a 2s  .c  o  m
 *
 * The actual mapping from PackExt to bit position is provided by the
 * PackExt class.
 *
 * @param desc  the pack description to mutate
 * @param bits  the bit field to read from
 */
public static void setExtsFromBits(DfsPackDescription desc, int bits) {
    for (PackExt ext : PackExt.values()) {
        if ((ext.getBit() & bits) != 0) {
            desc.addFileExt(ext);
        }
    }
}

From source file:org.chodavarapu.jgitaws.repositories.PackDescriptionRepository.java

License:Eclipse Distribution License

private static DfsPackDescription fromJson(String json, DfsPackDescription desc) {
    JSONObject object = new JSONObject(json);

    desc.setPackSource(object.optEnum(DfsObjDatabase.PackSource.class, "source"))
            .setLastModified(object.optLong("modified")).setObjectCount(object.optLong("objects"))
            .setDeltaCount(object.optLong("deltas")).setIndexVersion(object.optInt("ixVersion"))
            .clearPackStats();//from  w  w  w .j a v  a2 s .c  o m

    for (PackExt ext : PackExt.values()) {
        if (object.has(ext.getExtension() + "Size")) {
            desc.addFileExt(ext);
            desc.setFileSize(ext, object.getLong(ext.getExtension() + "Size"));
        }
    }

    return desc;
}