Dataset Viewer
Auto-converted to Parquet Duplicate
func1
stringlengths
254
2.93k
func2
stringlengths
254
2.97k
label
int64
0
1
private void copy(File source, File destinationDirectory) throws IOException { if (source.isDirectory()) { File newDir = new File(destinationDirectory, source.getName()); newDir.mkdir(); File[] children = source.listFiles(); for (int i = 0; i < children.length...
public static void main(String[] args) { try { URL url = new URL(args[0]); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRequestMethod("PUT"); OutputStreamWriter out = new OutputStreamWr...
0
public boolean resourceExists(String location) { if ((location == null) || (location.length() == 0)) { return false; } try { URL url = buildURL(location); URLConnection cxn = url.openConnection(); InputStream is = null; try { ...
public static String doCrypt(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md; md = MessageDigest.getInstance("SHA-1"); byte[] sha1hash = new byte[40]; md.update(text.getBytes("UTF-8"), 0, text.length()); sha1hash = md.digest(); ...
0
public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { try { URL url = (getURL() != null) ? new URL(getURL().toExternalForm()) : new URL(((URL) ctxAttrValue).toExternalForm()); InputStream reader = url.openStream(); int availab...
private static void copyFile(String src, String target) throws IOException { FileChannel ic = new FileInputStream(src).getChannel(); FileChannel oc = new FileOutputStream(target).getChannel(); ic.transferTo(0, ic.size(), oc); ic.close(); oc.close(); }
0
private void CopyTo(File dest) throws IOException { FileReader in = null; FileWriter out = null; int c; try { in = new FileReader(image); out = new FileWriter(dest); while ((c = in.read()) != -1) out.write(c); } finally { if (in...
private static String encodeMd5(String key) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.reset(); md.update(key.getBytes()); byte[] bytes = md.digest(); String result = toHexString(bytes); return result; } cat...
0
public static void unzip(File file, ZipFile zipFile, File targetDirectory) throws BusinessException { LOG.info("Unzipping zip file '" + file.getAbsolutePath() + "' to directory '" + targetDirectory.getAbsolutePath() + "'."); assert (file.exists() && file.isFile()); if (targetDirectory.exists...
public static void Sample1(String myField, String condition1, String condition2) throws SQLException { Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost/test", "user", "password"); connection.setAutoCommit(false); PreparedStatement ps = connection.prepareStatement("UPDATE myTabl...
0
public void writeData(String name, int items, int mzmin, int mzmax, long tstart, long tdelta, int[] peaks) { PrintWriter file = getWriter(name + ".txt"); file.print("Filename\t"); file.print("Date\t"); file.print("Acquisition #\t"); file.print("�m Diameter\t"); for (i...
public String encrypt(String password) throws Exception { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(password.getBytes()); BigInteger hash = new BigInteger(1, md5.digest()); String hashword = hash.toString(16); return hashword; }
0
public static MessageService getMessageService(String fileId) { MessageService ms = null; if (serviceCache == null) init(); if (serviceCache.containsKey(fileId)) return serviceCache.get(fileId); Properties p = new Properties(); try { URL url = I18nPlugin.getFileUR...
private void startScript(wabclient.Attributes prop) throws SAXException { dialog.beginScript(); String url = prop.getValue("src"); if (url.length() > 0) { try { BufferedReader r = new BufferedReader(new InputStreamReader(new URL(url).openStream())); ...
0
public static void copyFile(File source, File destination) throws IOException { FileChannel in = null; FileChannel out = null; try { in = new FileInputStream(source).getChannel(); out = new FileOutputStream(destination).getChannel(); in.transferTo(0, in.si...
public static void main(String[] args) { FTPClient client = new FTPClient(); String sFTP = "ftp.miservidor.com"; String sUser = "usuario"; String sPassword = "password"; try { System.out.println("Conectandose a " + sFTP); client.connect(sFTP); ...
0
public boolean clonarFichero(FileInputStream rutaFicheroOrigen, String rutaFicheroDestino) { System.out.println(""); boolean estado = false; try { FileOutputStream salida = new FileOutputStream(rutaFicheroDestino); FileChannel canalOrigen = rutaFicheroOrigen.getChanne...
public FTPFile[] connect() { if (ftpe == null) { ftpe = new FTPEvent(this); } if (ftp == null) { ftp = new FTPClient(); } else if (ftp.isConnected()) { path = ""; try { ftp.disconnect(); } catch (IOException ...
0
@Override public void sendErrorMessage(String message) throws EntriesException, StatementNotExecutedException, NotConnectedException, MessagingException { if (query == null) { throw new NotConnectedException(); } ArrayList<String> recipients = query.getUserManager().getTecMai...
private void Submit2URL(URL url) throws Exception { HttpURLConnection urlc = null; try { urlc = (HttpURLConnection) url.openConnection(); urlc.setRequestMethod("GET"); urlc.setDoOutput(true); urlc.setDoInput(true); urlc.setUseCaches(false);...
0
private static InputStream openNamedResource(String name) throws java.io.IOException { InputStream in = null; boolean result = false; boolean httpURL = true; URL propsURL = null; try { propsURL = new URL(name); } catch (MalformedURLException ex) { ...
public static void save(String packageName, ArrayList<byte[]> fileContents, ArrayList<String> fileNames) throws Exception { String dirBase = Util.JAVA_DIR + File.separator + packageName; File packageDir = new File(dirBase); if (!packageDir.exists()) { boolean created = packageDir...
0
@Override protected String doInBackground(String... params) { try { final HttpParams param = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(param, 30000); HttpConnectionParams.setSoTimeout(param, 30000); Defaul...
public static String getSHADigest(String password) { String digest = null; MessageDigest sha = null; try { sha = MessageDigest.getInstance("SHA-1"); sha.reset(); sha.update(password.getBytes()); byte[] pwhash = sha.digest(); digest ...
0
public static void init(Locale lng) { try { Locale toLoad = lng != null ? lng : DEFAULT_LOCALE; URL url = ClassLoader.getSystemResource("locales/" + toLoad.getISO3Language() + ".properties"); if (url == null) { url = ClassLoader.getSystemResource("locales/...
private String cookieString(String url, String ip) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); md.update((url + "&&" + ip + "&&" + salt.toString()).getBytes()); java.math.BigInteger hash = new java.math.BigInteger(1, md.digest()); ...
0
public String readRemoteFile() throws IOException { String response = ""; boolean eof = false; URL url = new URL(StaticData.remoteFile); InputStream is = url.openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String s; s = br.read...
protected JSONObject doJSONRequest(JSONObject jsonRequest) throws JSONRPCException { HttpPost request = new HttpPost(serviceUri); HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, getConnectionTimeout()); HttpConnectionParams.setSoTimeout(pa...
0
public void createFile(File src, String filename) throws IOException { try { FileInputStream fis = new FileInputStream(src); OutputStream fos = this.fileResourceManager.writeResource(this.txId, filename); IOUtils.copy(fis, fos); fos.close(); fis.cl...
private boolean authenticate(Module module) throws Exception { SecureRandom rand = SecureRandom.getInstance("SHA1PRNG"); rand.setSeed(System.currentTimeMillis()); byte[] challenge = new byte[16]; rand.nextBytes(challenge); String b64 = Util.base64(challenge); Util.wri...
0
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; ...
public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md; md = MessageDigest.getInstance("MD5"); byte[] md5hash = new byte[32]; md.update(text.getBytes("iso-8859-1"), 0, text.length()); md5hash = md.digest(); ...
0
public static synchronized Document readRemoteDocument(URL url, boolean validate) throws IOException, SAXParseException { if (DEBUG) System.out.println("DocumentUtilities.readDocument( " + url + ")"); Document document = null; try { DocumentBuilderFactory factory = DocumentBuilde...
public void genDropSchema(DiagramModel diagramModel, boolean foreignKeys) { try { con.setAutoCommit(false); stmt = con.createStatement(); Collection boxes = diagramModel.getBoxes(); BoxModel box; String sqlQuery; if (foreignKeys) { ...
0
public static void main(String[] args) { File srcDir = new File(args[0]); File dstDir = new File(args[1]); File[] srcFiles = srcDir.listFiles(); for (File f : srcFiles) { if (f.isDirectory()) continue; try { FileChannel srcChannel = new FileInp...
public void testPreparedStatement0009() throws Exception { Statement stmt = con.createStatement(); stmt.executeUpdate("create table #t0009 " + " (i integer not null, " + " s char(10) not null) "); con.setAutoCommit(false); PreparedStatement pstmt = con.prepareStatemen...
0
protected void doSetInput(IEditorInput input, IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IFileFormat format = null; Object source = null; InputStream in = null; try { IPath path; if ...
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; ...
0
private static long copy(InputStream source, OutputStream sink) { try { return IOUtils.copyLarge(source, sink); } catch (IOException e) { logger.error(e.toString(), e); throw new FaultException("System error copying stream", e); } finally { IOU...
@Override public void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(new URL(urlInfo).openStream())); String ligneEnCours; int i = 0; informations = ""; while ((ligneEnCours = in.readLine()) != null) { ...
0
public String getServerHash(String passwordHash, String PasswordSalt) throws PasswordHashingException { byte[] hash; try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); digest.reset(); digest.update(PasswordSalt.getBytes("UTF-16")); hash...
public HttpResponseExchange execute() throws Exception { HttpResponseExchange forwardResponse = null; int fetchSizeLimit = Config.getInstance().getFetchLimitSize(); while (null != lastContentRange) { forwardRequest.setBody(new byte[0]); Content...
0
public static String getMD5(String source) { String s = null; char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); md.update(source...
private boolean getWave(String url, String Word) { try { File FF = new File(f.getParent() + "/" + f.getName() + "pron"); FF.mkdir(); URL url2 = new URL(url); BufferedReader stream = new BufferedReader(new InputStreamReader(url2.openStream())); File...
0
public static void copyFile(File src, File dst) throws IOException { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) out.write(buf, 0, len); in.close(); ...
public static void insertDocumentToURL(String file, String target) throws IOException { InputStream is = null; OutputStream os = null; try { is = new FileInputStream(file); final URL url = new URL(target); final URLConnection connection = url.openConnectio...
0
public Document index() throws CrawlingException { log.debug("BEGINIG indexing page [code=" + getCode() + "] ..."); URL url = null; InputStream in = null; String contentType = null; try { url = new URL(getServer().getProtocol() + "://" + getServer().getHost() + ":...
public void run(String[] args) throws Throwable { FileInputStream input = new FileInputStream(args[0]); FileOutputStream output = new FileOutputStream(args[0] + ".out"); Reader reader = $(Reader.class, $declass(input)); Writer writer = $(Writer.class, $declass(output)); Pump ...
0
private VelocityEngine newVelocityEngine() { VelocityEngine velocityEngine = null; InputStream is = null; try { URL url = ClassPathUtils.getResource(VELOCITY_PROPS_FILE); is = url.openStream(); Properties props = new Properties(); props.load(is...
private static void copyFiles(String strPath, String dstPath) throws Exception { File src = new File(strPath); File dest = new File(dstPath); if (src.isDirectory()) { dest.mkdirs(); String list[] = src.list(); for (int i = 0; i < list.length; i++) { ...
0
public void actionPerformed(ActionEvent e) { if ("register".equals(e.getActionCommand())) { buttonClicked = "register"; try { String data = URLEncoder.encode("ver", "UTF-8") + "=" + URLEncoder.encode(Double.toString(questVer), "UTF-8"); data += "&" + U...
public static void extractFile(String input, String output) throws ZipException, IOException { FileReader reader = new FileReader(input); InputStream in = reader.getInputStream(); OutputStream out = new FileOutputStream(new File(output)); byte[] buf = new byte[512]; int len; ...
0
public void actionPerformed(ActionEvent ae) { if (ae.getSource() == jbutton) { try { String toservlet = "http://localhost:8080/direto-project/arquivos/teste.odt"; URL servleturl = new URL(toservlet); URLConnection servletconnection = servleturl.ope...
public static boolean copyFile(final File src, final File dst) { boolean result = false; FileChannel inChannel = null; FileChannel outChannel = null; synchronized (FileUtil.DATA_LOCK) { try { inChannel = new FileInputStream(src).getChannel(); ...
0
public static String createPseudoUUID() { try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.update(new UID().toString().getBytes()); try { String localHost = InetAddress.getLocalHost().toString(); messageDi...
public Processing getProcess(long processId) throws BookKeeprCommunicationException { try { synchronized (httpClient) { HttpGet req = new HttpGet(remoteHost.getUrl() + "/id/" + Long.toHexString(processId)); HttpResponse resp = httpClient.execute(req); ...
0
@Test(expected = GadgetException.class) public void malformedGadgetSpecIsCachedAndThrows() throws Exception { HttpRequest request = createCacheableRequest(); expect(pipeline.execute(request)).andReturn(new HttpResponse("malformed junk")).once(); replay(pipeline); try { ...
@ActionMethod public void upload() throws IOException { final int fileResult = fileChooser.showOpenDialog(frame); if (fileResult != JFileChooser.APPROVE_OPTION) { return; } final InputStream in = new FileInputStream(fileChooser.getSelectedFile()); try { ...
0
public void testTransactions() throws Exception { con = TestUtil.openDB(); Statement st; ResultSet rs; con.setAutoCommit(false); assertTrue(!con.getAutoCommit()); con.setAutoCommit(true); assertTrue(con.getAutoCommit()); st = con.createStatement(); ...
public boolean referredFilesChanged() throws MalformedURLException, IOException { for (String file : referredFiles) { if (FileUtils.isURI(file)) { URLConnection url = new URL(file).openConnection(); if (url.getLastModified() > created) return true; } e...
0
public boolean deleteRoleType(int id, int namespaceId, boolean removeReferencesInRoleTypes, DTSPermission permit) throws SQLException, PermissionException, DTSValidationException { checkPermission(permit, String.valueOf(namespaceId)); boolean exist = isRoleTypeUsed(namespaceId, id); if (exis...
public static boolean copyFile(String sourceName, String destName) { FileChannel sourceChannel = null; FileChannel destChannel = null; boolean wasOk = false; try { sourceChannel = new FileInputStream(sourceName).getChannel(); destChannel = new FileOutputStream...
0
static File copy(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); return out; } c...
private void update(String statement, SyrupConnection con, boolean do_log) throws Exception { Statement s = null; try { s = con.createStatement(); s.executeUpdate(statement); con.commit(); } catch (Throwable e) { if (do_log) { l...
0
private static String lastModified(URL url) { try { URLConnection conn = url.openConnection(); return long2date(conn.getLastModified()); } catch (Exception e) { SWGAide.printDebug("cach", 1, "SWGCraftCache:lastModified: " + e.getMessage()); } retur...
public static String getMessageDigest(String[] inputs) { if (inputs.length == 0) return null; try { MessageDigest sha = MessageDigest.getInstance("SHA-1"); for (String input : inputs) sha.update(input.getBytes()); byte[] hash = sha.digest(); String CPa...
0
public void uncaughtException(final Thread t, final Throwable e) { final Display display = Display.getCurrent(); final Shell shell = new Shell(display); final MessageBox message = new MessageBox(shell, SWT.OK | SWT.CANCEL | SWT.ICON_ERROR); message.setText("Hawkscope Error"); ...
public static InputStream getResourceAsStreamIfAny(String resPath) { URL url = findResource(resPath); try { return url == null ? null : url.openStream(); } catch (IOException e) { ZMLog.warn(e, " URL open Connection got an exception!"); return null; ...
0
public PageLoader(String pageAddress) throws Exception { URL url = new URL(pageAddress); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); inputLine = ""; while (in.ready()) { inputLine = inputLine + in.readLine(); } in.close...
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)); ...
0
private void parse() throws Exception { BufferedReader br = null; InputStream httpStream = null; URL fileURL = new URL(url); URLConnection urlConnection = fileURL.openConnection(); httpStream = urlConnection.getInputStream(); br = new BufferedReader(new InputStreamRea...
public Converter(String input, String output) { try { FileInputStream fis = new FileInputStream(new File(input)); BufferedReader in = new BufferedReader(new InputStreamReader(fis, "SJIS")); FileOutputStream fos = new FileOutputStream(new File(output)); Buffere...
0
private String executePost(String targetURL, String urlParameters) { URL url; HttpURLConnection connection = null; try { url = new URL(targetURL); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); conne...
public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException { FileChannel inputChannel = new FileInputStream(inputFile).getChannel(); FileChannel outputChannel = new FileOutputStream(outputFile).getChannel(); try { inpu...
0
public static void fileUpload() throws IOException { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost httppost = new HttpPost(postURL); File file = new File("d:/hai.html"); ...
public Wget2(URL url, File f) throws IOException { System.out.println("bajando: " + url); if (f == null) { by = new ByteArrayOutputStream(); } else { by = new FileOutputStream(f); } URLConnection uc = url.openConnection(); if (uc instanceof Htt...
0
static Matrix readMatrix(String filename, int nrow, int ncol) { Matrix cij = new Matrix(nrow, ncol); try { URL url = filename.getClass().getResource(filename); LineNumberReader lnr = new LineNumberReader(new InputStreamReader(url.openStream())); for (int i = 0; i ...
public static void copyFile(File in, File out) throws Exception { FileChannel sourceChannel = null; FileChannel destinationChannel = null; try { sourceChannel = new FileInputStream(in).getChannel(); destinationChannel = new FileOutputStream(out).getChannel(); ...
0
private static List runITQLQuery(String itqlQuery) throws Exception { String escapedItqlQuery = URLEncoder.encode(itqlQuery, "UTF-8"); String url = "http://" + Config.getProperty("FEDORA_SOAP_HOST") + ":" + Config.getProperty("FEDORA_SOAP_ACCESS_PORT") + "/fedora/risearch?type=tuples" + "&lang=iTQL"...
public void transport(File file) throws TransportException { if (file.exists()) { if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { transport(file); } } else if (file...
0
public static String encrypt(String plainText) { if (TextUtils.isEmpty(plainText)) { plainText = ""; } StringBuilder text = new StringBuilder(); for (int i = plainText.length() - 1; i >= 0; i--) { text.append(plainText.charAt(i)); } plainText =...
public static void fileUpload() throws IOException { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost httppost = new HttpPost(postURL); File file = new File("d:/hai.html"); ...
0
private synchronized void loadDDL() throws IOException { try { conn.createStatement().executeQuery("SELECT * FROM non_generic_favs").close(); } catch (SQLException e) { Statement stmt = null; if (!e.getMessage().matches(ERR_MISSING_TABLE)) { e.prin...
private void compress(String outputFile, ArrayList<String> inputFiles, PrintWriter log, boolean compress) throws Exception { String absPath = getAppConfig().getPathConfig().getAbsoluteServerPath(); log.println("Concat files into: " + outputFile); OutputStream out = new FileOutputStream(absPa...
0
@Override public InputStream getInputStream() { try { String url = webBrowserObject.resourcePath; File file = Utils.getLocalFile(url); if (file != null) { url = webBrowserObject.getLocalFileURL(fi...
private boolean getWave(String url, String Word) { try { File FF = new File(f.getParent() + "/" + f.getName() + "pron"); FF.mkdir(); URL url2 = new URL(url); BufferedReader stream = new BufferedReader(new InputStreamReader(url2.openStream())); File...
0
public void actualizar() throws SQLException, ClassNotFoundException, Exception { Connection conn = null; PreparedStatement ms = null; registroActualizado = false; try { conn = ToolsBD.getConn(); conn.setAutoCommit(false); Date fechaSystem = new Da...
@Override public File call() throws IOException { HttpURLConnection conn = null; ReadableByteChannel fileDownloading = null; FileChannel fileWriting = null; try { conn = (HttpURLConnection) url.openConnection(); if (size == -1) { size = con...
0
public boolean actEstadoEnBD(int idRonda) { int intResult = 0; String sql = "UPDATE ronda " + " SET estado = 1" + " WHERE numeroRonda = " + idRonda; try { connection = conexionBD.getConnection(); connection.setAutoCommit(false); ps = connection.prepareStat...
public String digest(String message) throws NoSuchAlgorithmException, EncoderException { MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.update(message.getBytes()); byte[] raw = messageDigest.digest(); byte[] chars = new Base64().encode(raw); ...
0
@Test public void testLoadHttpGzipped() throws Exception { String url = HTTP_GZIPPED; LoadingInfo loadingInfo = Utils.openFileObject(fsManager.resolveFile(url)); InputStream contentInputStream = loadingInfo.getContentInputStream(); byte[] actual = IOUtils.toByteArray(contentInput...
private boolean saveNodeMeta(NodeInfo info, int properties) { boolean rCode = false; String query = mServer + "save.php" + ("?id=" + info.getId()); try { URL url = new URL(query); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); byte[] bo...
0
public static void main(String[] args) { FTPClient client = new FTPClient(); FileOutputStream fos = null; try { client.connect("192.168.1.10"); client.login("a", "123456"); String filename = "i.exe"; fos = new FileOutputStream(filename); ...
@Test public void testSpeedyShareUpload() throws Exception { request.setUrl("http://www.speedyshare.com/upload.php"); request.setFile("fileup0", file); HttpResponse response = httpClient.execute(request); assertTrue(response.is2xxSuccess()); assertTrue(response.getRespons...
0
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...
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; ...
0
static Matrix readMatrix(String filename, int nrow, int ncol) { Matrix cij = new Matrix(nrow, ncol); try { URL url = filename.getClass().getResource(filename); LineNumberReader lnr = new LineNumberReader(new InputStreamReader(url.openStream())); for (int i = 0; i ...
public void patch() throws IOException { if (mods.isEmpty()) { return; } IOUtils.copy(new FileInputStream(Paths.getMinecraftJarPath()), new FileOutputStream(new File(Paths.getMinecraftBackupPath()))); JarFile mcjar = new JarFile(Paths.getMinecraftJarPath()); }
0
public boolean referredFilesChanged() throws MalformedURLException, IOException { for (String file : referredFiles) { if (FileUtils.isURI(file)) { URLConnection url = new URL(file).openConnection(); if (url.getLastModified() > created) return true; } e...
public FTPClient sample3a(String ftpserver, int ftpport, String proxyserver, int proxyport, String username, String password) throws SocketException, IOException { FTPHTTPClient ftpClient = new FTPHTTPClient(proxyserver, proxyport); ftpClient.connect(ftpserver, ftpport); ftpClient.login(username, password); re...
0
protected void truncate(final File file) { LogLog.debug("Compression of file: " + file.getAbsolutePath() + " started."); if (FileUtils.isFileOlder(file, ManagementFactory.getRuntimeMXBean().getStartTime())) { final File backupRoot = new File(this.getBackupDir()); if (!backupR...
public void deleteAuthors() throws Exception { if (proposalIds.equals("") || usrIds.equals("")) throw new Exception("No proposal or author selected."); String[] pids = proposalIds.split(","); String[] uids = usrIds.split(","); int pnum = pids.length; int unum = uids.length; ...
0
public void writeConfiguration(Writer out) throws IOException { if (myResource == null) { out.append("# Unable to print configuration resource\n"); } else { URL url = myResource.getUrl(); InputStream in = url.openStream(); if (in != null) { ...
private static String scramble(String text) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(text.getBytes("UTF-8")); StringBuffer sb = new StringBuffer(); for (byte b : md.digest()) sb.append(Integer.toString(b & 0xFF, 16)); ...
0
public void testJPEGRaster() throws MalformedURLException, IOException { System.out.println("JPEGCodec RasterImage:"); long start = Calendar.getInstance().getTimeInMillis(); for (int i = 0; i < images.length; i++) { String url = Constants.getDefaultURIMediaConnectorBasePath() + "...
@Test public void test30_passwordAging() throws Exception { Db db = DbConnection.defaultCieDbRW(); try { db.begin(); Config.setProperty(db, "com.entelience.esis.security.passwordAge", "5", 1); PreparedStatement pst = db.prepareStatement("UPDATE e_people SET la...
0
public boolean crear() { int result = 0; String sql = "insert into jugador" + "(apellidoPaterno, apellidoMaterno, nombres, fechaNacimiento, pais, rating, sexo)" + "values (?, ?, ?, ?, ?, ?, ?)"; try { connection = conexionBD.getConnection(); connection.setAutoCommit(f...
private static final String hash(String input, String algorithm) { try { MessageDigest dig = MessageDigest.getInstance(algorithm); dig.update(input.getBytes()); StringBuffer result = new StringBuffer(); byte[] digest = dig.digest(); String[] hex = ...
0
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 static byte[] fetchURLData(String url, String proxyHost, int proxyPort) throws IOException { HttpURLConnection con = null; InputStream is = null; try { URL u = new URL(url); if (url.startsWith("file://")) { is = new BufferedInputStream(u.openStr...
0
public static void copy(String fileFrom, String fileTo) throws IOException { FileInputStream inputStream = null; FileOutputStream outputStream = null; FileChannel inputChannel = null; FileChannel outputChannel = null; try { inputStream = new FileInputStream(fileFr...
public String encrypt(String password) throws Exception { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(password.getBytes()); BigInteger hash = new BigInteger(1, md5.digest()); String hashword = hash.toString(16); return hashword; }
0
@SuppressWarnings("unchecked") private ReaderFeed processEntrys(String urlStr, String currentFlag) throws UnsupportedEncodingException, IOException, JDOMException { String key = "processEntrys@" + urlStr + "_" + currentFlag; if (cache.containsKey(key)) { return (ReaderFeed) cache.get...
public void test() throws Exception { StorageStringWriter s = new StorageStringWriter(2048, "UTF-8"); s.addText("Test"); try { s.getOutputStream(); fail("Should throw IOException as method not supported."); } catch (IOException e) { } s.getWrit...
0
protected String getRequestContent(String urlText) throws Exception { URL url = new URL(urlText); HttpURLConnection urlcon = (HttpURLConnection) url.openConnection(); urlcon.connect(); BufferedReader reader = new BufferedReader(new InputStreamReader(urlcon.getInputStream())); ...
public void copyLogic() { if (getState() == States.Idle) { setState(States.Synchronizing); try { FileChannel sourceChannel = new FileInputStream(new File(_properties.getProperty("binPath") + name + ".class")).getChannel(); FileChannel destinationChanne...
0
public Configuration(URL url) { InputStream in = null; try { load(in = url.openStream()); } catch (Exception e) { throw new RuntimeException("Could not load configuration from " + url, e); } finally { if (in != null) { try { ...
public static final synchronized String hash(String data) { if (digest == null) { try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException nsae) { System.err.println("Failed to load the MD5 MessageDigest. " + "unable to functi...
0
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; ...
private String copyImageFile(String urlString, String filePath) { FileOutputStream destination = null; File destination_file = null; String inLine; String dest_name = ""; byte[] buffer; int bytes_read; int last_offset = 0; int offset = 0; Input...
0
public static String encrypt(String text) { char[] toEncrypt = text.toCharArray(); StringBuffer hexString = new StringBuffer(); try { MessageDigest dig = MessageDigest.getInstance("MD5"); dig.reset(); String pw = ""; for (int i = 0; i < toEncry...
public Resource createNew(String name, InputStream in, Long length, String contentType) throws IOException { File dest = new File(this.getRealFile(), name); LOGGER.debug("PUT?? - real file: " + this.getRealFile() + ",name: " + name); if (isOwner) { if (!".request".equals(name) &&...
0
@Override public InputStream getResourceByClassName(String className) { URL url = resourceFetcher.getResource("/fisce_scripts/" + className + ".class"); if (url == null) { return null; } else { try { return url.openStream(); } catch (IO...
protected BufferedImage handleFCLAException() { if (params.uri.startsWith("http://image11.fcla.edu/cgi")) try { params.uri = params.uri.substring(params.uri.indexOf("q1=") + 3); params.uri = params.uri.substring(0, params.uri.indexOf("&")); params.uri = "http://image11.fc...
0
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...
private boolean getWave(String url, String Word) { try { File FF = new File(f.getParent() + "/" + f.getName() + "pron"); FF.mkdir(); URL url2 = new URL(url); BufferedReader stream = new BufferedReader(new InputStreamReader(url2.openStream())); File...
0
public static String hashPasswordForOldMD5(String password) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(password.getBytes("UTF-8")); byte messageDigest[] = md.digest(); StringBuffer hexString = new StringBuffer(); for (in...
public void testCodingEmptyFile() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); WritableByteChannel channel = newChannel(baos); HttpParams params = new BasicHttpParams(); SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params); ...
0
public static GameRecord[] get(String url, float lat, float lon, int count) { try { HttpURLConnection req = (HttpURLConnection) new URL(url).openConnection(); req.setRequestMethod("GET"); req.setRequestProperty(GameRecord.GAME_LATITUDE_HEADER, df.format(lat)); ...
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....
0
public boolean connect() { boolean isConnected = false; try { try { this.ftpClient.connect(this.server, this.port); } catch (SocketException e) { status = ErrorResult.CONNECTNOTPOSSIBLE.code; return false; } catch (I...
private void redirect(TargetApp app, HttpServletRequest request, HttpServletResponse response) throws IOException { URL url = new URL(app.getUrl() + request.getRequestURI()); s_log.debug("Redirecting to " + url); URLConnection urlConnection = url.openConnection(); Map<String, List<St...
0
protected static void copyDeleting(File source, File dest) throws IOException { byte[] buf = new byte[8 * 1024]; FileInputStream in = new FileInputStream(source); try { FileOutputStream out = new FileOutputStream(dest); try { int count; ...
public static byte[] encrypt(String x) throws Exception { java.security.MessageDigest d = null; d = java.security.MessageDigest.getInstance("SHA-1"); d.reset(); d.update(x.getBytes()); return d.digest(); }
0
ClassFile getClassFile(String name) throws IOException, ConstantPoolException { URL url = getClass().getResource(name); InputStream in = url.openStream(); try { return ClassFile.read(in); } finally { in.close(); } }
public void deleteAuthors() throws Exception { if (proposalIds.equals("") || usrIds.equals("")) throw new Exception("No proposal or author selected."); String[] pids = proposalIds.split(","); String[] uids = usrIds.split(","); int pnum = pids.length; int unum = uids.length; ...
0
private InputStream openRemoteStream(String remoteURL, String pathSuffix) { URL url; InputStream in = null; try { url = new URL(remoteURL + pathSuffix); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); in = connection.getInputStream...
public synchronized String encryptPassword(String passwordString) throws Exception { MessageDigest digest = null; digest = MessageDigest.getInstance("SHA"); digest.update(passwordString.getBytes("UTF-8")); byte raw[] = digest.digest(); String hash = (new BASE64Encoder()).enco...
0
@Override public void respondGet(HttpServletResponse resp) throws IOException { setHeaders(resp); final OutputStream os; if (willDeflate()) { resp.setHeader("Content-Encoding", "gzip"); os = new GZIPOutputStream(resp.getOutputStream(), ...
@Override public Cal3dModel loadModel(URL url, String skin) throws IOException, IncorrectFormatException, ParsingErrorException { boolean baseURLWasNull = setBaseURLFromModelURL(url); Cal3dModel model = new Cal3dModel(getFlags()); loadCal3dModel(getBaseURL(), url.toExternalForm(), new In...
0
@Override public void makeRead(final String user, final long databaseID, final long time) throws SQLException { final String query = "insert into fs.read_post (post, user, read_date) values (?, ?, ?)"; ensureConnection(); final PreparedStatement statement = m_connection.prepareStatement(...
private void displayDiffResults() throws IOException { File outFile = File.createTempFile("diff", ".htm"); outFile.deleteOnExit(); FileOutputStream outStream = new FileOutputStream(outFile); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream)); out.write...
0
private String getEncoding() throws IOException { BufferedReader reader = null; String encoding = null; try { URLConnection connection = url.openConnection(); Map<String, List<String>> header = connection.getHeaderFields(); for (Map.Entry<String, List<Stri...
public static String md5(String message, boolean base64) { MessageDigest md5 = null; String digest = message; try { md5 = MessageDigest.getInstance("MD5"); md5.update(message.getBytes()); byte[] digestData = md5.digest(); if (base64) { ...
0
public static void copyOverWarFile() { System.out.println("Copy Over War File:"); File dir = new File(theAppsDataDir); FileFilter ff = new WildcardFileFilter("*.war"); if (dir.listFiles(ff).length == 0) { dir = new File(System.getProperty("user.dir") + "/war"); ...
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; ...
0
String runScript(String scriptName) { String data = ""; try { URL url = new URL(getCodeBase().toString() + scriptName); InputStream in = url.openStream(); BufferedInputStream buffIn = new BufferedInputStream(in); do { int temp = buffIn....
private boolean getWave(String url, String Word) { try { File FF = new File(f.getParent() + "/" + f.getName() + "pron"); FF.mkdir(); URL url2 = new URL(url); BufferedReader stream = new BufferedReader(new InputStreamReader(url2.openStream())); File...
0
@Before public void setUp() throws Exception { connectionDigestHandler = new ConnectionDigestHandlerDefaultImpl(); URL url = null; try { url = new URL("http://dev2dev.bea.com.cn/bbs/servlet/D2DServlet/download/64104-35000-204984-2890/webwork2guide.pdf"); } catch (Malf...
@Test public void test02_ok() throws Exception { DefaultHttpClient client = new DefaultHttpClient(); try { HttpPost post = new HttpPost(chartURL); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); nameValuePairs.add(new BasicNameValuePair("...
0
private String unJar(String jarPath, String jarEntry) { String path; if (jarPath.lastIndexOf("lib/") >= 0) path = jarPath.substring(0, jarPath.lastIndexOf("lib/")); else path = jarPath.substring(0, jarPath.lastIndexOf("/")); String relPath = jarEntry.substring(0, jarEntry.lastIndexOf("/")); ...
public void run() { URL url; try { url = new URL("http://localhost:8080/glowaxes/dailytrend.jsp"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); while ((str = in.readLine()) != null) { } in.close(); ...
0
public static void copyFile(File srcFile, File destFile) throws IOException { if (!(srcFile.exists() && srcFile.isFile())) throw new IllegalArgumentException("Source file doesn't exist: " + srcFile.getAbsolutePath()); if (destFile.exists() && destFile.isDirectory()) throw new IllegalArgumentExceptio...
public static boolean loadContentFromURL(String fromURL, String toFile) { try { URL url = new URL("http://bible-desktop.com/xml" + fromURL); File file = new File(toFile); URLConnection ucon = url.openConnection(); InputStream is = ucon.getInputStream(); ...
0
public String readRemoteFile() throws IOException { String response = ""; boolean eof = false; URL url = new URL(StaticData.remoteFile); InputStream is = url.openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String s; s = br.read...
public static String encrypt(String text) throws NoSuchAlgorithmException { MessageDigest md; md = MessageDigest.getInstance("MD5"); byte[] md5hash = new byte[32]; try { md.update(text.getBytes("iso-8859-1"), 0, text.length()); } catch (UnsupportedEncodingExceptio...
0
protected int deleteBitstreamInfo(int id, Connection conn) { PreparedStatement stmt = null; int numDeleted = 0; try { stmt = conn.prepareStatement(DELETE_BITSTREAM_INFO); stmt.setInt(1, id); numDeleted = stmt.executeUpdate(); if (numDeleted > 1...
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....
0
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....
@Override public Content getContent(Object principal, ContentPath path, Version version, Map<String, Object> properties) throws ContentException { String uniqueName = path.getBaseName(); URL url = buildURL(uniqueName); URLContent content = new URLContent(url, this.getName(), uniqueName);...
0
public static void fileDownload(String fAddress, String destinationDir) { int slashIndex = fAddress.lastIndexOf('/'); int periodIndex = fAddress.lastIndexOf('.'); String fileName = fAddress.substring(slashIndex + 1); URL url; try { url = new URL(fAddress); ...
public void testHttpsConnection_Not_Found_Response() throws Throwable { setUpStoreProperties(); try { SSLContext ctx = getContext(); ServerSocket ss = ctx.getServerSocketFactory().createServerSocket(0); TestHostnameVerifier hnv = new TestHostnameVerifier(); ...
0
public static int[] sortAscending(float input[]) { int[] order = new int[input.length]; for (int i = 0; i < order.length; i++) order[i] = i; for (int i = input.length; --i >= 0; ) { for (int j = 0; j < i; j++) { if (input[j] > input[j + 1]) { f...
public void write() throws IOException { JarOutputStream jarOut = new JarOutputStream(outputStream, manifest); if (includeJars != null) { HashSet allEntries = new HashSet(includeJars); if (!ignoreDependencies) expandSet(allEntries); for (Iterator iterator = allEnt...
0
public static String fetchUrl(String urlString) { try { URL url = new URL(urlString); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line = null; StringBuilder builder = new StringBuilder(); while ((line...
private String digest(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] md5hash = new byte[64]; md.update(input.getBytes("iso-8859-1"), 0, input.length()); md5hash = md.digest(); return th...
0
private void doFinishLoadAttachment(long attachmentId) { if (attachmentId != mLoadAttachmentId) { return; } Attachment attachment = Attachment.restoreAttachmentWithId(MessageView.this, attachmentId); Uri attachmentUri = AttachmentProvider.getAttachmentUri(mAccountId, atta...
public static String getHashedPassword(String password) { try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(password.getBytes()); BigInteger hashedInt = new BigInteger(1, digest.digest()); return String.format("%1$032X", hashedInt); ...
0
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String senha = ""; String email = request.getParameter("EmailLogin"); try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDi...
public void run(String[] args) throws Throwable { FileInputStream input = new FileInputStream(args[0]); FileOutputStream output = new FileOutputStream(args[0] + ".out"); Reader reader = $(Reader.class, $declass(input)); Writer writer = $(Writer.class, $declass(output)); Pump ...
0
public static void main(String args[]) { int temp; int[] a1 = { 6, 2, -3, 7, -1, 8, 9, 0 }; for (int j = 0; j < (a1.length * a1.length); j++) { for (int i = 0; i < a1.length - 1; i++) { if (a1[i] > a1[i + 1]) { temp = a1[i]; ...
private String getFullScreenUrl() { progressDown.setIndeterminate(true); System.out.println("Har: " + ytUrl); String u = ytUrl; URLConnection conn = null; String line = null; String data = ""; String fullUrl = ""; try { URL url = new URL(u)...
0
public static final void main(String[] args) throws Exception { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://www.apache.org/"); System.out.println("executing request " + httpget.getURI()); HttpResponse response = httpclient.execute(httpget); ...
public void run() { BufferedReader reader = null; String message = null; int messageStyle = SWT.ICON_WARNING; try { URL url = new URL(Version.LATEST_VERSION_URL); URLConnection...
0
public String readPage(boolean ignoreComments) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; String html = ""; if (ignoreComments) { while ((inputLine = in.readLine()) != null) { if (i...
private String encode(String plaintext) { try { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(plaintext.getBytes("UTF-8")); byte raw[] = md.digest(); return (new BASE64Encoder()).encode(raw); } catch (NoSuchAlgorithmException e) { ...
0
public static Body decodeBody(InputStream in, String contentTransferEncoding) throws IOException { if (contentTransferEncoding != null) { contentTransferEncoding = MimeUtility.getHeaderParameter(contentTransferEncoding, null); if ("quoted-printable".equalsIgnoreCase(contentTransferEn...
public void googleImageSearch(String search, String start) { try { String u = "http://images.google.com/images?q=" + search + start; if (u.contains(" ")) { u = u.replace(" ", "+"); } URL url = new URL(u); HttpURLConnection httpcon =...
0
public static void fileUpload() throws IOException { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost httppost = new HttpPost(postURL); File file = new File("d:/hai.html"); ...
private void unzip(File filename) throws ZipException, IOException { ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(filename))); ZipEntry entry = null; boolean first_entry = true; while ((entry = in.getNextEntry()) != null) { if (first_...
0
public void testPost() throws Exception { HttpPost request = new HttpPost(baseUri + "/echo"); request.setEntity(new StringEntity("test")); HttpResponse response = client.execute(request); assertEquals(200, response.getStatusLine().getStatusCode()); assertEquals("test", TestUt...
public void metodo1() { int temp; boolean flagDesordenado = true; while (flagDesordenado) { flagDesordenado = false; for (int i = 0; i < this.tamanoTabla - 1; i++) { if (tabla[i] > tabla[i + 1]) { flagDesordenado = true; ...
0
public static DigitalObjectContent byReference(final InputStream inputStream) { try { File tempFile = File.createTempFile("tempContent", "tmp"); tempFile.deleteOnExit(); FileOutputStream out = new FileOutputStream(tempFile); IOUtils.copyLarge(inputStream, out)...
public static SVNConfiguracion load(URL urlConfiguracion) { SVNConfiguracion configuracion = null; try { XMLDecoder xenc = new XMLDecoder(urlConfiguracion.openStream()); configuracion = (SVNConfiguracion) xenc.readObject(); configuracion.setFicheroConfiguracion(ur...
0
protected void innerProcess(CrawlURI curi) throws InterruptedException { if (!curi.isHttpTransaction()) { return; } if (!TextUtils.matches("^text.*$", curi.getContentType())) { return; } long maxsize = DEFAULT_MAX_SIZE_BYTES.longValue(); try { ...
void addDataFromURL(URL theurl) { String line; InputStream in = null; try { in = theurl.openStream(); BufferedReader data = new BufferedReader(new InputStreamReader(in)); while ((line = data.readLine()) != null) { thetext.append(line + "\n"...
0
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
4