예제 #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);
 }
예제 #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;
 }
예제 #3
0
 /**
  * @param ext the file extension
  * @return name of the file.
  */
 public String getFileName(PackExt ext) {
   return packName + '.' + ext.getExtension();
 }
예제 #4
0
 /**
  * Adds the pack file extension to the known list.
  *
  * @param ext the file extension
  */
 public void addFileExt(PackExt ext) {
   extensions |= ext.getBit();
 }