{"added": "2026-12-05", "author": "thelinmichael/spotify-web-api-java", "created": "2019", "id": "5822a8070aeccfea7efa241d", "license": "MIT", "source": "code_search_net", "text": "Get a playlist's tracks.\n\n@return A playlist's tracks.\n@throws IOException In case of networking issues.\n@throws SpotifyWebApiException The Web API returned an error further specified in this exception's root cause.\n\n@SuppressWarnings(\"unchecked\")\n public Paging execute() throws\n IOException,\n SpotifyWebApiException {\n return new PlaylistTrack.JsonUtil().createModelObjectPaging(getJson());\n }", "token_count": 85} {"added": "2026-12-05", "author": "codahale/shamir", "created": "2019", "id": "f8eacfc65739989fc8bb5845", "license": "Apache-2.0", "source": "code_search_net", "text": "Splits the given secret into {@code n} parts, of which any {@code k} or more can be combined to\nrecover the original secret.\n\n@param secret the secret to split\n@return a map of {@code n} part IDs and their values\n\npublic Map split(byte[] secret) {\n // generate part values\n final byte[][] values = new byte[n][secret.length];\n for (int i = 0; i < secret.length; i++) {\n // for each byte, generate a random polynomial, p\n final byte[] p = GF256.generate(random, k - 1, secret[i]);\n for (int x = 1; x <= n; x++) {\n // each part's byte is p(partId)\n values[x - 1][i] = GF256.eval(p, (byte) x);\n }\n }\n\n // return as a set of objects\n final Map parts = new HashMap<>(n());\n for (int i = 0; i < values.length; i++) {\n parts.put(i + 1, values[i]);\n }\n return Collections.unmodifiableMap(parts);\n }", "token_count": 246} {"added": "2026-12-05", "author": "apiman/apiman", "created": "2019", "id": "524e76a59c0435c79168fc1b", "license": "Apache-2.0", "source": "code_search_net", "text": "Discover the location of the apiman.properties (for example) file by checking\nin various likely locations.\n\nprivate static URL discoverConfigFileUrl(String configFileName, String customConfigPropertyName) {\n URL rval;\n\n // User Defined\n ///////////////////////////////////\n String userConfig = System.getProperty(customConfigPropertyName);\n if (userConfig != null) {\n // Treat it as a URL\n try {\n rval = new URL(userConfig);\n return rval;\n } catch (Exception t) {\n }\n // Treat it as a file\n try {\n File f = new File(userConfig);\n if (f.isFile()) {\n rval = f.toURI().toURL();\n return rval;\n }\n } catch (Exception t) {\n }\n throw new RuntimeException(\"Apiman configuration provided at [\" + userConfig + \"] but could not be loaded.\"); //$NON-NLS-1$ //$NON-NLS-2$\n }\n \n // Wildfly/EAP\n ///////////////////////////////////\n String jbossConfigDir = System.getProperty(\"jboss.server.config.dir\"); //$NON-NLS-1$\n String jbossConfigUrl = System.getProperty(\"jboss.server.config.url\"); //$NON-NLS-1$\n if (jbossConfigDir != null) {\n File dirFile = new File(jbossConfigDir);\n rval = findConfigUrlInDirectory(dirFile, configFileName);\n if (rval != null) {\n return rval;\n }\n }\n if (jbossConfigUrl != null) {\n File dirFile = new File(jbossConfigUrl);\n rval = findConfigUrlInDirectory(dirFile, configFileName);\n if (rval != null) {\n return rval;\n }\n }\n\n // Apache Tomcat\n ///////////////////////\n String tomcatHomeDir = System.getProperty(\"catalina.home\"); //$NON-NLS-1$\n if (tomcatHomeDir != null) {\n File dirFile = new File(tomcatHomeDir, \"conf\"); //$NON-NLS-1$\n rval = findConfigUrlInDirectory(dirFile, configFileName);\n if (rval != null) {\n return rval;\n }\n }\n\n // If not found, use an empty file.\n ////////////////////////////////////////\n return ConfigFileConfiguration.class.getResource(\"empty.properties\"); //$NON-NLS-1$\n }", "token_count": 484} {"added": "2026-12-05", "author": "yan74/afplib", "created": "2019", "id": "b1bfcc1ca96c1227d1f4c12d", "license": "Apache-2.0", "source": "code_search_net", "text": "\n\n@generated\n\n@Override\n\tpublic boolean eIsSet(int featureID) {\n\t\tswitch (featureID) {\n\t\t\tcase AfplibPackage.MGO__RG:\n\t\t\t\treturn rg != null && !rg.isEmpty();\n\t\t}\n\t\treturn super.eIsSet(featureID);\n\t}", "token_count": 66} {"added": "2026-12-05", "author": "Gagravarr/VorbisJava", "created": "2019", "id": "3de1b45390a1c4671f827a1b", "license": "Apache-2.0", "source": "code_search_net", "text": "Returns the contents, including the sync header\n\n@Override\n public byte[] getData() {\n byte[] data = new byte[frameData.length+2];\n\n int first2 = (FRAME_SYNC<<2);\n if (blockSizeVariable) first2++;\n\n IOUtils.putInt2BE(data, 0, first2);\n System.arraycopy(frameData, 0, data, 2, frameData.length);\n\n return data;\n }", "token_count": 90} {"added": "2026-12-05", "author": "apache/incubator-heron", "created": "2019", "id": "ed327fc66bb05e80a41dc314", "license": "Apache-2.0", "source": "code_search_net", "text": "Construct all required command line options\n\nprivate static Options constructOptions() {\n Options options = new Options();\n\n Option topName = Option.builder(\"t\")\n .desc(\"Name of the topology\")\n .longOpt(\"topologyname\")\n .hasArgs()\n .argName(\"topologyname\")\n .required()\n .build();\n\n Option topId = Option.builder(\"i\")\n .desc(\"Id of the topology\")\n .longOpt(\"topologyid\")\n .hasArgs()\n .argName(\"topologyid\")\n .required()\n .build();\n\n Option ckptMgrId = Option.builder(\"c\")\n .desc(\"Id of the checkpoint manager\")\n .longOpt(\"ckptmgrid\")\n .hasArgs()\n .argName(\"ckptmgrid\")\n .required()\n .build();\n\n Option ckptMgrPort = Option.builder(\"p\")\n .desc(\"Port of the checkpoint manager\")\n .longOpt(\"ckptmgrport\")\n .hasArgs()\n .argName(\"ckptmgrport\")\n .required()\n .build();\n\n Option ckptMgrConfig = Option.builder(\"f\")\n .desc(\"Config name of the checkpoint manager\")\n .longOpt(\"ckptmgrconfig\")\n .hasArgs()\n .argName(\"ckptmgrconfig\")\n .required()\n .build();\n\n Option ckptMgrOverridenConfig = Option.builder(\"o\")\n .desc(\"Config name of the checkpoint manager\")\n .longOpt(\"ckptMgrOverridenConfig\")\n .hasArgs()\n .argName(\"ckptMgrOverridenConfig\")\n .build();\n\n Option heronInternalConfig = Option.builder(\"g\")\n .desc(\"Heron internal config filename\")\n .longOpt(\"heroninternalconfig\")\n .hasArgs()\n .argName(\"heroninternalconfig\")\n .required()\n .build();\n\n options.addOption(topName);\n options.addOption(topId);\n options.addOption(ckptMgrId);\n options.addOption(ckptMgrPort);\n options.addOption(ckptMgrConfig);\n options.addOption(ckptMgrOverridenConfig);\n options.addOption(heronInternalConfig);\n\n return options;\n }", "token_count": 464} {"added": "2026-12-05", "author": "fcrepo4/fcrepo4", "created": "2019", "id": "0beb74ab084ebc53c8f61671", "license": "Apache-2.0", "source": "code_search_net", "text": "/*\n(non-Javadoc)\n@see org.fcrepo.kernel.api.models.FedoraBinary#getProxyURL()\n\n@Override\n public String getProxyURL() {\n try {\n if (hasProperty(PROXY_FOR)) {\n return getProperty(PROXY_FOR).getString();\n }\n return null;\n } catch (final RepositoryException e) {\n throw new RepositoryRuntimeException(e);\n }\n }", "token_count": 80} {"added": "2026-12-05", "author": "rometools/rome", "created": "2019", "id": "7b8467ebc6929597b3927532", "license": "Apache-2.0", "source": "code_search_net", "text": "Returns the value of an attribute on the outline or null.\n\n@param name name of the attribute.\n\npublic String getAttributeValue(final String name) {\n final List attributes = Collections.synchronizedList(getAttributes());\n for (int i = 0; i < attributes.size(); i++) {\n final Attribute a = attributes.get(i);\n\n if (a.getName() != null && a.getName().equals(name)) {\n return a.getValue();\n }\n }\n return null;\n }", "token_count": 100} {"added": "2026-12-05", "author": "cfmobile/arca-android", "created": "2019", "id": "a4d6730238eafe013f8e4d3a", "license": "BSD-3-Clause", "source": "code_search_net", "text": "================================================\n\npublic static List getList(final ContentValues[] values, final Class klass) {\n final List objects = new ArrayList();\n for (int i = 0; i < values.length; i++) {\n final T object = getObject(values[i], klass);\n if (object != null) {\n objects.add(object);\n }\n }\n return objects;\n }", "token_count": 85} {"added": "2026-12-05", "author": "linkedin/linkedin-utils", "created": "2019", "id": "a4926b067a28ae123f5719a9", "license": "Apache-2.0", "source": "code_search_net", "text": "Converts the object into a timespan. If already a timespan then simply return the object.\nOtherwise call {@link Timespan#parse(String)} on t.toString(). Works well for\nlong and String\n\n@return a timespan (null if t is null)\n\npublic static Timespan toTimespan(Object t)\n {\n if(t == null)\n return null;\n\n if(t instanceof Timespan)\n {\n return (Timespan) t;\n }\n\n return Timespan.parse(t.toString());\n }", "token_count": 122} {"added": "2026-12-05", "author": "EMCECS/nfs-client-java", "created": "2019", "id": "048be50e4204bebd54f450c0", "license": "Apache-2.0", "source": "code_search_net", "text": "/*\n(non-Javadoc)\n\n@see com.emc.ecs.nfsclient.nfs.NfsFile#mknod(com.emc.ecs.nfsclient.nfs.\nNfsType, com.emc.ecs.nfsclient.nfs.NfsSetAttributes, long[])\n\npublic NfsMknodResponse mknod(NfsType type, NfsSetAttributes attributes, long[] rdev) throws IOException {\n NfsMknodResponse response = getNfs().wrapped_sendMknod(makeMknodRequest(type, attributes, rdev));\n setFileHandle(response.getFileHandle());\n return response;\n }", "token_count": 129} {"added": "2026-12-05", "author": "artikcloud/artikcloud-java", "created": "2019", "id": "5407dc792b0078214665251b", "license": "Apache-2.0", "source": "code_search_net", "text": "@param qos Quality of Service (0, 1, or 2) used for publishing a message to ARTIK Cloud\n@param payload the payload of the published message\n@throws ArtikCloudMqttException\n\npublic void publish(int qos, String payload) throws ArtikCloudMqttException {\n MqttMessage mqttMessage = new MqttMessage(payload.getBytes());\n mqttMessage.setQos(qos);\n// System.out.println(\"****** Thread: \" + Thread.currentThread().getName()+ \"; MqttSession publishing : \"+ \"topic: \" + publishTopic +\"; payload: \" + payload);\n try {\n mqttClient.publish(publishMessageTopicPath, mqttMessage, String.valueOf(OperationMode.PUBLISH), operationListener);\n } catch (MqttException e) {\n throw new ArtikCloudMqttException(e);\n }\n }", "token_count": 172}