/** * @param key * @return the key */ public static RepositoryKey fromBytes(byte[] key) { return new RepositoryKey(parse32(key, 0)); }
/** * @param key * @return the key */ public static RepositoryKey fromBytes(byte[] key) { return new RepositoryKey(parse32(key, 0)); }
/** * @param key * @return the key */ public static RefKey fromString(String key) { int c = key.indexOf(':'); int repo = parse32(Constants.encodeASCII(key.substring(0, c)), 0); String name = key.substring(c + 1); return new RefKey(repo, name); }
/** * @param key * @return the key */ public static RefKey fromString(String key) { int c = key.indexOf(':'); int repo = parse32(Constants.encodeASCII(key.substring(0, c)), 0); String name = key.substring(c + 1); return new RefKey(repo, name); }
/** * @param key * @return the key */ public static RefKey fromBytes(byte[] key) { int repo = parse32(key, 0); String name = decode(key, 9, key.length); return new RefKey(repo, name); }
/** * @param key * @return the key */ public static RepositoryKey fromString(String key) { return new RepositoryKey(parse32(Constants.encodeASCII(key), 0)); }
/** * @param key * @return the key */ public static RepositoryKey fromString(String key) { return new RepositoryKey(parse32(Constants.encodeASCII(key), 0)); }
/** * @param key * @return the key */ public static RefKey fromBytes(byte[] key) { int repo = parse32(key, 0); String name = decode(key, 9, key.length); return new RefKey(repo, name); }
/** * @param key * @return the key */ public static ObjectIndexKey fromBytes(byte[] key) { if (key.length != KEYLEN) throw new IllegalArgumentException(MessageFormat.format( DhtText.get().invalidChunkKey, decode(key))); int repo = parse32(key, 0); ObjectId id = ObjectId.fromString(key, 9); return new ObjectIndexKey(repo, id); }
/** * @param key * @return the key */ public static ObjectIndexKey fromBytes(byte[] key) { if (key.length != KEYLEN) throw new IllegalArgumentException(MessageFormat.format( DhtText.get().invalidChunkKey, decode(key))); int repo = parse32(key, 0); ObjectId id = ObjectId.fromString(key, 9); return new ObjectIndexKey(repo, id); }
/** * @param key * @param ptr * @param len * @return the key */ public static ChunkKey fromBytes(byte[] key, int ptr, int len) { if (len != KEYLEN) throw new IllegalArgumentException(MessageFormat.format( DhtText.get().invalidChunkKey, decode(key, ptr, ptr + len))); int repo = parse32(key, ptr); ObjectId chunk = ObjectId.fromString(key, ptr + 9); return new ChunkKey(repo, chunk); }
/** * @param key * @param ptr * @param len * @return the key */ public static ChunkKey fromBytes(byte[] key, int ptr, int len) { if (len != KEYLEN) throw new IllegalArgumentException(MessageFormat.format( DhtText.get().invalidChunkKey, decode(key, ptr, ptr + len))); int repo = parse32(key, ptr); ObjectId chunk = ObjectId.fromString(key, ptr + 9); return new ChunkKey(repo, chunk); }