Ejemplo n.º 1
0
 /**
  * Initialize a description by pack name and repository.
  *
  * <p>The corresponding index file is assumed to exist. If this is not true implementors must
  * extend the class and override {@link #getFileName(PackExt)}.
  *
  * <p>Callers should also try to fill in other fields if they are reasonably free to access at the
  * time this instance is being initialized.
  *
  * @param name name of the pack file. Must end with ".pack".
  * @param repoDesc description of the repo containing the pack file.
  */
 public DfsPackDescription(DfsRepositoryDescription repoDesc, String name) {
   this.repoDesc = repoDesc;
   int dot = name.lastIndexOf('.');
   this.packName = (dot < 0) ? name : name.substring(0, dot);
   this.sizeMap = new HashMap<PackExt, Long>(PackExt.values().length * 2);
 }
Ejemplo n.º 2
0
 /**
  * @param ext the file extension
  * @return whether the pack file extensions is known to exist.
  */
 public boolean hasFileExt(PackExt ext) {
   return (extensions & ext.getBit()) != 0;
 }
Ejemplo n.º 3
0
 /**
  * @param ext the file extension
  * @return name of the file.
  */
 public String getFileName(PackExt ext) {
   return packName + '.' + ext.getExtension();
 }
Ejemplo n.º 4
0
 /**
  * Adds the pack file extension to the known list.
  *
  * @param ext the file extension
  */
 public void addFileExt(PackExt ext) {
   extensions |= ext.getBit();
 }