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

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

Introduction

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

Prototype

public long getFileSize(PackExt ext) 

Source Link

Document

Get size of the file, in bytes.

Usage

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

License:Apache License

/**
 * Extracts a file size map from the pack description.
 *
 * @param desc//from  w  ww.j a  v a 2s.com
 * @return a map mapping extension strings to file sizes
 */
public static Map<String, Long> getFileSizeMap(DfsPackDescription desc) {
    Map<String, Long> sizeMap = new HashMap<String, Long>();
    for (PackExt ext : PackExt.values()) {
        long sz = desc.getFileSize(ext);
        if (sz > 0) {
            sizeMap.put(ext.getExtension(), sz);
        }
    }
    return sizeMap;
}

From source file:org.chodavarapu.jgitaws.jgit.S3WithDynamoMetaDataObjDatabase.java

License:Eclipse Distribution License

@Override
protected DfsOutputStream writeFile(DfsPackDescription desc, PackExt ext) throws IOException {
    logger.debug("Writing pack file {} to S3 bucket", desc.getFileName(ext));
    return configuration.getPackRepository().savePack(desc.getRepositoryDescription().getRepositoryName(),
            desc.getFileName(ext), desc.getFileSize(ext));
}

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

License:Eclipse Distribution License

private static String toJson(DfsPackDescription desc) {
    JSONObject json = new JSONObject().put("modified", desc.getLastModified())
            .put("objects", desc.getObjectCount()).put("deltas", desc.getDeltaCount())
            .put("ixVersion", desc.getIndexVersion());

    for (PackExt ext : PackExt.values()) {
        if (desc.hasFileExt(ext)) {
            json.put(ext.getExtension() + "Size", desc.getFileSize(ext));
        }// ww w.  j  av a  2 s.c o  m
    }

    if (desc.getPackSource() != null) {
        json.put("source", desc.getPackSource().name());
    }

    return json.toString();
}