code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
static String getAppVersion(Context context) {
String appVersion = "";
if (context != null) {
try {
final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
appVersion = packageInfo.versionName;
} cat... | java |
static long getFirstInstallTime(Context context) {
long firstTime = 0L;
if (context != null) {
try {
final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
firstTime = packageInfo.firstInstallTime;
... | java |
static boolean isPackageInstalled(Context context) {
boolean isInstalled = false;
if (context != null) {
try {
final PackageManager packageManager = context.getPackageManager();
Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getP... | java |
static long getLastUpdateTime(Context context) {
long lastTime = 0L;
if (context != null) {
try {
final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
lastTime = packageInfo.lastUpdateTime;
} catc... | java |
boolean prefetchGAdsParams(Context context, GAdsParamsFetchEvents callback) {
boolean isPrefetchStarted = false;
if (TextUtils.isEmpty(GAIDString_)) {
isPrefetchStarted = true;
new GAdsPrefetchTask(context, callback).executeTask();
}
return isPrefetchStarted;
... | java |
static String getLocalIPAddress() {
String ipAddress = "";
try {
List<NetworkInterface> netInterfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface netInterface : netInterfaces) {
List<InetAddress> addresses = Collections.list(... | java |
public Dialog shareLink(Branch.ShareLinkBuilder builder) {
builder_ = builder;
context_ = builder.getActivity();
callback_ = builder.getCallback();
channelPropertiesCallback_ = builder.getChannelPropertiesCallback();
shareLinkIntent_ = new Intent(Intent.ACTION_SEND);
shar... | java |
public void cancelShareLinkDialog(boolean animateClose) {
if (shareDlg_ != null && shareDlg_.isShowing()) {
if (animateClose) {
// Cancel the dialog with animation
shareDlg_.cancel();
} else {
// Dismiss the dialog immediately
... | java |
private void invokeSharingClient(final ResolveInfo selectedResolveInfo) {
isShareInProgress_ = true;
final String channelName = selectedResolveInfo.loadLabel(context_.getPackageManager()).toString();
BranchShortLinkBuilder shortLinkBuilder = builder_.getShortLinkBuilder();
short... | java |
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void addLinkToClipBoard(String url, String label) {
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardMana... | java |
void setInstallOrOpenCallback(Branch.BranchReferralInitListener callback) {
synchronized (reqQueueLockObject) {
for (ServerRequest req : queue) {
if (req != null) {
if (req instanceof ServerRequestRegisterInstall) {
((ServerRequestRegisterI... | java |
void setStrongMatchWaitLock() {
synchronized (reqQueueLockObject) {
for (ServerRequest req : queue) {
if (req != null) {
if (req instanceof ServerRequestInitSession) {
req.addProcessWaitLock(ServerRequest.PROCESS_WAIT_LOCK.STRONG_MATCH_PEND... | java |
public String getFailReason() {
String causeMsg = "";
try {
JSONObject postObj = getObject();
if (postObj != null
&& postObj.has("error")
&& postObj.getJSONObject("error").has("message")) {
causeMsg = postObj.getJSONObject("... | java |
static JSONObject addSource(JSONObject params) {
if (params == null) {
params = new JSONObject();
}
try {
params.put("source", "android");
} catch (JSONException e) {
e.printStackTrace();
}
return params;
} | java |
public JSONObject getLinkDataJsonObject() {
JSONObject linkDataJson = new JSONObject();
try {
if (!TextUtils.isEmpty(channel)) {
linkDataJson.put("~" + Defines.LinkParam.Channel.getKey(), channel);
}
if (!TextUtils.isEmpty(alias)) {
lin... | java |
public BranchEvent setAdType(AdType adType) {
return addStandardProperty(Defines.Jsonkey.AdType.getKey(), adType.getName());
} | java |
public BranchEvent setTransactionID(String transactionID) {
return addStandardProperty(Defines.Jsonkey.TransactionID.getKey(), transactionID);
} | java |
public BranchEvent setCurrency(CurrencyType currency) {
return addStandardProperty(Defines.Jsonkey.Currency.getKey(), currency.toString());
} | java |
public BranchEvent setCoupon(String coupon) {
return addStandardProperty(Defines.Jsonkey.Coupon.getKey(), coupon);
} | java |
public BranchEvent setAffiliation(String affiliation) {
return addStandardProperty(Defines.Jsonkey.Affiliation.getKey(), affiliation);
} | java |
public BranchEvent setDescription(String description) {
return addStandardProperty(Defines.Jsonkey.Description.getKey(), description);
} | java |
public BranchEvent setSearchQuery(String searchQuery) {
return addStandardProperty(Defines.Jsonkey.SearchQuery.getKey(), searchQuery);
} | java |
public BranchEvent addCustomDataProperty(String propertyName, String propertyValue) {
try {
this.customProperties.put(propertyName, propertyValue);
} catch (JSONException e) {
e.printStackTrace();
}
return this;
} | java |
public boolean logEvent(Context context) {
boolean isReqQueued = false;
String reqPath = isStandardEvent ? Defines.RequestPath.TrackStandardEvent.getPath() : Defines.RequestPath.TrackCustomEvent.getPath();
if (Branch.getInstance() != null) {
Branch.getInstance().handleNewRequest(new ... | java |
public boolean setBranchKey(String key) {
Branch_Key = key;
String currentBranchKey = getString(KEY_BRANCH_KEY);
if (key == null || currentBranchKey == null || !currentBranchKey.equals(key)) {
clearPrefOnBranchKeyChange();
setString(KEY_BRANCH_KEY, key);
retur... | java |
private ArrayList<String> getBuckets() {
String bucketList = getString(KEY_BUCKETS);
if (bucketList.equals(NO_STRING_VALUE)) {
return new ArrayList<>();
} else {
return deserializeString(bucketList);
}
} | java |
private ArrayList<String> getActions() {
String actionList = getString(KEY_ACTIONS);
if (actionList.equals(NO_STRING_VALUE)) {
return new ArrayList<>();
} else {
return deserializeString(actionList);
}
} | java |
private String serializeArrayList(ArrayList<String> strings) {
String retString = "";
for (String value : strings) {
retString = retString + value + ",";
}
retString = retString.substring(0, retString.length() - 1);
return retString;
} | java |
public void onUrlAvailable(String url) {
if (callback_ != null) {
callback_.onLinkCreate(url, null);
}
updateShareEventToFabric(url);
} | java |
public JSONObject convertToJson() {
JSONObject buoJsonModel = new JSONObject();
try {
// Add all keys in plane format initially. All known keys will be replaced with corresponding data type in the following section
JSONObject metadataJsonObject = metadata_.convertToJson();
... | java |
static void shutDown() {
ServerRequestQueue.shutDown();
PrefHelper.shutDown();
BranchUtil.shutDown();
DeviceInfo.shutDown();
// BranchStrongMatchHelper.shutDown();
// BranchViewHandler.shutDown();
// DeepLinkRoutingValidator.shutDown();
// InstallListener... | java |
String getSessionReferredLink() {
String link = prefHelper_.getExternalIntentUri();
return (link.equals(PrefHelper.NO_STRING_VALUE) ? null : link);
} | java |
private JSONObject appendDebugParams(JSONObject originalParams) {
try {
if (originalParams != null && deeplinkDebugParams_ != null) {
if (deeplinkDebugParams_.length() > 0) {
PrefHelper.Debug("You're currently in deep link debug mode. Please comment out 'setDeepLi... | java |
private void registerAppInit(BranchReferralInitListener
callback, ServerRequest.PROCESS_WAIT_LOCK lock) {
ServerRequest request = getInstallOrOpenRequest(callback);
request.addProcessWaitLock(lock);
if (isGAParamsFetchInProgress_) {
request.ad... | java |
protected void addGetParam(String paramKey, String paramValue) {
try {
params_.put(paramKey, paramValue);
} catch (JSONException ignore) {
}
} | java |
private void updateGAdsParams() {
BRANCH_API_VERSION version = getBranchRemoteAPIVersion();
int LATVal = DeviceInfo.getInstance().getSystemObserver().getLATVal();
String gaid = DeviceInfo.getInstance().getSystemObserver().getGAID();
if (!TextUtils.isEmpty(gaid)) {
try {
... | java |
private long[] getUsersListMembers(String[] tUserlists) {
logger.debug("Fetching user id of given lists");
List<Long> listUserIdToFollow = new ArrayList<Long>();
Configuration cb = buildTwitterConfiguration();
Twitter twitterImpl = new TwitterFactory(cb).getInstance();
//For eac... | java |
private Configuration buildTwitterConfiguration() {
logger.debug("creating twitter configuration");
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey(oauthConsumerKey)
.setOAuthConsumerSecret(oauthConsumerSecret)
.setOAuthAccessToken(oa... | java |
private void startTwitterStream() {
logger.info("starting {} twitter stream", streamType);
if (stream == null) {
logger.debug("creating twitter stream");
stream = new TwitterStreamFactory(buildTwitterConfiguration()).getInstance();
if (streamType.equals("user")) {
... | java |
@Override
public void insertArchive(JarScriptArchive jarScriptArchive) throws IOException {
Objects.requireNonNull(jarScriptArchive, "jarScriptArchive");
ScriptModuleSpec moduleSpec = jarScriptArchive.getModuleSpec();
ModuleId moduleId = moduleSpec.getModuleId();
Path jarFilePath;
... | java |
@Override
public void deleteArchive(ModuleId moduleId) throws IOException {
Objects.requireNonNull(moduleId, "moduleId");
cassandra.deleteRow(moduleId.toString());
} | java |
protected Iterable<Row<String, String>> getRows(EnumSet<?> columns) throws Exception {
int shardCount = config.getShardCount();
List<Future<Rows<String, String>>> futures = new ArrayList<Future<Rows<String, String>>>();
for (int i = 0; i < shardCount; i++) {
futures.add(cassandra.se... | java |
public static ScriptCompilerPluginSpec getCompilerSpec() {
Path groovyRuntimePath = ClassPathUtils.findRootPathForResource("META-INF/groovy-release-info.properties",
Groovy2PluginUtils.class.getClassLoader());
if (groovyRuntimePath == null) {
throw new IllegalStateException("... | java |
protected Path getModuleJarPath(ModuleId moduleId) {
Path moduleJarPath = rootDir.resolve(moduleId + ".jar");
return moduleJarPath;
} | java |
protected ModuleSpec createModuleSpec(ScriptArchive archive,
ModuleIdentifier moduleId,
Map<ModuleId, ModuleIdentifier> moduleIdMap,
Path moduleCompilationRoot) throws ModuleLoadException {
ScriptModuleSpec archiveSpec = archive.getModuleSpec();
// create the jboss mo... | java |
protected void compileModule(Module module, Path moduleCompilationRoot) throws ScriptCompilationException, IOException {
// compile the script archive for the module, and inject the resultant classes into
// the ModuleClassLoader
ModuleClassLoader moduleClassLoader = module.getClassLoader();
... | java |
public synchronized void addCompilerPlugin(ScriptCompilerPluginSpec pluginSpec) throws ModuleLoadException {
Objects.requireNonNull(pluginSpec, "pluginSpec");
ModuleIdentifier pluginModuleId = JBossModuleUtils.getPluginModuleId(pluginSpec);
ModuleSpec.Builder moduleSpecBuilder = ModuleSpec.buil... | java |
public synchronized void removeScriptModule(ModuleId scriptModuleId) {
jbossModuleLoader.unloadAllModuleRevision(scriptModuleId.toString());
ScriptModule oldScriptModule = loadedScriptModules.remove(scriptModuleId);
if (oldScriptModule != null) {
notifyModuleUpdate(null, oldScriptMod... | java |
public void addListeners(Set<ScriptModuleListener> listeners) {
Objects.requireNonNull(listeners);
this.listeners.addAll(listeners);
} | java |
protected List<ScriptArchiveCompiler> findCompilers(ScriptArchive archive) {
List<ScriptArchiveCompiler> candidateCompilers = new ArrayList<ScriptArchiveCompiler>();
for (ScriptArchiveCompiler compiler : compilers) {
if (compiler.shouldCompile(archive)) {
candidateCompilers.a... | java |
public static Path createModulePath(ModuleIdentifier moduleIdentifier){
return Paths.get(moduleIdentifier.getName() + "-" + moduleIdentifier.getSlot());
} | java |
public static Set<Class<?>> findAssignableClasses(ScriptModule module, Class<?> targetClass) {
Set<Class<?>> result = new LinkedHashSet<Class<?>>();
for (Class<?> candidateClass : module.getLoadedClasses()) {
if (targetClass.isAssignableFrom(candidateClass)) {
result.add(cand... | java |
@Nullable
public static Class<?> findAssignableClass(ScriptModule module, Class<?> targetClass) {
for (Class<?> candidateClass : module.getLoadedClasses()) {
if (targetClass.isAssignableFrom(candidateClass)) {
return candidateClass;
}
}
return null;
... | java |
@Nullable
public static Class<?> findClass(ScriptModule module, String className) {
Set<Class<?>> classes = module.getLoadedClasses();
Class<?> targetClass = null;
for (Class<?> clazz : classes) {
if (clazz.getName().equals(className)) {
targetClass = clazz;
... | java |
public List<V> executeModules(List<String> moduleIds, ScriptModuleExecutable<V> executable, ScriptModuleLoader moduleLoader) {
Objects.requireNonNull(moduleIds, "moduleIds");
Objects.requireNonNull(executable, "executable");
Objects.requireNonNull(moduleLoader, "moduleLoader");
List<Scr... | java |
public List<V> executeModules(List<ScriptModule> modules, ScriptModuleExecutable<V> executable) {
Objects.requireNonNull(modules, "modules");
Objects.requireNonNull(executable, "executable");
List<Future<V>> futureResults = new ArrayList<Future<V>>(modules.size());
for (ScriptModule mod... | java |
@Nullable
public ExecutionStatistics getModuleStatistics(ModuleId moduleId) {
ExecutionStatistics moduleStats = statistics.get(moduleId);
return moduleStats;
} | java |
protected ExecutionStatistics getOrCreateModuleStatistics(ModuleId moduleId) {
ExecutionStatistics moduleStats = statistics.get(moduleId);
if (moduleStats == null) {
moduleStats = new ExecutionStatistics();
ExecutionStatistics existing = statistics.put(moduleId, moduleStats);
... | java |
@GET
@Path("/repositorysummaries")
public List<RepositorySummary> getRepositorySummaries() {
List<RepositorySummary> result = new ArrayList<RepositorySummary>(repositories.size());
for (String repositoryId : repositories.keySet()) {
RepositorySummary repositorySummary = getScriptRepo... | java |
@GET
@Path("/archivesummaries")
public Map<String, List<ArchiveSummary>> getArchiveSummaries(@QueryParam("repositoryIds") Set<String> repositoryIds) {
if (CollectionUtils.isEmpty(repositoryIds)) {
repositoryIds = repositories.keySet();
}
Map<String, List<ArchiveSummary>> resu... | java |
public static <V> void swapVertices(DirectedGraph<V, DefaultEdge> graph, Map<V, Set<V>> alternates) {
Objects.requireNonNull(graph,"graph");
Objects.requireNonNull(alternates, "alternates");
// add all of the new vertices to prep for linking
addAllVertices(graph, alternates.keySet());
... | java |
public static <V> void addAllVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) {
// add all of the new vertices to prep for linking
for (V vertex : vertices) {
graph.addVertex(vertex);
}
} | java |
public static <V> Set<V> getIncomingVertices(DirectedGraph<V, DefaultEdge> graph, V target) {
Set<DefaultEdge> edges = graph.incomingEdgesOf(target);
Set<V> sources = new LinkedHashSet<V>();
for (DefaultEdge edge : edges) {
sources.add(graph.getEdgeSource(edge));
}
re... | java |
public static <V> Set<V> getOutgoingVertices(DirectedGraph<V, DefaultEdge> graph, V source) {
Set<DefaultEdge> edges = graph.outgoingEdgesOf(source);
Set<V> targets = new LinkedHashSet<V>();
for (DefaultEdge edge : edges) {
targets.add(graph.getEdgeTarget(edge));
}
re... | java |
public static <V> void copyGraph(DirectedGraph<V, DefaultEdge> sourceGraph, DirectedGraph<V, DefaultEdge> targetGraph) {
addAllVertices(targetGraph, sourceGraph.vertexSet());
for (DefaultEdge edge : sourceGraph.edgeSet()) {
targetGraph.addEdge(sourceGraph.getEdgeSource(edge), sourceGraph.get... | java |
public static <V> Set<V> getLeafVertices(DirectedGraph<V, DefaultEdge> graph) {
Set<V> vertexSet = graph.vertexSet();
Set<V> leaves = new HashSet<V>(vertexSet.size()*2);
for (V vertex : vertexSet) {
if (graph.outgoingEdgesOf(vertex).isEmpty()) {
leaves.add(vertex);
... | java |
public static <V> void removeVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) {
for (V vertex : vertices) {
if (graph.containsVertex(vertex)) {
graph.removeVertex(vertex);
}
}
} | java |
@Nullable
public static Path findRootPathForResource(String resourceName, ClassLoader classLoader) {
Objects.requireNonNull(resourceName, "resourceName");
Objects.requireNonNull(classLoader, "classLoader");
URL resource = classLoader.getResource(resourceName);
if (resource != null)... | java |
@Nullable
public static Path findRootPathForClass(Class<?> clazz) {
Objects.requireNonNull(clazz, "resourceName");
String resourceName = classToResourceName(clazz);
return findRootPathForResource(resourceName, clazz.getClassLoader());
} | java |
public static Path getJarPathFromUrl(URL jarUrl) {
try {
String pathString = jarUrl.getPath();
// for Jar URL, the path is in the form of: file:/path/to/groovy/myJar.jar!/path/to/resource/myResource.txt
int endIndex = pathString.lastIndexOf("!");
return Paths.get(... | java |
public static Set<String> scanClassPath(final String classPath, final Set<String> excludeJarSet) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath, excludeJarSet, pathSet);
return pathS... | java |
public static Set<String> scanClassPath(final String classPath, final Set<String> excludeJarSet, final Set<String> excludePrefixes, final Set<String> includePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.process... | java |
public static Set<String> scanClassPathWithExcludes(final String classPath, final Set<String> excludeJarSet, final Set<String> excludePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath... | java |
public static Set<String> scanClassPathWithIncludes(final String classPath, final Set<String> excludeJarSet, final Set<String> includePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath... | java |
public void addClasses(Set<Class<?>> classes) {
for (Class<?> classToAdd: classes) {
localClassCache.put(classToAdd.getName(), classToAdd);
}
} | java |
public Class<?> addClassBytes(String name, byte[] classBytes) {
Class<?> newClass = defineClass(name, classBytes, 0, classBytes.length);
resolveClass(newClass);
localClassCache.put(newClass.getName(), newClass);
return newClass;
} | java |
public boolean addRepository(final ArchiveRepository archiveRepository, final int pollInterval, TimeUnit timeUnit, boolean waitForInitialPoll) {
if (pollInterval <= 0) {
throw new IllegalArgumentException("invalid pollInterval " + pollInterval);
}
Objects.requireNonNull(timeUnit, "ti... | java |
public static Path getGroovyRuntime() {
Path path = ClassPathUtils.findRootPathForResource("META-INF/groovy-release-info.properties", ExampleResourceLocator.class.getClassLoader());
if (path == null) {
throw new IllegalStateException("couldn't find groovy-all.n.n.n.jar in the classpath.");
... | java |
public static Path getGroovyPluginLocation() {
String resourceName = ClassPathUtils.classNameToResourceName(GROOVY2_COMPILER_PLUGIN_CLASS);
Path path = ClassPathUtils.findRootPathForResource(resourceName, ExampleResourceLocator.class.getClassLoader());
if (path == null) {
throw new I... | java |
public static void populateModuleSpecWithCoreDependencies(ModuleSpec.Builder moduleSpecBuilder, ScriptArchive scriptArchive) throws ModuleLoadException {
Objects.requireNonNull(moduleSpecBuilder, "moduleSpecBuilder");
Objects.requireNonNull(scriptArchive, "scriptArchive");
Set<String> compilerP... | java |
public static ModuleIdentifier createRevisionId(ModuleId scriptModuleId, long revisionNumber) {
Objects.requireNonNull(scriptModuleId, "scriptModuleId");
return ModuleIdentifier.create(scriptModuleId.toString(), Long.toString(revisionNumber));
} | java |
private static PathFilter buildFilters(Set<String> filterPaths, boolean failedMatchValue) {
if (filterPaths == null)
return PathFilters.acceptAll();
else if (filterPaths.isEmpty()) {
return PathFilters.rejectAll();
} else {
MultiplePathFilterBuilder builder = ... | java |
public void unloadAllModuleRevision(String scriptModuleId) {
for (ModuleIdentifier revisionId : getAllRevisionIds(scriptModuleId)) {
if (revisionId.getName().equals(scriptModuleId)) {
unloadModule(revisionId);
}
}
} | java |
public void unloadModule(ModuleIdentifier revisionId) {
Objects.requireNonNull(revisionId, "revisionId");
Module module = findLoadedModule(revisionId);
if (module != null) {
unloadModule(module);
}
} | java |
public Set<ModuleIdentifier> getAllRevisionIds(String scriptModuleId) {
Objects.requireNonNull(scriptModuleId, "scriptModuleId");
Set<ModuleIdentifier> revisionIds = new LinkedHashSet<ModuleIdentifier>();
for (ModuleIdentifier revisionId : moduleSpecs.keySet()) {
if (revisionId.getNa... | java |
public DirectedGraph<ModuleId, DefaultEdge> getModuleNameGraph() {
SimpleDirectedGraph<ModuleId, DefaultEdge> graph = new SimpleDirectedGraph<ModuleId, DefaultEdge>(DefaultEdge.class);
Map<ModuleId, ModuleIdentifier> moduleIdentifiers = getLatestRevisionIds();
GraphUtils.addAllVertices(graph, mo... | java |
public static Set<ModuleId> getDependencyScriptModuleIds(ModuleSpec moduleSpec) {
Objects.requireNonNull(moduleSpec, "moduleSpec");
if (!(moduleSpec instanceof ConcreteModuleSpec)) {
throw new IllegalArgumentException("Unsupported ModuleSpec implementation: " + moduleSpec.getClass().getName(... | java |
private static char[] encode(final byte[] data, final char[] toDigits) {
final int l = data.length;
final char[] out = new char[l << 1];
// two characters form the hex value.
for (int i = 0, j = 0; i < l; i++) {
out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
out[j++... | java |
public void trackers(List<String> value) {
string_vector v = new string_vector();
for (String s : value) {
v.push_back(s);
}
p.set_trackers(v);
} | java |
public static AddTorrentParams parseMagnetUri(String uri) {
error_code ec = new error_code();
add_torrent_params params = add_torrent_params.parse_magnet_uri(uri, ec);
if (ec.value() != 0) {
throw new IllegalArgumentException("Invalid magnet uri: " + ec.message());
}
... | java |
public void stop() {
if (session == null) {
return;
}
sync.lock();
try {
if (session == null) {
return;
}
onBeforeStop();
session s = session;
session = null; // stop alerts loop and session metho... | java |
public void restart() {
sync.lock();
try {
stop();
Thread.sleep(1000); // allow some time to release native resources
start();
} catch (InterruptedException e) {
// ignore
} finally {
sync.unlock();
}
} | java |
public void download(String magnetUri, File saveDir) {
if (session == null) {
return;
}
error_code ec = new error_code();
add_torrent_params p = add_torrent_params.parse_magnet_uri(magnetUri, ec);
if (ec.value() != 0) {
throw new IllegalArgumentException... | java |
public ArrayList<TcpEndpoint> peers() {
tcp_endpoint_vector v = alert.peers();
int size = (int) v.size();
ArrayList<TcpEndpoint> peers = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
tcp_endpoint endp = v.get(i);
String ip = new Address(endp.address()).... | java |
public ArrayList<Pair<String, String>> extraHeaders() {
string_string_pair_vector v = e.getExtra_headers();
int size = (int) v.size();
ArrayList<Pair<String, String>> l = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
string_string_pair p = v.get(i);
l.a... | java |
private void tick(long tickIntervalMs) {
for (int i = 0; i < NUM_AVERAGES; ++i) {
stat[i].tick(tickIntervalMs);
}
} | java |
public List<TorrentHandle> torrents() {
torrent_handle_vector v = s.get_torrents();
int size = (int) v.size();
ArrayList<TorrentHandle> l = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
l.add(new TorrentHandle(v.get(i)));
}
return l;
} | java |
public void dhtPutItem(byte[] publicKey, byte[] privateKey, Entry entry, byte[] salt) {
s.dht_put_item(Vectors.bytes2byte_vector(publicKey),
Vectors.bytes2byte_vector(privateKey),
entry.swig(),
Vectors.bytes2byte_vector(salt));
} | java |
public String filePath(int index, String savePath) {
// not calling the corresponding swig function because internally,
// the use of the function GetStringUTFChars does not consider the case of
// a copy not made
return savePath + File.separator + fs.file_path(index);
} | java |
public ArrayList<DhtRoutingBucket> routingTable() {
dht_routing_bucket_vector v = alert.getRouting_table();
int size = (int) v.size();
ArrayList<DhtRoutingBucket> l = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
l.add(new DhtRoutingBucket(v.get(i)));
}
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.