code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static int getShifts(final AdjacencyGraph adjacencyGraph, final String part)
{
int current_shift = -1;
int shifts = 0;
char[] parts = part.toCharArray();
for (int i1 = 0; i1 < parts.length; i1++)
{
Character character = parts[i1];
if (i1 + 1 >=... | java |
public static String generatePassphrase(final String delimiter, final int words)
{
return generatePassphrase(delimiter, words, new Dictionary("eff_large", DictionaryUtil.loadUnrankedDictionary(DictionaryUtil.eff_large), false));
} | java |
public static String generatePassphrase(final String delimiter, final int words, final Dictionary dictionary)
{
String result = "";
final SecureRandom rnd = new SecureRandom();
final int high = dictionary.getSortedDictionary().size();
for (int i = 1; i <= words; i++)
{
... | java |
public static String generateRandomPassword(final CharacterTypes characterTypes, final int length)
{
final StringBuffer buffer = new StringBuffer();
String characters = "";
switch (characterTypes)
{
case ALPHA:
characters = "abcdefghijklmnopqrstuvwxyzABC... | java |
private static Match createBruteForceMatch(final String password, final Configuration configuration, final int index)
{
return new BruteForceMatch(password.charAt(index), configuration, index);
} | java |
public static Double getEntropyFromGuesses(final BigDecimal guesses)
{
Double guesses_tmp = guesses.doubleValue();
guesses_tmp = guesses_tmp.isInfinite() ? Double.MAX_VALUE : guesses_tmp;
return Math.log(guesses_tmp) / Math.log(2);
} | java |
public static BigDecimal getGuessesFromEntropy(final Double entropy)
{
final Double guesses_tmp = Math.pow(2, entropy);
return new BigDecimal(guesses_tmp.isInfinite() ? Double.MAX_VALUE : guesses_tmp).setScale(0, RoundingMode.HALF_UP);
} | java |
public static void main(String... args)
{
Configuration configuration = new ConfigurationBuilder().createConfiguration();
Nbvcxz nbvcxz = new Nbvcxz(configuration);
ResourceBundle resourceBundle = ResourceBundle.getBundle("main", nbvcxz.getConfiguration().getLocale());
Scanner scanne... | java |
private List<Match> findBestCombination(final String password, final List<Match> all_matches, final Map<Integer, Match> brute_force_matches) throws TimeoutException
{
if (configuration.getCombinationAlgorithmTimeout() <= 0)
{
throw new TimeoutException("findBestCombination algorithm disa... | java |
private void generateMatches(final long start_time, final String password, final Match match, final Map<Match, List<Match>> non_intersecting_matches, final Map<Integer, Match> brute_force_matches, final List<Match> matches, int matches_length) throws TimeoutException
{
if (System.currentTimeMillis() - start... | java |
private double calcEntropy(final List<Match> matches, final boolean include_brute_force)
{
double entropy = 0;
for (Match match : matches)
{
if (include_brute_force || !(match instanceof BruteForceMatch))
{
entropy += match.calculateEntropy();
... | java |
private List<Match> getAllMatches(final Configuration configuration, final String password)
{
List<Match> matches = new ArrayList<>();
for (PasswordMatcher passwordMatcher : configuration.getPasswordMatchers())
{
matches.addAll(passwordMatcher.match(configuration, password));
... | java |
private boolean isValid()
{
StringBuilder builder = new StringBuilder();
for (Match match : matches)
{
builder.append(match.getToken());
}
return password.equals(builder.toString());
} | java |
public BigDecimal getGuesses()
{
final Double guesses_tmp = Math.pow(2, getEntropy());
return new BigDecimal(guesses_tmp.isInfinite() ? Double.MAX_VALUE : guesses_tmp).setScale(0, RoundingMode.HALF_UP);
} | java |
public boolean isRandom()
{
boolean is_random = true;
for (Match match : matches)
{
if (!(match instanceof BruteForceMatch))
{
is_random = false;
break;
}
}
return is_random;
} | java |
public int getBasicScore()
{
final BigDecimal guesses = getGuesses();
if (guesses.compareTo(BigDecimal.valueOf( 1e3)) == -1)
return 0;
else if (guesses.compareTo(BigDecimal.valueOf( 1e6)) == -1)
return 1;
else if (guesses.compareTo(BigDecimal.valueOf(1e8)) == ... | java |
private static List<String> translateLeet(final Configuration configuration, final String password)
{
final List<String> translations = new ArrayList();
final TreeMap<Integer, Character[]> replacements = new TreeMap<>();
for (int i = 0; i < password.length(); i++)
{
fina... | java |
private static void replaceAtIndex(final TreeMap<Integer, Character[]> replacements, Integer current_index, final char[] password, final List<String> final_passwords)
{
for (final char replacement : replacements.get(current_index))
{
password[current_index] = replacement;
if ... | java |
private static List<Character[]> getLeetSub(final String password, final String unleet_password)
{
List<Character[]> leet_subs = new ArrayList<>();
for (int i = 0; i < unleet_password.length(); i++)
{
if (password.charAt(i) != unleet_password.charAt(i))
{
... | java |
private static ValidDateSplit isDateValid(String day, String month, String year)
{
try
{
int dayInt = Integer.parseInt(day);
int monthInt = Integer.parseInt(month);
int yearInt = Integer.parseInt(year);
if (
dayInt <= 0 || dayInt > ... | java |
public static double fractionOfStringUppercase(String input)
{
if (input == null)
{
return 0;
}
double upperCasableCharacters = 0;
double upperCount = 0;
for (int i = 0; i < input.length(); i++)
{
char c = input.charAt(i);
... | java |
public static BigDecimal getTimeToCrack(final Result result, final String guess_type)
{
BigDecimal guess_per_second = BigDecimal.valueOf(result.getConfiguration().getGuessTypes().get(guess_type));
return result.getGuesses().divide(guess_per_second, 0, BigDecimal.ROUND_FLOOR);
} | java |
public static String getTimeToCrackFormatted(final Result result, final String guess_type)
{
ResourceBundle mainResource = result.getConfiguration().getMainResource();
BigDecimal seconds = getTimeToCrack(result, guess_type);
BigDecimal minutes = new BigDecimal(60);
BigDecimal hours =... | java |
public DictionaryBuilder addWord(final String word, final int rank)
{
this.dictonary.put(word.toLowerCase(), rank);
return this;
} | java |
@SuppressLint("MissingPermission")
@RequiresPermission(anyOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION
})
public Observable<Beacon> observe() {
if (!isBleSupported()) {
return Observable.empty();
}
if (isAtLeastAndroidLollipop()) {
scanStrategy = new LollipopScanStrategy(blue... | java |
public static <I, D> List<Word<I>> findMalerPnueli(Query<I, D> ceQuery) {
return ceQuery.getInput().suffixes(false);
} | java |
public static <I, D> List<Word<I>> findShahbaz(Query<I, D> ceQuery, AccessSequenceTransformer<I> asTransformer) {
Word<I> queryWord = ceQuery.getInput();
int queryLen = queryWord.length();
Word<I> prefix = ceQuery.getPrefix();
int i = prefix.length();
while (i <= queryLen) {
... | java |
@Nullable
static <S, I, O> ReplacementResult<S, I, O> computeParentExtension(final MealyMachine<S, I, ?, O> hypothesis,
final Alphabet<I> inputs,
final AD... | java |
private static CompactDFA<Character> constructSUL() {
// input alphabet contains characters 'a'..'b'
Alphabet<Character> sigma = Alphabets.characters('a', 'b');
// @formatter:off
// create automaton
return AutomatonBuilders.newDFA(sigma)
.withInitial("q0")
... | java |
public static <I> DFACacheOracle<I> createDAGCacheOracle(Alphabet<I> alphabet,
MembershipOracle<I, Boolean> delegate) {
return new DFACacheOracle<>(new IncrementalDFADAGBuilder<>(alphabet), delegate);
} | java |
public static <S, I, O> int computeEffectiveResets(final ADTNode<S, I, O> adt) {
return computeEffectiveResetsInternal(adt, 0);
} | java |
public static <S, I, O> ADTNode<S, I, O> buildADSFromObservation(final Word<I> input,
final Word<O> output,
final S finalState) {
if (input.size() != output.size()) {
... | java |
@Nonnull
public List<S> bfsStates() {
List<S> stateList = new ArrayList<>();
Set<S> visited = new HashSet<>();
int ptr = 0;
stateList.add(root);
visited.add(root);
int numStates = 1;
while (ptr < numStates) {
S curr = stateList.get(ptr++);
... | java |
@Nonnull
public Iterator<S> bfsIterator() {
Set<S> visited = new HashSet<>();
final Deque<S> bfsQueue = new ArrayDeque<>();
bfsQueue.add(root);
visited.add(root);
return new AbstractIterator<S>() {
@Override
protected S computeNext() {
... | java |
protected List<List<Row<I>>> incorporateCounterExample(DefaultQuery<I, D> ce) {
return ObservationTableCEXHandlers.handleClassicLStar(ce, table, oracle);
} | java |
protected boolean completeConsistentTable(List<List<Row<I>>> unclosed, boolean checkConsistency) {
boolean refined = false;
List<List<Row<I>>> unclosedIter = unclosed;
do {
while (!unclosedIter.isEmpty()) {
List<Row<I>> closingRows = selectClosingRows(unclosedIter);
... | java |
protected Word<I> analyzeInconsistency(Inconsistency<I> incons) {
int inputIdx = alphabet.getSymbolIndex(incons.getSymbol());
Row<I> succRow1 = incons.getFirstRow().getSuccessor(inputIdx);
Row<I> succRow2 = incons.getSecondRow().getSuccessor(inputIdx);
int numSuffixes = table.getSuffix... | java |
public static <N extends AbstractDTNode<?, ?, ?, N>> Iterator<N> nodeIterator(N root) {
return new NodeIterator<>(root);
} | java |
@Nullable
@Override
public DefaultQuery<I, D> disprove(A hypothesis, Collection<? extends I> inputs) throws ModelCheckingException {
final DefaultQuery<I, D> result = propertyOracle.disprove(hypothesis, inputs);
if (result != null) {
LOGGER.logEvent("Property violated: '" + toString(... | java |
@Nullable
@Override
public DefaultQuery<I, D> doFindCounterExample(A hypothesis, Collection<? extends I> inputs) throws
ModelCheckingException {
final DefaultQuery<I, D> result = propertyOracle.findCounterExam... | java |
protected RedBlueMerge<SP, TP, BlueFringePTAState<SP, TP>> tryMerge(BlueFringePTA<SP, TP> pta,
BlueFringePTAState<SP, TP> qr,
BlueFringePTAState<SP, TP> qb) {
return pt... | java |
public SampleSetEQOracle<I, D> add(Word<I> input, D expectedOutput) {
testQueries.add(new DefaultQuery<>(input, expectedOutput));
return this;
} | java |
@SafeVarargs
public final SampleSetEQOracle<I, D> addAll(MembershipOracle<I, D> oracle, Word<I>... words) {
return addAll(oracle, Arrays.asList(words));
} | java |
public SampleSetEQOracle<I, D> addAll(MembershipOracle<I, D> oracle, Collection<? extends Word<I>> words) {
if (words.isEmpty()) {
return this;
}
List<DefaultQuery<I, D>> newQueries = new ArrayList<>(words.size());
for (Word<I> w : words) {
newQueries.add(new Defa... | java |
protected static <I, D> void fetchResults(Iterator<DefaultQuery<I, D>> queryIt, List<D> output, int numSuffixes) {
for (int j = 0; j < numSuffixes; j++) {
DefaultQuery<I, D> qry = queryIt.next();
output.add(qry.getOutput());
}
} | java |
private QueryResult<S, O> filterAndProcessQuery(Word<I> query,
Word<O> partialOutput,
Function<Word<I>, QueryResult<S, O>> processQuery) {
final LinkedList<I> filteredQueryList = new LinkedList<>(query.asList... | java |
public static <S, I, D> int findLinear(Query<I, D> ceQuery,
AccessSequenceTransformer<I> asTransformer,
SuffixOutput<I, D> hypOutput,
MembershipOracle<I, D> oracle) {
return AcexLoca... | java |
public static <I, D> int findLinearReverse(Query<I, D> ceQuery,
AccessSequenceTransformer<I> asTransformer,
SuffixOutput<I, D> hypOutput,
MembershipOracle<I, D> oracle) {
... | java |
public static <I, D> int findRivestSchapire(Query<I, D> ceQuery,
AccessSequenceTransformer<I> asTransformer,
SuffixOutput<I, D> hypOutput,
MembershipOracle<I, D> oracle) {
... | java |
private void closeTransition(final ADTTransition<I, O> transition) {
if (!transition.needsSifting()) {
return;
}
final Word<I> accessSequence = transition.getSource().getAccessSequence();
final I symbol = transition.getInput();
this.oracle.reset();
for (fin... | java |
private void ensureConsistency(final ADTNode<ADTState<I, O>, I, O> leaf) {
final ADTState<I, O> state = leaf.getHypothesisState();
final Word<I> as = state.getAccessSequence();
final Word<O> asOut = this.hypothesis.computeOutput(as);
ADTNode<ADTState<I, O>, I, O> iter = leaf;
... | java |
private boolean validateADS(final ADTNode<ADTState<I, O>, I, O> oldADS,
final ADTNode<ADTState<I, O>, I, O> newADS,
final Set<ADTState<I, O>> cutout) {
final Set<ADTNode<ADTState<I, O>, I, O>> oldNodes;
if (ADTUtil.isResetNode(oldADS)) {
... | java |
public void initialize(final Collection<S> states,
final Function<S, Word<I>> asFunction,
final Function<Word<I>, Word<O>> outputFunction) {
final FastMealyState<O> init = this.observationTree.addInitialState();
for (final S s : states) {
... | java |
public void addState(final S newState, final Word<I> accessSequence, final O output) {
final Word<I> prefix = accessSequence.prefix(accessSequence.length() - 1);
final I sym = accessSequence.lastSymbol();
final FastMealyState<O> pred =
this.observationTree.getSuccessor(this.obse... | java |
public Optional<Word<I>> findSeparatingWord(final S s1, final S s2, final Word<I> prefix) {
final FastMealyState<O> n1 = this.nodeToObservationMap.get(s1);
final FastMealyState<O> n2 = this.nodeToObservationMap.get(s2);
final FastMealyState<O> s1Succ = this.observationTree.getSuccessor(n1, pre... | java |
public Word<I> findSeparatingWord(final S s1, final S s2) {
final FastMealyState<O> n1 = this.nodeToObservationMap.get(s1);
final FastMealyState<O> n2 = this.nodeToObservationMap.get(s2);
return NearLinearEquivalenceTest.findSeparatingWord(this.observationTree, n1, n2, this.alphabet, true);
... | java |
protected static <I, D> void link(AbstractBaseDTNode<I, D> dtNode, TTTState<I, D> state) {
assert dtNode.isLeaf();
dtNode.setData(state);
state.dtLeaf = dtNode;
} | java |
protected void initializeState(TTTState<I, D> state) {
for (int i = 0; i < alphabet.size(); i++) {
I sym = alphabet.getSymbol(i);
TTTTransition<I, D> trans = createTransition(state, sym);
trans.setNonTreeTarget(dtree.getRoot());
state.setTransition(i, trans);
... | java |
private void splitState(TTTTransition<I, D> transition, Word<I> tempDiscriminator, D oldOut, D newOut) {
assert !transition.isTree();
notifyPreSplit(transition, tempDiscriminator);
AbstractBaseDTNode<I, D> dtNode = transition.getNonTreeTarget();
assert dtNode.isLeaf();
TTTState... | java |
protected boolean finalizeAny() {
GlobalSplitter<I, D> splitter = findSplitterGlobal();
if (splitter != null) {
finalizeDiscriminator(splitter.blockRoot, splitter.localSplitter);
return true;
}
return false;
} | java |
protected TTTState<I, D> getAnyTarget(TTTTransition<I, D> trans) {
if (trans.isTree()) {
return trans.getTreeTarget();
}
return trans.getNonTreeTarget().anySubtreeState();
} | java |
private TTTState<I, D> getAnyState(Iterable<? extends I> suffix) {
return getAnySuccessor(hypothesis.getInitialState(), suffix);
} | java |
protected D query(Word<I> prefix, Word<I> suffix) {
return oracle.answerQuery(prefix, suffix);
} | java |
protected D query(AccessSequenceProvider<I> accessSeqProvider, Word<I> suffix) {
return query(accessSeqProvider.getAccessSequence(), suffix);
} | java |
public static <E> int linearSearchFwd(AbstractCounterexample<E> acex, int low, int high) {
assert !acex.testEffects(low, high);
E effPrev = acex.effect(low);
for (int i = low + 1; i <= high; i++) {
E eff = acex.effect(i);
if (!acex.checkEffects(effPrev, eff)) {
... | java |
public static <E> int exponentialSearchBwd(AbstractCounterexample<E> acex, int low, int high) {
assert !acex.testEffects(low, high);
int ofs = 1;
E effHigh = acex.effect(high);
int highIter = high;
int lowIter = low;
while (highIter - ofs > lowIter) {
int n... | java |
public E insert(E element) {
E evicted = null;
if (size() >= capacity) {
if (evictPolicy == EvictPolicy.REJECT_NEW) {
// reject the new element
return element;
}
// Evict first, so we do not need to resize
evicted = evict();... | java |
public ADTNode<S, I, O> sift(final SymbolQueryOracle<I, O> oracle,
final Word<I> word,
final ADTNode<S, I, O> subtree) {
ADTNode<S, I, O> current = subtree;
while (!ADTUtil.isLeafNode(current)) {
current = current.sift(oracl... | java |
public ADTNode<S, I, O> extendLeaf(final ADTNode<S, I, O> nodeToSplit,
final Word<I> distinguishingSuffix,
final Word<O> oldOutput,
final Word<O> newOutput) {
if (!ADTUtil.isLeafNode(nodeToSplit... | java |
public LCAInfo<S, I, O> findLCA(final ADTNode<S, I, O> s1, final ADTNode<S, I, O> s2) {
final Map<ADTNode<S, I, O>, ADTNode<S, I, O>> s1ParentsToS1 = new HashMap<>();
ADTNode<S, I, O> s1Iter = s1;
ADTNode<S, I, O> s2Iter = s2;
while (s1Iter.getParent() != null) {
s1Parents... | java |
@Nonnull
public static String getResults() {
StringBuilder sb = new StringBuilder();
for (Entry<String, Counter> e : CUMULATED.entrySet()) {
sb.append(e.getValue().getSummary())
.append(", (")
.append(e.getValue().getCount() / MILLISECONDS_PER_SECOND)
... | java |
public static void logResults() {
for (Entry<String, Counter> e : CUMULATED.entrySet()) {
LOGGER.logProfilingInfo(e.getValue());
}
} | java |
public static <I, O> MealyCacheOracle<I, O> createDAGCache(Alphabet<I> alphabet,
MembershipOracle<I, Word<O>> mqOracle) {
return MealyCacheOracle.createDAGCacheOracle(alphabet, mqOracle);
} | java |
public static <I, O> MealyCacheOracle<I, O> createTreeCache(Alphabet<I> alphabet,
MembershipOracle<I, Word<O>> mqOracle) {
return MealyCacheOracle.createTreeCacheOracle(alphabet, mqOracle);
} | java |
public static <I, O> MealyCacheOracle<I, OutputAndLocalInputs<I, O>> createStateLocalInputTreeCache(Collection<I> initialLocalInputs,
MembershipOracle<I, Word<OutputAndLocalInputs<I, O>>> mqOracle) {
return M... | java |
public DFALearner<I> asDFALearner() {
return new DFALearner<I>() {
@Override
public String toString() {
return NLStarLearner.this.toString();
}
@Override
public void startLearning() {
NLStarLearner.this.startLearning()... | java |
public void insertBlock(AbstractBaseDTNode<I, D> blockRoot) {
blockRoot.removeFromBlockList();
blockRoot.setNextElement(next);
if (getNextElement() != null) {
next.setPrevElement(blockRoot);
}
blockRoot.setPrevElement(this);
next = blockRoot;
} | java |
@Override
@Autowired(required = false)
public void setSamlLogger(SAMLLogger samlLogger) {
Assert.notNull(samlLogger, "SAMLLogger can't be null");
this.samlLogger = samlLogger;
} | java |
@Override
@Autowired(required = false)
@Qualifier("webSSOprofileConsumer")
public void setConsumer(WebSSOProfileConsumer consumer) {
Assert.notNull(consumer, "WebSSO Profile Consumer can't be null");
this.consumer = consumer;
} | java |
@Override
@Autowired(required = false)
@Qualifier("hokWebSSOprofileConsumer")
public void setHokConsumer(WebSSOProfileConsumer hokConsumer) {
this.hokConsumer = hokConsumer;
} | java |
@SneakyThrows
public KeyStore loadKeystore(String certResourceLocation, String privateKeyResourceLocation, String alias, String keyPassword) {
KeyStore keystore = createEmptyKeystore();
X509Certificate cert = loadCert(certResourceLocation);
RSAPrivateKey privateKey = loadPrivateKey(privateKe... | java |
@SneakyThrows
public void addKeyToKeystore(KeyStore keyStore, X509Certificate cert, RSAPrivateKey privateKey, String alias, String password) {
KeyStore.PasswordProtection pass = new KeyStore.PasswordProtection(password.toCharArray());
Certificate[] certificateChain = {cert};
keyStore.setEntr... | java |
@SneakyThrows
public KeyStore createEmptyKeystore() {
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(null, "".toCharArray());
return keyStore;
} | java |
@SneakyThrows
public X509Certificate loadCert(String certLocation) {
CertificateFactory cf = CertificateFactory.getInstance("X509");
Resource certRes = resourceLoader.getResource(certLocation);
X509Certificate cert = (X509Certificate) cf.generateCertificate(certRes.getInputStream());
... | java |
@SneakyThrows
public RSAPrivateKey loadPrivateKey(String privateKeyLocation) {
Resource keyRes = resourceLoader.getResource(privateKeyLocation);
byte[] keyBytes = StreamUtils.copyToByteArray(keyRes.getInputStream());
PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(keyBytes);
... | java |
public static Properties initialize(URI uri, Configuration conf) throws IOException,
ConfigurationParseException {
String host = Utils.getHost(uri);
Properties props = new Properties();
if (!Utils.validSchema(uri)) {
props.setProperty(SWIFT_AUTH_METHOD_PROPERTY, PUBLIC_ACCESS);
} else {
... | java |
public SwiftCachedObject get(final String objName) throws IOException {
LOG.trace("Get from cache: {}", objName);
SwiftCachedObject res = cache.get(objName);
if (res == null) {
LOG.trace("Cache get: {} is not in the cache. Access Swift to get content length", objName);
StoredObject rawObj = cont... | java |
public boolean isTemporaryPath(String path) {
for (String tempPath : tempIdentifiers) {
String[] tempPathComponents = tempPath.split("/");
if (tempPathComponents.length > 0
&& path != null && path.contains(tempPathComponents[0].replace("ID", ""))) {
return true;
}
}
retur... | java |
public Path modifyPathToFinalDestination(Path path) throws IOException {
String res;
if (tempFileOriginator.equals(DEFAULT_FOUTPUTCOMMITTER_V1)) {
res = parseHadoopOutputCommitter(path, true, hostNameScheme);
} else {
res = extractNameFromTempPath(path, true, hostNameScheme);
}
return ne... | java |
private String parseHadoopOutputCommitter(Path fullPath,
boolean addTaskIdCompositeName, String hostNameScheme) throws IOException {
String path = fullPath.toString();
String noPrefix = path;
if (path.startsWith(hostNameScheme)) {
noPrefix = path.substring(hostNameScheme.length());
}
int... | java |
private String extractExtension(String filename) {
int startExtension = filename.indexOf('.');
if (startExtension > 0) {
return filename.substring(startExtension + 1);
}
return "";
} | java |
protected ObjectMetadata getObjectMetadata(String key) {
try {
ObjectMetadata meta = mClient.getObjectMetadata(mBucket, key);
return meta;
} catch (AmazonClientException e) {
LOG.debug(e.getMessage());
return null;
}
} | java |
public PutObjectRequest newPutObjectRequest(String key,
ObjectMetadata metadata, File srcfile) {
PutObjectRequest putObjectRequest = new PutObjectRequest(mBucket, key,
srcfile);
putObjectRequest.setMetadata(metadata);
return putObjectRequest;
} | java |
private void initConnectionSettings(Configuration conf,
ClientConfiguration clientConf) throws IOException {
clientConf.setMaxConnections(Utils.getInt(conf, FS_COS, FS_ALT_KEYS,
MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS));
clientConf.setClientExecutionTimeout(Utils.getInt(conf, FS_COS, FS_A... | java |
private String correctPlusSign(String origin, String stringToCorrect) {
if (origin.contains("+")) {
LOG.debug("Adapt plus sign in {} to avoid SDK bug on {}", origin, stringToCorrect);
StringBuilder tmpStringToCorrect = new StringBuilder(stringToCorrect);
boolean hasSign = true;
int fromIndex... | java |
private void copyFile(String srcKey, String dstKey, long size)
throws IOException, InterruptedIOException, AmazonClientException {
LOG.debug("copyFile {} -> {} ", srcKey, dstKey);
CopyObjectRequest copyObjectRequest =
new CopyObjectRequest(mBucket, srcKey, mBucket, dstKey);
try {
ObjectM... | java |
static BlockFactory createFactory(COSAPIClient owner,
String name) {
switch (name) {
case COSConstants.FAST_UPLOAD_BUFFER_ARRAY:
return new ArrayBlockFactory(owner);
case COSConstants.FAST_UPLOAD_BUFFER_DISK:
return new DiskBlockFactory(owner);
default:
throw new Ille... | java |
private synchronized void reopen(String msg, long targetPos, long length) throws IOException {
if (wrappedStream != null) {
closeStream("reopen(" + msg + ")", contentRangeFinish);
}
contentRangeStart = targetPos;
contentRangeFinish = targetPos + Math.max(readahead, length) + threasholdRead;
if... | java |
private void closeStream(String msg, long length) {
if (wrappedStream != null) {
long remaining = remainingInCurrentRequest();
boolean shouldAbort = remaining > readahead;
if (!shouldAbort) {
try {
wrappedStream.close();
} catch (IOException e) {
LOG.debug("When... | java |
@InterfaceAudience.Private
@InterfaceStability.Unstable
public synchronized long remainingInFile() throws IOException {
return objectCache.get(objName).getContentLength() - pos;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.