id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
900,800 | 7,306,114 | 4,318,399 | @Override
public void setOntology2Document(URL url2) throws IllegalArgumentException {
if (url2 == null) throw new IllegalArgumentException("Input parameter URL for ontology 2 is null.");
try {
ont2 = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(url2.openStr... | private void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir, BackUpInfoFileGroup fileGroup, LinkedList<String> restoreList) {
LinkedList<BackUpInfoFile> fileList = fileGroup.getFileList();
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
... | false |
900,801 | 10,437,938 | 22,568,530 | protected Document loadDocument() throws MalformedURLException, DocumentException, IOException {
if (jiraFilterURL.startsWith("file")) {
URL url = getSourceURL();
return parseDocument(url);
} else {
HttpClient httpClient = new DefaultHttpClient();
List... | private InputStream callService(String text) {
InputStream in = null;
try {
URL url = new URL(SERVLET_URL);
URLConnection conn = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setRequestMethod("POST");
... | false |
900,802 | 5,339,736 | 9,127,823 | public static String translate(String s) {
try {
String result = null;
URL url = new URL("http://translate.google.com/translate_t");
URLConnection connection = url.openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0... | public static Status checkUpdate() {
Status updateStatus = Status.FAILURE;
URL url;
InputStream is;
InputStreamReader isr;
BufferedReader r;
String line;
try {
url = new URL(updateURL);
is = url.openStream();
isr = new Input... | true |
900,803 | 15,537,156 | 614,390 | private void copy(String inputPath, String outputPath, String name) {
try {
FileReader in = new FileReader(inputPath + name);
FileWriter out = new FileWriter(outputPath + name);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
900,804 | 12,626,918 | 10,760,907 | public void xtestURL2() throws Exception {
URL url = new URL(IOTest.URL);
InputStream inputStream = url.openStream();
OutputStream outputStream = new FileOutputStream("C:/Temp/testURL2.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.c... | public void send(org.hibernate.Session hsession, Session session, String repositoryName, Vector files, int label, String charset) throws FilesException {
ByteArrayInputStream bais = null;
FileOutputStream fos = null;
try {
if ((files == null) || (files.size() <= 0)) {
... | true |
900,805 | 14,058,408 | 13,046,328 | private static void zipFolder(File folder, ZipOutputStream zipOutputStream, String relativePath) throws IOException {
File[] children = folder.listFiles();
for (int i = 0; i < children.length; i++) {
File child = children[i];
if (child.isFile()) {
String zipEn... | public FlickrObject perform(boolean chkResponse) throws FlickrException {
validate();
String data = getRequestData();
OutputStream os = null;
InputStream is = null;
try {
URL url = null;
try {
url = new URL(m_url);
} catch (... | false |
900,806 | 1,951,103 | 5,704,569 | private List<File> ungzipFile(File directory, File compressedFile) throws IOException {
List<File> files = new ArrayList<File>();
TarArchiveInputStream in = new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(compressedFile)));
try {
TarArchiveEntry entry = in.getNe... | public static void copy(File src, File dest) throws IOException {
if (!src.exists()) {
throw new IOException(StaticUtils.format(OStrings.getString("LFC_ERROR_FILE_DOESNT_EXIST"), new Object[] { src.getAbsolutePath() }));
}
FileInputStream fis = new FileInputStream(src);
d... | true |
900,807 | 3,533,514 | 3,287,812 | public boolean saveVideoXMLOnWebserver() {
String text = "";
boolean erg = false;
try {
URL url = new URL("http://localhost:8080/virtPresenterVerwalter/videofile.jsp?id=" + this.getId());
HttpURLConnection http = (HttpURLConnection) url.openConnection();
B... | private String getResourceAsString(final String name) throws IOException {
final InputStream is = JiBXTestCase.class.getResourceAsStream(name);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copyAndClose(is, baos);
return baos.toString();
}
| false |
900,808 | 8,651,990 | 427,727 | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException, BadRequestException, NotFoundException {
try {
resolveFileAttachment();
} catch (NoFileByTheIdException e) {
throw ... | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | true |
900,809 | 2,887,981 | 850,680 | private CathUtils() throws Exception {
super(Ontology.CATH);
InputStream is = null;
BufferedReader reader = null;
try {
final String CATH_REGEXP = OntologyFactory.getOntology(Ontology.CATH).getRegularExpression();
final URL url = new URL("http://release.cathdb... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
900,810 | 4,866,624 | 20,499,484 | public boolean authenticate() {
if (empresaFeta == null) empresaFeta = new AltaEmpresaBean();
log.info("authenticating {0}", credentials.getUsername());
boolean bo;
try {
String passwordEncriptat = credentials.getPassword();
MessageDigest m = MessageDigest.get... | private static byte[] getLoginHashSHA(final char[] password, final int seed) throws GGException {
try {
final MessageDigest hash = MessageDigest.getInstance("SHA1");
hash.update(new String(password).getBytes());
hash.update(GGUtils.intToByte(seed));
return has... | true |
900,811 | 18,785,060 | 12,894,191 | public static NotaFiscal insert(NotaFiscal objNF) {
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
int result;
if (c == null) {
return null;
}
if (objNF == null) {
return null;
}
try {
... | @Override
public void doHandler(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String directURL = request.getRequestURL().toString();
response.setCharacterEncoding("gbk");
PrintWriter out = response.getWriter();
try {
... | false |
900,812 | 16,116,225 | 8,639,730 | public void process(String t) {
try {
MessageDigest md5 = MessageDigest.getInstance(MD5_DIGEST);
md5.reset();
md5.update(t.getBytes());
callback.display(null, digestToHexString(md5.digest()));
} catch (Exception ex) {
callback.display(null,... | public static String md5encrypt(String toEncrypt) {
if (toEncrypt == null) {
throw new IllegalArgumentException("null is not a valid password to encrypt");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(toEncrypt.getBytes());
... | true |
900,813 | 14,776,145 | 13,216,961 | private void addPNMLFileToLibrary(File selected) {
try {
FileChannel srcChannel = new FileInputStream(selected.getAbsolutePath()).getChannel();
FileChannel dstChannel = new FileOutputStream(new File(matchingOrderXML).getParent() + "/" + selected.getName()).getChannel();
d... | public void actionPerformed(ActionEvent ev) {
if (fileChooser == null) {
fileChooser = new JFileChooser();
ExtensionFileFilter fileFilter = new ExtensionFileFilter("Device profile (*.jar, *.zip)");
fileFilter.addExtension("jar");
fileFi... | true |
900,814 | 17,871,427 | 18,956,180 | public void decryptFile(String encryptedFile, String decryptedFile, String password) throws Exception {
CipherInputStream in;
OutputStream out;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(passwor... | private void copyMerge(Path[] sources, OutputStream out) throws IOException {
Configuration conf = getConf();
for (int i = 0; i < sources.length; ++i) {
FileSystem fs = sources[i].getFileSystem(conf);
InputStream in = fs.open(sources[i]);
try {
IOU... | true |
900,815 | 3,883,870 | 12,226,563 | public String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | public void run() {
Vector<Update> updates = new Vector<Update>();
if (dic != null) updates.add(dic);
if (gen != null) updates.add(gen);
if (res != null) updates.add(res);
if (help != null) updates.add(help);
for (Iterator iterator = updates.iterator(); iterator.hasNe... | false |
900,816 | 10,140,251 | 13,908 | protected String contentString() {
String result = null;
URL url;
String encoding = null;
try {
url = url();
URLConnection connection = url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(false);
connec... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
900,817 | 8,364,547 | 11,075,647 | @Override
public void executeInterruptible() {
encodingTerminated = false;
File destinationFile = null;
try {
Runtime runtime = Runtime.getRuntime();
IconAndFileListElement element;
while ((element = getNextFileElement()... | @Test
public void testWriteModel() {
Model model = new Model();
model.setName("MY_MODEL1");
Stereotype st1 = new Stereotype();
st1.setName("Pirulito1");
PackageObject p1 = new PackageObject("p1");
ClassType type1 = new ClassType("Class1");
type1.setStereot... | true |
900,818 | 19,715,255 | 708,766 | static Object executeMethod(HttpMethod method, int timeout, boolean array) throws HttpRequestFailureException, HttpException, IOException, HttpRequestTimeoutException {
try {
method.getParams().setSoTimeout(timeout * 1000);
int status = -1;
Object result = null;
... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
900,819 | 6,371,592 | 8,258,909 | public void deleteUser(final List<Integer> userIds) {
try {
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
@Override
public void executeProcessReturnNull() thro... | public static void copyFile(File sourceFile, File destFile) {
FileChannel source = null;
FileChannel destination = null;
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
source = new FileInputStream(sourceFile).getChannel();
... | false |
900,820 | 12,477,501 | 20,506,425 | public HttpResponse execute(HttpUriRequest request, HttpContext context) throws IOException {
URI uri = request.getURI();
String original = uri.toString();
UrlRules rules = UrlRules.getRules(mResolver);
UrlRules.Rule rule = rules.matchRule(original);
String rewritten = rule.a... | private void handleXInclude(final String localName, final Attributes atts) {
if ("include".equals(localName)) {
this.inXInclude++;
String href = atts.getValue("href");
if ((href == null) || "".equals(href.trim())) {
href = null;
}
S... | false |
900,821 | 8,805,074 | 20,662,462 | protected boolean checkLogin(String username, String password) {
log.debug("Called checkLogin with " + username);
String urlIn = GeoNetworkContext.url + "/" + GeoNetworkContext.loginService + "?username=" + username + "&password=" + password;
Element results = null;
String cookieValu... | @Override
public DownloadingItem download(Playlist playlist, String title, File folder, StopDownloadCondition condition, String uuid) throws IOException, StoreStateException {
boolean firstIteration = true;
Iterator<PlaylistEntry> entries = playlist.getEntries().iterator();
DownloadingIt... | false |
900,822 | 12,903,179 | 13,433,127 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!sourceFile.exists()) {
return;
}
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
sour... | public void save(File selectedFile) throws IOException {
if (storeEntriesInFiles) {
boolean moved = false;
for (int i = 0; i < tempFiles.size(); i++) {
File newFile = new File(selectedFile.getAbsolutePath() + "_" + Integer.toString(i) + ".zettmp");
mov... | true |
900,823 | 2,362,445 | 6,008,880 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | protected void updateJava2ScriptProject(String prjFolder, String binRelative) {
try {
File cpFile = new File(prjFolder, ".classpath");
FileInputStream fis = new FileInputStream(cpFile);
String classpath = J2SLaunchingUtil.readAFile(fis);
if (classpath != null)... | true |
900,824 | 552,319 | 420,619 | public String getpage(String leurl) throws Exception {
int data;
StringBuffer lapage = new StringBuffer();
URL myurl = new URL(leurl);
URLConnection conn = myurl.openConnection();
conn.connect();
if (!Pattern.matches("HTTP/... 2.. .*", conn.getHeaderField(0).toString(... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
900,825 | 18,060,085 | 10,086,563 | public static boolean verifyPassword(String digest, String password) {
String alg = null;
int size = 0;
if (digest.regionMatches(true, 0, "{SHA}", 0, 5)) {
digest = digest.substring(5);
alg = "SHA-1";
size = 20;
} else if (digest.regionMatches(true... | public void loadProfilefromConfig(String filename, P xslProfileClass, String profileTag) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
if (Val.chkStr(profileTag).equals("")) {
profileTag = "Profile";
}
String configuration_folder_path ... | false |
900,826 | 9,399,634 | 12,803,512 | protected static String fileName2md5(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(input.getBytes("iso-8859-1"));
byte[] byteHash = md.digest();
md.reset();
StringBuffer resultString = ... | @Override
public CheckAvailabilityResult execute(final CheckAvailabilityAction action, final ExecutionContext context) throws ActionException {
if (LOGGER.isDebugEnabled()) {
String serverName = null;
if (action.getServerId() == CheckAvailability.FEDORA_ID) {
serv... | false |
900,827 | 597,134 | 18,613,811 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public void readPersistentProperties() {
try {
String file = System.getProperty("user.home") + System.getProperty("file.separator") + ".das2rc";
File f = new File(file);
if (f.canRead()) {
try {
InputStream in = new FileInputStream(f);
... | true |
900,828 | 20,805,884 | 10,058,360 | public String preProcessHTML(String uri) {
final StringBuffer buf = new StringBuffer();
try {
HTMLDocument doc = new HTMLDocument() {
public HTMLEditorKit.ParserCallback getReader(int pos) {
return new HTMLEditorKit.ParserCallback() {
... | void startzm() {
URL myzzurl;
InputStream myzstream;
byte zmemimage[];
boolean joined;
zmemimage = null;
try {
System.err.println(zcodefile);
myzzurl = new URL(zcodefile);
myzstream = myzzurl.openStream();
zmemimage = su... | false |
900,829 | 17,398,520 | 11,163,692 | public void SendFile(File testfile) {
try {
SocketChannel sock = SocketChannel.open(new InetSocketAddress("127.0.0.1", 1234));
sock.configureBlocking(true);
while (!sock.finishConnect()) {
System.out.println("NOT connected!");
}
Sys... | public static void transfer(File src, File dest, boolean removeSrc) throws FileNotFoundException, IOException {
Log.warning("source: " + src);
Log.warning("dest: " + dest);
if (!src.canRead()) {
throw new IOException("can not read src file: " + src);
}
if (!dest.g... | true |
900,830 | 2,716,763 | 16,822,377 | public void saveUploadFile(String toFileName, UploadFile uploadFile, SysConfig sysConfig) throws IOException {
OutputStream bos = new FileOutputStream(toFileName);
IOUtils.copy(uploadFile.getInputStream(), bos);
if (sysConfig.isAttachImg(uploadFile.getFileName()) && sysConfig.getReduceAttach... | public String buscarArchivos(String nUsuario) {
String responce = "";
String request = conf.Conf.buscarArchivo;
OutputStreamWriter wr = null;
BufferedReader rd = null;
try {
URL url = new URL(request);
URLConnection conn = url.openConnection();
... | false |
900,831 | 254,039 | 2,633,238 | protected void doDownload(S3Bucket bucket, S3Object s3object) throws Exception {
String key = s3object.getKey();
key = trimPrefix(key);
String[] path = key.split("/");
String fileName = path[path.length - 1];
String dirPath = "";
for (int i = 0; i < path.length - 1; i... | public static String getResourceFromURL(URL url, String acceptHeader) throws java.io.IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setUseCaches(false);
urlConnection.setRequestProperty("Accept", acceptHeader);
urlConnection.se... | false |
900,832 | 3,597,316 | 5,706,224 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | public void run() {
try {
File outDir = new File(outDirTextField.getText());
if (!outDir.exists()) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(... | true |
900,833 | 21,518,266 | 1,208,401 | public void initGet() throws Exception {
cl = new DefaultHttpClient();
GetAuthPromter hp = new GetAuthPromter();
cl.setCredentialsProvider(hp);
get = new HttpGet(getURL());
get.setHeader("User-Agent", "test");
get.setHeader("Accept", "*/*");
get.setHeader("Ran... | public static String hash(String str) {
if (str == null || str.length() == 0) {
throw new CaptureSecurityException("String to encript cannot be null or zero length");
}
StringBuilder hexString = new StringBuilder();
try {
MessageDigest md = MessageDigest.getIn... | false |
900,834 | 19,121,580 | 6,729,311 | public static String toMd5(String s) {
String res = "";
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
res = toHexString(messageDigest);
} catch ... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | true |
900,835 | 20,681,845 | 19,029,279 | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | public static boolean copy(File from, File to, Override override) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
FileChannel srcChannel = null;
FileChannel destChannel = null;
if (override == null) override = Override.NEWER;
switch(overri... | true |
900,836 | 413,620 | 13,824,827 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | true |
900,837 | 23,243,320 | 6,535,232 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | public String encodePassword(String password, byte[] salt) throws Exception {
if (salt == null) {
salt = new byte[12];
secureRandom.nextBytes(salt);
}
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(salt);
md.update(password.getBytes("UT... | true |
900,838 | 23,349,376 | 5,855,466 | public TreeMap getStrainMap() {
TreeMap strainMap = new TreeMap();
String server = "";
try {
Datasource[] ds = DatasourceManager.getDatasouce(alias, version, DatasourceManager.ALL_CONTAINS_GROUP);
for (int i = 0; i < ds.length; i++) {
if (ds[i].getDesc... | public static boolean loadTestProperties(Properties props, Class<?> callingClazz, Class<?> hierarchyRootClazz, String resourceBaseName) {
if (!hierarchyRootClazz.isAssignableFrom(callingClazz)) {
throw new IllegalArgumentException("Class " + callingClazz + " is not derived from " + hierarchyRoot... | false |
900,839 | 16,458,721 | 4,336,715 | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| private static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel... | true |
900,840 | 8,224,584 | 18,070,587 | @Override
public boolean checkConnection() {
int status = 0;
try {
URL url = new URL(TupeloProxy.endpoint);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
status = conn.getResponseCode();
} catch (Exception e) {
logger.s... | @Test
public void testWriteAndReadFirstLevel() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | false |
900,841 | 5,199,811 | 2,273,819 | public static String encodePassword(String password) {
try {
MessageDigest messageDiegest = MessageDigest.getInstance("SHA-1");
messageDiegest.update(password.getBytes("UTF-8"));
return Base64.encodeToString(messageDiegest.digest(), false);
} catch (NoSuchAlgorith... | String digest(final UserAccountEntity account) {
try {
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(account.getUserId().getBytes("UTF-8"));
digest.update(account.getLastLogin().toString(... | true |
900,842 | 11,918,313 | 19,498,550 | public String[] retrieveFasta(String id) throws Exception {
URL url = new URL("http://www.ebi.ac.uk/ena/data/view/" + id + "&display=fasta");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String header = reader.readLine();
StringBuffer seq = new... | public Constructor run() throws Exception {
String path = "META-INF/services/" + ComponentApplicationContext.class.getName();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
final Enumeration... | true |
900,843 | 21,348,949 | 21,575,638 | protected void onSubmit() {
super.onSubmit();
if (!this.hasError()) {
final FileUpload upload = fileUploadField.getFileUpload();
if (upload != null) {
try {
StringWriter xmlSourceWriter = new StringWriter();
... | protected void writeGZippedBytes(byte array[], TupleOutput out) {
if (array == null || array.length == 0) {
out.writeBoolean(false);
writeBytes(array, out);
return;
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(array.length);
... | true |
900,844 | 5,875,194 | 9,689,565 | @SuppressWarnings("unchecked")
public static void unzip(String zipFileName, String folder, boolean isCreate) throws IOException {
File file = new File(zipFileName);
File folderfile = null;
if (file.exists() && file.isFile()) {
String mfolder = folder == null ? file.getParent(... | public static String md5sum(String s, String alg) {
try {
MessageDigest md = MessageDigest.getInstance(alg);
md.update(s.getBytes(), 0, s.length());
StringBuffer sb = new StringBuffer();
synchronized (sb) {
for (byte b : md.digest()) sb.append(... | false |
900,845 | 13,028,546 | 18,695,537 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public InputSource resolveEntity(String pPublicId, String pSystemId) throws SAXException, IOException {
try {
URL url = new URL(pSystemId);
String fileName = (String) urlMap.get(url);
if (fileName != null) {
FileInputStream istream ... | false |
900,846 | 7,996,909 | 13,744,886 | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | @Override
public void run() {
try {
FileChannel in = new FileInputStream(inputfile).getChannel();
long pos = 0;
for (int i = 1; i <= noofparts; i++) {
FileChannel out = new FileOutputStream(outputfile.getAbsolutePath() + "." + "v" + i).getChannel();
... | false |
900,847 | 21,144,775 | 4,462,296 | public static void main(String[] args) {
String logConfiguration = args[2];
DOMConfigurator.configure(logConfiguration);
String urlToRun = args[0];
String outputFile = args[1];
InputStream conInput = null;
BufferedReader reader = null;
BufferedWriter writer = ... | public synchronized void insertMessage(FrostUnsentMessageObject mo) throws SQLException {
AttachmentList files = mo.getAttachmentsOfType(Attachment.FILE);
AttachmentList boards = mo.getAttachmentsOfType(Attachment.BOARD);
Connection conn = AppLayerDatabase.getInstance().getPooledConnection()... | false |
900,848 | 11,992,308 | 6,258,282 | public static String generateStringSHA256(String content) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ScannerChecksum.class.getName()).log(Level.SEVERE, null, ex);
}
... | public void testDigest() {
try {
String myinfo = "我的测试信息";
MessageDigest alga = MessageDigest.getInstance("SHA-1");
alga.update(myinfo.getBytes());
byte[] digesta = alga.digest();
System.out.println("本信息摘要是:" + byte2hex(digesta));
Messa... | true |
900,849 | 14,287,646 | 8,335,460 | private String getStoreName() {
try {
final MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(protectionDomain.getBytes());
final byte[] bs = digest.digest();
final StringBuffer sb = new StringBuffer(bs.length * 2);
for (int i ... | public static String encrypt(String password, String algorithm, byte[] salt) {
StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented");
} else if ("S... | true |
900,850 | 13,799,349 | 7,149,321 | void bubbleSort(int ids[]) {
boolean flag = true;
int temp;
while (flag) {
flag = false;
for (int i = 0; i < ids.length - 1; i++) if (ids[i] < ids[i + 1]) {
temp = ids[i];
ids[i] = ids[i + 1];
ids[i + 1] = temp;
... | public static Dimension getJPEGDimension(String urls) throws IOException {
URL url;
Dimension d = null;
try {
url = new URL(urls);
InputStream fis = url.openStream();
if (fis.read() != 255 || fis.read() != 216) throw new RuntimeException("SOI (Start Of Ima... | false |
900,851 | 20,954,717 | 10,912,335 | private static final void copyFile(File srcFile, File destDir, byte[] buffer) {
try {
File destFile = new File(destDir, srcFile.getName());
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
int bytesRead;
... | public void guardarCantidad() {
try {
String can = String.valueOf(cantidadArchivos);
File archivo = new File("cantidadArchivos.txt");
FileWriter fw = new FileWriter(archivo);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter salida = new Prin... | true |
900,852 | 22,564,546 | 22,448,399 | public void unzip(String resource) {
File f = new File(resource);
if (!f.exists()) throw new RuntimeException("The specified resources does not exist (" + resource + ")");
String parent = f.getParent().toString();
try {
BufferedOutputStream dest = null;
FileIn... | private HttpURLConnection getHttpURLConnection(String bizDocToExecute) {
StringBuffer servletURL = new StringBuffer();
servletURL.append(getBaseServletURL());
servletURL.append("?_BIZVIEW=").append(bizDocToExecute);
Map<String, Object> inputParms = getInputParams();
if (input... | false |
900,853 | 777,609 | 8,856,524 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | @Action(value = "ajaxFileUploads", results = { })
public void ajaxFileUploads() throws IOException {
String extName = "";
String newFilename = "";
String nowTimeStr = "";
String realpath = "";
if (Validate.StrNotNull(this.getImgdirpath())) {
realpath = "Uploa... | true |
900,854 | 2,476,569 | 2,737,487 | public static void reconstruct(final List files, final Map properties, final OutputStream fout, final String base_url, final String producer, final PageSize[] size, final List hf) throws CConvertException {
OutputStream out = fout;
OutputStream out2 = fout;
boolean signed = false;
Ou... | public static void copy(File src, File dest) throws IOException {
OutputStream stream = new FileOutputStream(dest);
FileInputStream fis = new FileInputStream(src);
byte[] buffer = new byte[16384];
while (fis.available() != 0) {
int read = fis.read(buffer);
str... | true |
900,855 | 4,988,270 | 4,898,682 | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | public void run() {
try {
String s = (new StringBuilder()).append("fName=").append(URLEncoder.encode("???", "UTF-8")).append("&lName=").append(URLEncoder.encode("???", "UTF-8")).toString();
URL url = new URL("http://snoop.minecraft.net/");
HttpURLConnection httpurlconnect... | false |
900,856 | 13,783,899 | 5,785,861 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | @Test
public void testEncryptDecrypt() throws IOException {
BlockCipher cipher = new SerpentEngine();
Random rnd = new Random();
byte[] key = new byte[256 / 8];
rnd.nextBytes(key);
byte[] iv = new byte[cipher.getBlockSize()];
rnd.nextBytes(iv);
byte[] data... | true |
900,857 | 3,739,492 | 420,619 | public static boolean downloadFile(String url, String destination) {
BufferedInputStream bi = null;
BufferedOutputStream bo = null;
File destfile;
try {
java.net.URL fileurl;
try {
fileurl = new java.net.URL(url);
} catch (Malformed... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
900,858 | 17,141,933 | 19,027,042 | public static InputSource getInputSource(URL url) throws IOException {
String proto = url.getProtocol().toLowerCase();
if (!("http".equals(proto) || "https".equals(proto))) throw new IllegalArgumentException("OAI-PMH only allows HTTP(S) as network protocol!");
HttpURLConnection conn = (HttpU... | public boolean refreshRequired() {
boolean status = false;
Set<String> urls = lastModifiedDates.keySet();
try {
for (String urlPath : urls) {
Long lastModifiedDate = lastModifiedDates.get(urlPath);
URL url = new URL(urlPath);
URLCon... | false |
900,859 | 8,269,895 | 16,879,559 | private String getData(String requestUrl) throws AuthenticationException, IOException {
URL url = new URL(requestUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String header;
try {
header = oauthAuthenticator.getHttpAuthorizationHeader(url.toStri... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText eText = (EditText) findViewById(R.id.address);
final Button button = (Button) findViewById(R.id.ButtonGo);
button.setOnClickListen... | false |
900,860 | 20,661,433 | 21,247,844 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | public static void kopirujSoubor(File vstup, File vystup) throws IOException {
FileChannel sourceChannel = new FileInputStream(vstup).getChannel();
FileChannel destinationChannel = new FileOutputStream(vystup).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel... | true |
900,861 | 20,054,230 | 1,024,884 | private final String createMD5(String pwd) throws Exception {
MessageDigest md = (MessageDigest) MessageDigest.getInstance("MD5").clone();
md.update(pwd.getBytes("UTF-8"));
byte[] pd = md.digest();
StringBuffer app = new StringBuffer();
for (int i = 0; i < pd.length; i++) {
... | @Override
protected URLConnection openConnection(URL url) throws IOException {
try {
final HttpServlet servlet;
String path = url.getPath();
if (path.matches("reg:.+")) {
String registerName = path.replaceAll("reg:([^/]*)/.*", "$1");
se... | false |
900,862 | 21,277,519 | 12,197,340 | public static String getMD5(String s) throws Exception {
MessageDigest complete = MessageDigest.getInstance("MD5");
complete.update(s.getBytes());
byte[] b = complete.digest();
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[... | private void initBanner() {
for (int k = 0; k < 3; k++) {
if (bannerImg == null) {
int i = getRandomId();
imageURL = NbBundle.getMessage(BottomContent.class, "URL_BannerImageLink", Integer.toString(i));
bannerURL = NbBundle.getMessage(BottomContent... | false |
900,863 | 17,930,257 | 22,010,538 | public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new ImageFilter());
fc.setFileView(new ImageFileView());
fc.setAccessory(new ImagePreview(fc));
... | private byte[] getBytes(String resource) throws IOException {
InputStream is = HttpServletFileDownloadTest.class.getResourceAsStream(resource);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(is, out);
IOUtils.closeQuietly(is);
return out.toByteArray();
... | true |
900,864 | 23,113,421 | 2,278,820 | public String getString(String arg) throws Exception {
URL url = new URL(arg);
URLConnection con = url.openConnection();
con.setUseCaches(false);
con.connect();
InputStreamReader src = new InputStreamReader(con.getInputStream(), "ISO-8859-1");
StringBuffer stb = new S... | public String md5sum(String toCompute) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(toCompute.getBytes());
java.math.BigInteger hash = new java.math.BigInteger(1, md.digest());
return hash.toString(16);
}
| false |
900,865 | 12,614,305 | 9,127,823 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static Status checkUpdate() {
Status updateStatus = Status.FAILURE;
URL url;
InputStream is;
InputStreamReader isr;
BufferedReader r;
String line;
try {
url = new URL(updateURL);
is = url.openStream();
isr = new Input... | false |
900,866 | 5,518,199 | 9,552,054 | protected String loadPage(String url_string) {
try {
URL url = new URL(url_string);
HttpURLConnection connection = null;
InputStream is = null;
try {
connection = (HttpURLConnection) url.openConnection();
int response = connecti... | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | false |
900,867 | 1,944,560 | 7,395,775 | private static boolean copyFile(File src, File dest) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
for (int c = fis.read(); c != -1; c = fis.read()) fos.write(c);
... | private void copyReportFile(ServletRequest req, String reportName, Report report) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, FileNotFoundException, IOException {
String reportFileName = (String) Class.forName("org.eclipse.birt.report.utility.Para... | true |
900,868 | 9,696,025 | 8,344,806 | public static boolean copyFile(File source, File dest) {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
srcChannel = new FileInputStream(source).getChannel();
dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFro... | public void unpack(File destDirectory, boolean delete) {
if (delete) delete(destDirectory);
if (destDirectory.exists()) throw new ContentPackageException("Destination directory already exists.");
this.destDirectory = destDirectory;
this.manifestFile = new File(destDirectory, MANIFEST... | true |
900,869 | 196,392 | 14,289,588 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | @Override
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException {
if ((baseName == null) || (locale == null) || (format == null) || (loader == null)) {
throw new Nu... | false |
900,870 | 11,339,042 | 9,543,279 | public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = null;
ServletOutputStream outstream = null;
try {
String action = req.getParameter("nmrshiftdbaction");
String relativepath = ServletUtils.expa... | @Override
protected void write(InputStream in, OutputStream out, javax.sound.sampled.AudioFormat javaSoundFormat) throws IOException {
if (USE_JAVASOUND) {
super.write(in, out, javaSoundFormat);
} else {
try {
byte[] header = JavaSoundCodec.createWavHeader... | true |
900,871 | 8,359,775 | 17,241,450 | public static void shakeSort(int[] a) {
if (a == null) {
throw new IllegalArgumentException("Null-pointed array");
}
int k = 0;
int left = 0;
int right = a.length - 1;
while (right - left > 0) {
k = 0;
for (int i = 0; i <= right - 1... | public static boolean copyFile(File src, File des) {
try {
BufferedInputStream in = new BufferedInputStream(new FileInputStream(src));
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(des));
int b;
while ((b = in.read()) != -1) out.writ... | false |
900,872 | 3,236,017 | 23,058,336 | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | public static void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceCh... | true |
900,873 | 6,371,603 | 5,257,598 | public void setDefaultMailBox(final int domainId, final int userId) {
final EmailAddress defaultMailbox = cmDB.getDefaultMailbox(domainId);
try {
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, ... | public static int proxy(java.net.URI uri, HttpServletRequest req, HttpServletResponse res) throws IOException {
final HostConfiguration hostConfig = new HostConfiguration();
hostConfig.setHost(uri.getHost());
HttpMethodBase httpMethod = null;
if (HttpRpcServer.METHOD_GET.equalsIgnore... | false |
900,874 | 11,450,174 | 4,975,451 | private void publishPage(URL url, String path, File outputFile) throws IOException {
if (debug) {
System.out.println(" publishing page: " + path);
System.out.println(" url == " + url);
System.out.println(" file == " + outputFile);
}
Stri... | public void performUpdates(List<PackageDescriptor> downloadList, ProgressListener progressListener) throws IOException, UpdateServiceException_Exception {
int i = 0;
try {
for (PackageDescriptor desc : downloadList) {
String urlString = service.getDownloadURL(desc.getPack... | false |
900,875 | 11,517,213 | 9,176,940 | private static void copyFile(File sourceFile, File destFile) {
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream... | public static void copyFile(File in, File out, boolean read, boolean write, boolean execute) throws FileNotFoundException, IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
File outFile = null;
if (out.isDirectory()) {
outFile = new File(out.getAbsoluteP... | true |
900,876 | 21,843,124 | 12,967,783 | protected String connectPost(String urlString, String parameter) {
String response = null;
try {
URL url = new URL(urlString);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setUseCac... | @Override
public void doExecute(String[] args) {
if (args.length != 2) {
printUsage();
} else {
int fileNo = 0;
try {
fileNo = Integer.parseInt(args[1]) - 1;
} catch (NumberFormatException e) {
printUsage();
... | false |
900,877 | 11,261,168 | 20,177,224 | public static String encryptPassword(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
final MessageDigest digester = MessageDigest.getInstance("sha-256");
digester.reset();
digester.update("Carmen Sandiago".getBytes());
return asHex(digester.digest(pas... | public static String encryptPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
byte[] hash = md.digest();
int hashLength = hash.length;
StringBuffer hashStringBuf = new StringBuffe... | true |
900,878 | 11,149,084 | 282,431 | private void deleteProject(String uid, String home, HttpServletRequest request, HttpServletResponse response) throws Exception {
String project = request.getParameter("project");
String line;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
htmlHe... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
900,879 | 23,241,194 | 3,573,409 | private void publishZip(LWMap map) {
try {
if (map.getFile() == null) {
VueUtil.alert(VueResources.getString("dialog.mapsave.message"), VueResources.getString("dialog.mapsave.title"));
return;
}
File savedCMap = PublishUtil.createZip(map, P... | public synchronized void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
CacheEntry entry = null;
Tenant tenant = null;
if (!tenantInfo.getTenants().isEmpty()) {
tenant = tenantInfo.getMatchingTenant(request);
... | true |
900,880 | 11,810,425 | 14,768,963 | private static String createBoundary(int number) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
digest.update(String.valueOf(Math.random()).getBytes());
... | public static boolean exec_applet(String fname, VarContainer vc, ActionContainer ac, ThingTypeContainer ttc, Output OUT, InputStream IN, boolean AT, Statement state, String[] arggies) {
if (!urlpath.endsWith("/")) {
urlpath = urlpath + '/';
}
if (!urlpath.startsWith("http://")) {... | false |
900,881 | 19,643,372 | 8,296,360 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void copiaAnexos(String from, String to, AnexoTO[] anexoTO) {
FileChannel in = null, out = null;
for (int i = 0; i < anexoTO.length; i++) {
try {
in = new FileInputStream(new File((uploadDiretorio.concat(from)).concat(File.separator + anexoTO[i].getNome())))... | true |
900,882 | 20,651,942 | 15,953,416 | public synchronized void receive(MessageEvent e) {
switch(e.message.getType()) {
case MessageTypes.QUIT:
activeSessions--;
break;
case MessageTypes.SHUTDOWN_SERVER:
activeSessions--;
if (Options.password.trim().equals(""... | public static String getMD5(String password) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
String salt = "UseTheForce4";
password = salt + password;
md5.update(password.getBytes(), 0, password.length());
password = new BigInteger(1,... | true |
900,883 | 16,503,018 | 4,758,044 | public String getNextObjectId() throws SQLException {
long nextserial = 1;
String s0 = "lock table serials in exclusive mode";
String s1 = "SELECT nextserial FROM serials WHERE tablename = 'SERVER_OIDS'";
String s2;
try {
Statement stmt = dbconnect.connection.crea... | private static void readServicesFromUrl(Collection<String> list, URL url) throws IOException {
InputStream in = url.openStream();
try {
if (in == null) return;
BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
while (true) {
... | false |
900,884 | 8,372,919 | 2,329,054 | private String MD5(String s) {
Log.d("MD5", "Hashing '" + s + "'");
String hash = "";
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
hash = new BigInteger(1, m.digest()).toString(16);
Log.d("MD5... | public static String MD5(String str) {
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
md5.update(str.getBytes(), 0, str.length());
String sig = new BigInteger(1, md5.digest()).toString();
return sig;
} catch (NoSuchAlgorithmException e) {
... | true |
900,885 | 17,958,985 | 5,404,510 | public void onCreate() {
window = ((Window) getFellow("win"));
userName = ((Textbox) getFellow("user"));
password = ((Textbox) getFellow("password"));
session = window.getDesktop().getSession();
if (Executions.getCurrent().getParameter("login") != null) {
login = ... | @MediumTest
public void testUrlRewriteRules() throws Exception {
ContentResolver resolver = getContext().getContentResolver();
GoogleHttpClient client = new GoogleHttpClient(resolver, "Test", false);
Settings.Gservices.putString(resolver, "url:test", "http://foo.bar/ rewrite " + mServerU... | false |
900,886 | 8,696,200 | 12,568,442 | public static String getHash(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes());
byte[] array = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; i++) {
... | public static String MD5(String text) {
byte[] md5hash = new byte[32];
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
} catch (Exception e) {
... | true |
900,887 | 20,970,925 | 20,071,852 | public static final String convertPassword(final String srcPwd) {
StringBuilder out;
MessageDigest md;
byte[] byteValues;
byte singleChar = 0;
try {
md = MessageDigest.getInstance("MD5");
md.update(srcPwd.getBytes());
byteValues = md.digest... | void write() throws IOException {
if (!allowUnlimitedArgs && args != null && args.length > 1) throw new IllegalArgumentException("Only one argument allowed unless allowUnlimitedArgs is enabled");
String shebang = "#!" + interpretter;
for (int i = 0; i < args.length; i++) {
sheban... | false |
900,888 | 1,665,765 | 716,032 | public InputStream openFileInputStream(String fileName) throws IOException {
if (fileName.indexOf(':') > 1) {
URL url = new URL(fileName);
InputStream in = url.openStream();
return in;
}
fileName = translateFileName(fileName);
FileInputStream in = ... | public void getZipFiles(String filename) {
try {
String destinationname = "c:\\mods\\peu\\";
byte[] buf = new byte[1024];
ZipInputStream zipinputstream = null;
ZipEntry zipentry;
zipinputstream = new ZipInputStream(new FileInputStream(filename));
... | false |
900,889 | 10,453,631 | 2,279,291 | public synchronized String encrypt(String plaintext) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
log().error("failed to encrypt the password.", e);
... | public static String encrypt(String plainText) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new Exception(e.getMessage());
}
try {
md.update(plainText.... | true |
900,890 | 8,924,519 | 3,461,964 | private String grabInformationFromWeb(String query, String infoName) throws Exception {
String result = "";
URL url = new URL(query);
HttpURLConnection request = null;
request = (HttpURLConnection) url.openConnection();
if (request != null) {
InputStream in = url.... | public String useService(HashMap<String, String> input) {
String output = "";
if (input.size() < 1) {
return "";
}
String data = "";
try {
for (String key : input.keySet()) {
data += "&" + URLEncoder.encode(key, "UTF-8") + "=" + URLEnco... | false |
900,891 | 4,259,286 | 3,239,010 | protected List webservice(URL url, List locations, boolean followRedirect) throws GeoServiceException {
long start = System.currentTimeMillis();
int rowCount = 0, hitCount = 0;
try {
HttpURLConnection con;
try {
con = (HttpURLConnection) url.openConnec... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | false |
900,892 | 6,319,887 | 19,786,101 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | protected void initializeFromURL(URL url, AVList params) throws IOException {
URLConnection connection = url.openConnection();
String message = this.validateURLConnection(connection, SHAPE_CONTENT_TYPES);
if (message != null) {
throw new IOException(message);
}
th... | false |
900,893 | 18,648,407 | 7,366,687 | public static void copyFile(File file, File destination) throws Exception {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
out = new BufferedOutputStream(new FileOutputStream(destination))... | public static void DecodeMapFile(String mapFile, String outputFile) throws Exception {
byte magicKey = 0;
byte[] buffer = new byte[2048];
int nread;
InputStream map;
OutputStream output;
try {
map = new FileInputStream(mapFile);
} catch (Exception ... | true |
900,894 | 13,949,581 | 12,232,011 | public static String cryptografar(String senha) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(senha.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
senha = hash.toString(16);
} catch (NoSuchAlgorithmException ns)... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | false |
900,895 | 17,987,049 | 13,547,845 | private boolean writeResource(PluginProxy eclipseInstallPlugin, ResourceProxy translation, LocaleProxy locale) throws Exception {
String translationResourceName = determineTranslatedResourceName(translation, locale);
String pluginNameInDirFormat = eclipseInstallPlugin.getName().replace(Messages.getS... | public static PortalConfig install(File xml, File dir) throws IOException, ConfigurationException {
if (!dir.exists()) {
log.info("Creating directory {}", dir);
dir.mkdirs();
}
if (!xml.exists()) {
log.info("Installing default configuration to {}", xml);
... | true |
900,896 | 21,161,448 | 2,771,574 | public static boolean copyFile(File soureFile, File destFile) {
boolean copySuccess = false;
if (soureFile != null && destFile != null && soureFile.exists()) {
try {
new File(destFile.getParent()).mkdirs();
BufferedOutputStream out = new BufferedOutputStre... | protected IStatus run(IProgressMonitor monitor) {
try {
updateRunning = true;
distributor = getFromFile("[SERVER]", "csz", getAppPath() + "/server.ini");
MAC = getFromFile("[SPECIFICINFO]", "MAC", getAppPath() + ... | false |
900,897 | 8,063,675 | 16,022,035 | private static int ejecutaUpdate(String database, String SQL) throws Exception {
int i = 0;
DBConnectionManager dbm = null;
Connection bd = null;
try {
dbm = DBConnectionManager.getInstance();
bd = dbm.getConnection(database);
Statement st = bd.cre... | public boolean save(Object obj) {
boolean bool = false;
this.result = null;
if (obj == null) return bool;
Connection conn = null;
try {
conn = ConnectUtil.getConnect();
conn.setAutoCommit(false);
String sql = SqlUtil.getInsertSql(this.getCl... | true |
900,898 | 17,608,158 | 16,499,420 | public static void main(String[] args) {
FileInputStream in;
DeflaterOutputStream out;
FileOutputStream fos;
FileDialog fd;
fd = new FileDialog(new Frame(), "Find a file to deflate", FileDialog.LOAD);
fd.show();
if (fd.getFile() != null) {
try {
... | private void saveFile(InputStream in, String fullPath) {
try {
File sysfile = new File(fullPath);
if (!sysfile.exists()) {
sysfile.createNewFile();
}
java.io.OutputStream out = new FileOutputStream(sysfile);
org.apache.commons.io.IO... | true |
900,899 | 3,253,028 | 2,530,139 | public static List<String> unTar(File tarFile, File directory) throws IOException {
List<String> result = new ArrayList<String>();
InputStream inputStream = new FileInputStream(tarFile);
TarArchiveInputStream in = new TarArchiveInputStream(inputStream);
TarArchiveEntry entry = in.get... | public static String md5(String input) {
String res = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] md5 = algorithm.digest();
String tmp = "";
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.