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 |
|---|---|---|---|---|---|
800 | 13,312,539 | 27,715 | private void executeScript(SQLiteDatabase sqlDatabase, InputStream input) {
StringWriter writer = new StringWriter();
try {
IOUtils.copy(input, writer);
} catch (IOException e) {
throw new ComixException("Could not read the database script", e);
}
Stri... | public static void main(String[] args) {
try {
int encodeFlag = 0;
if (args[0].equals("-e")) {
encodeFlag = Base64.ENCODE;
} else if (args[0].equals("-d")) {
encodeFlag = Base64.DECODE;
}
String infile = args[1];
... | true |
801 | 10,192,341 | 11,337,538 | @SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
PositionParser pp;
Database.init("XIDResult");
pp = new PositionParser("01:33:50.904+30:39:35.79");
String url = "http://simbad.u-strasbg.fr/simbad/sim-script?submit=submit+script&script=";
... | public static String machineInfo() {
StringBuilder machineInfo = new StringBuilder();
try {
Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = (NetworkInter... | false |
802 | 2,269,290 | 15,607,084 | public final void copyFile(final File fromFile, final File toFile) throws IOException {
this.createParentPathIfNeeded(toFile);
final FileChannel sourceChannel = new FileInputStream(fromFile).getChannel();
final FileChannel targetChannel = new FileOutputStream(toFile).getChannel();
fi... | protected void copyFile(String inputFilePath, String outputFilePath) throws GenerationException {
String from = getTemplateDir() + inputFilePath;
try {
logger.debug("Copying from " + from + " to " + outputFilePath);
InputStream inputStream = Thread.currentThread().getContextC... | true |
803 | 6,371,605 | 85,619 | public void insertRealm(final List<NewRealms> newRealms) {
try {
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
@Override
public void executeProcessReturnNull()... | public void delUser(User user) throws SQLException, IOException, ClassNotFoundException {
String dbUserID;
String stockSymbol;
Statement stmt = con.createStatement();
try {
con.setAutoCommit(false);
dbUserID = user.getUserID();
if (getUser(dbUserID... | true |
804 | 2,511,576 | 20,071,852 | public void doUpdate(String version) {
try {
final String hyperlink_url = "http://xnavigator.sourceforge.net/dist/";
JFrame updateInfoFrame = null;
try {
JPanel panel = new JPanel();
panel.setLayout(null);
panel.setBackgroun... | 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 |
805 | 15,588,201 | 17,874,921 | public void copy(File source, File destination) {
try {
FileInputStream fileInputStream = new FileInputStream(source);
FileOutputStream fileOutputStream = new FileOutputStream(destination);
FileChannel inputChannel = fileInputStream.getChannel();
FileChannel o... | public static boolean buildCFItem2ItemStats(String outFileName, String movieAvgFileName, String custAvgFileName) {
try {
File infile = new File(completePath + fSep + "SmartGRAPE" + fSep + movieAvgFileName);
FileChannel inC = new FileInputStream(infile).getChannel();
int s... | true |
806 | 18,400,649 | 19,584,493 | public static void copyFiles(String strPath, String dstPath) throws IOException {
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++) {
... | @Override
public String toString() {
if (byteArrayOutputStream == null) return "<Unparsed binary data: Content-Type=" + getHeader("Content-Type") + " >";
String charsetName = getCharsetName();
if (charsetName == null) charsetName = "ISO-8859-1";
try {
if (unzip) {
... | true |
807 | 1,158,841 | 3,058,819 | public static int gzipFile(File file_input, String file_output) {
File gzip_output = new File(file_output);
GZIPOutputStream gzip_out_stream;
try {
FileOutputStream out = new FileOutputStream(gzip_output);
gzip_out_stream = new GZIPOutputStream(new BufferedOutputStrea... | public static void decryptFile(String input, String output, String pwd) throws Exception {
CipherInputStream in;
OutputStream out;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(pwd.getBytes(), "DES... | true |
808 | 6,155,833 | 23,227,325 | 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 getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
;
try {
localHost = InetAddress.getL... | true |
809 | 19,136,768 | 6,045,800 | public static void main(String[] args) {
CookieManager cm = new CookieManager();
try {
URL url = new URL("http://www.hccp.org/test/cookieTest.jsp");
URLConnection conn = url.openConnection();
conn.connect();
cm.storeCookies(conn);
System.ou... | private void announce(String trackerURL, byte[] hash, byte[] peerId, int port) {
try {
String strUrl = trackerURL + "?info_hash=" + URLEncoder.encode(new String(hash, Constants.BYTE_ENCODING), Constants.BYTE_ENCODING).replaceAll("\\+", "%20") + "&peer_id=" + URLEncoder.encode(new String(peerId, ... | false |
810 | 245,163 | 20,789,900 | @Override
public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException {
String url = request.getParameter(URL_PARAM_NAME);
if (StringUtils.isEmpty(url)) {
log.error("url parameter not provided.");
throw new DataSourceException(Re... | public void render(HttpServletRequest request, HttpServletResponse response, File file, final Throwable t, final String contentType, final String encoding) throws Exception {
if (contentType != null) {
response.setContentType(contentType);
}
if (encoding != null) {
re... | false |
811 | 21,090,885 | 22,717,352 | public static String calculateHA1(String username, byte[] password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getBytes(username, ISO_8859_1));
md.update((byte) ':');
md.update(getBytes(DAAP_REALM, ISO_8859_1));
md.updat... | public void add(AddInterceptorChain chain, Entry entry, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + "LDAPBaseServer");
if (con == null) {
throw new LDAPException("Operations Error", LDAPException.OPERAT... | false |
812 | 14,037,891 | 17,097,179 | private void transformFile(File input, File output, Cipher cipher, boolean compress, String progressMessage) throws IOException {
FileInputStream fileInputStream = new FileInputStream(input);
InputStream inputStream;
if (progressMessage != null) {
inputStream = new ProgressMonito... | 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(... | true |
813 | 21,868,018 | 6,061,402 | public void process() throws Exception {
String searchXML = FileUtils.readFileToString(new File(getSearchRequestRelativeFilePath()));
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put("searchXML", searchXML);
String proxyHost = null;
int pro... | 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.... | true |
814 | 19,782,619 | 4,162,692 | public synchronized String encrypt(String p_plainText) throws ServiceUnavailableException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new ServiceUnavailableException(e.getMessage());
}
... | private static void fileUpload() throws IOException {
HttpClient httpclient = new DefaultHttpClient();
if (login) {
postURL = "http://upload.badongo.com/mpu_upload.php";
}
HttpPost httppost = new HttpPost(postURL);
file = new File("g:/S2SClient.7z");
Multi... | false |
815 | 4,254,750 | 18,385,066 | protected static byte[] httpConnection(Context context, long token, String url, byte[] pdu, int method, boolean isProxySet, String proxyHost, int proxyPort) throws IOException {
if (url == null) {
throw new IllegalArgumentException("URL must not be null.");
}
if (LOCAL_LOGV) {
... | public static Document getResponse(HttpClient client, HttpRequestBase request) {
try {
HttpResponse response = client.execute(request);
StatusLine statusLine = response.getStatusLine();
System.err.println(statusLine.getStatusCode() + " data: " + statusLine.getReasonPhrase... | false |
816 | 6,307,954 | 5,523,389 | @Override
public List<SheetFullName> importSheets(INetxiliaSystem workbookProcessor, WorkbookId workbookName, URL url, IProcessingConsole console) throws ImportException {
try {
return importSheets(workbookProcessor, workbookName, url.openStream(), console);
} catch (IOException e) {... | public static void copy(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();
... | false |
817 | 21,461,424 | 22,608,103 | public static final void copy(String source, String destination) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
java.nio.channels.FileChannel channelSrc = fis.get... | public static boolean copyFile(File sourceFile, File destFile) {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
srcChannel = new FileInputStream(sourceFile).getChannel();
dstChannel = new FileOutputStream(destFile).getChannel();
long p... | true |
818 | 8,759,736 | 14,763,206 | public File convert(URI uri) throws DjatokaException {
processing.add(uri.toString());
File urlLocal = null;
try {
logger.info("processingRemoteURI: " + uri.toURL());
boolean isJp2 = false;
InputStream src = IOUtils.getInputStream(uri.toURL());
... | 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... | true |
819 | 3,318,214 | 21,442,625 | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | private void copyFile(String from, String to) throws Exception {
URL monitorCallShellScriptUrl = Thread.currentThread().getContextClassLoader().getResource(from);
File inScriptFile = null;
try {
inScriptFile = new File(monitorCallShellScriptUrl.toURI());
} catch (URISynta... | true |
820 | 8,969,949 | 16,556,715 | public static String getHash(String uri) throws NoSuchAlgorithmException {
MessageDigest mDigest = MessageDigest.getInstance("MD5");
mDigest.update(uri.getBytes());
byte d[] = mDigest.digest();
StringBuffer hash = new StringBuffer();
for (int i = 0; i < d.length; i++) {
... | public boolean checkPassword(String password, String digest) {
boolean passwordMatch = false;
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA-1");
if (digest.regionMatches(true, 0, "{SHA}", 0, 5)) {
digest = digest.substring(5);
... | true |
821 | 10,937,085 | 4,114,808 | public static void _he3Decode(String in_file) {
try {
File out = new File(in_file + dec_extension);
File in = new File(in_file);
int file_size = (int) in.length();
FileInputStream in_stream = new FileInputStream(in_file);
out.createNewFile();
... | public boolean copier(String source, String nomFichierSource, java.io.File destination) {
boolean resultat = false;
OutputStream tmpOut;
try {
tmpOut = new BufferedOutputStream(new FileOutputStream(nomFichierSource + "001.tmp"));
InputStream is = getClass().getResourc... | true |
822 | 6,644,756 | 20,856,551 | public void alterar(Cliente cliente) throws Exception {
Connection connection = criaConexao(false);
String sql = "update cliente set nome = ?, sexo = ?, cod_cidade = ? where cod_cliente = ?";
PreparedStatement stmt = null;
try {
stmt = connection.prepareStatement(sql);
... | public synchronized void checkout() throws SQLException, InterruptedException {
Connection con = this.session.open();
con.setAutoCommit(false);
String sql_stmt = DB2SQLStatements.shopping_cart_getAll(this.customer_id);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENS... | true |
823 | 20,023,016 | 5,667,973 | private void copy(File from, File to) throws IOException {
InputStream in = new FileInputStream(from);
OutputStream out = new FileOutputStream(to);
byte[] line = new byte[16384];
int bytes = -1;
while ((bytes = in.read(line)) != -1) out.write(line, 0, bytes);
in.close... | public static void copyClassPathResource(String classPathResourceName, String fileSystemDirectoryName) {
InputStream resourceInputStream = null;
OutputStream fileOutputStream = null;
try {
resourceInputStream = FileUtils.class.getResourceAsStream(classPathResourceName);
... | true |
824 | 16,809,623 | 23,574,721 | public boolean parseResults(URL url, String analysis_type, CurationI curation, Date analysis_date, String regexp) throws OutputMalFormatException {
boolean parsed = false;
try {
InputStream data_stream = url.openStream();
parsed = parseResults(data_stream, analysis_type, cura... | public void updateProfile() throws ClassNotFoundException, SQLException {
Connection connection = null;
PreparedStatement ps1 = null;
PreparedStatement ps2 = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(this.url)... | false |
825 | 1,858,117 | 8,352,957 | public void putChunk(String chunk) throws JacsonException {
try {
URL url = new URL(chunk);
InputStream is = url.openStream();
if (inverse) drain.putChunk(chunk);
is.close();
} catch (IOException broken) {
if (!inverse) drain.putChunk(chunk... | void IconmenuItem6_actionPerformed(ActionEvent e) {
JFileChooser jFileChooser1 = new JFileChooser();
String separator = "";
if (JFileChooser.APPROVE_OPTION == jFileChooser1.showOpenDialog(this.getFatherFrame())) {
setDefaultPath(jFileChooser1.getSelectedFile().getPath());
... | false |
826 | 13,044,936 | 9,561,059 | public List<SatelliteElementSet> parseTLE(String urlString) throws IOException {
List<SatelliteElementSet> elementSets = new ArrayList<SatelliteElementSet>();
BufferedReader reader = null;
try {
String line = null;
int i = 0;
URL url = new URL(urlString);
... | private static byte[] createHash(EHashType hashType, String string) {
MessageDigest md;
try {
md = MessageDigest.getInstance(hashType.getJavaHashType());
md.reset();
md.update(string.getBytes());
byte[] byteResult = md.digest();
return byte... | false |
827 | 1,008,325 | 22,271,237 | public long copyDirAllFilesToDirectory(String baseDirStr, String destDirStr) throws Exception {
long plussQuotaSize = 0;
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.endsWith(sep)) {
destDirStr... | public static void copy(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
... | true |
828 | 7,667 | 12,973,065 | 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... | 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);
}
... | false |
829 | 13,210,305 | 20,189,177 | public static final String encryptMD5(String decrypted) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(decrypted.getBytes());
byte hash[] = md5.digest();
md5.reset();
return hashToHex(hash);
} catch (NoSuchAlgorith... | private static void stampaFoglioRisposte(HttpSession httpSess, Appelli appello, Elaborati el, StringBuffer retVal, boolean primaVolta, String url, boolean anonimo) {
InputStream is = null;
String html = null;
final int MAX_RIGHE_PER_PAGINA = 25;
long totaleDomande = EsamiDAO.trovaQua... | false |
830 | 1,263,069 | 1,544,996 | public boolean getAuth(String content) throws IOException {
String resp_remote;
try {
URL url = new URL(remoteurl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
... | public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
lon... | false |
831 | 20,103,134 | 14,175,532 | public static String base64HashedString(String v) {
String base64HashedPassword = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(v.getBytes());
String hashedPassword = new String(md.digest());
sun.misc.BASE64Encoder enc = ne... | public String getLongToken(String md5Str) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(md5Str.getBytes(JspRunConfig.charset));
} catch (Exception e) {
e.printStackTrace();
}
StringBuffer token = toHex... | true |
832 | 5,021,577 | 85,619 | public static boolean copyDataToNewTable(EboContext p_eboctx, String srcTableName, String destTableName, String where, boolean log, int mode) throws boRuntimeException {
srcTableName = srcTableName.toUpperCase();
destTableName = destTableName.toUpperCase();
Connection cn = null;
Conn... | public void delUser(User user) throws SQLException, IOException, ClassNotFoundException {
String dbUserID;
String stockSymbol;
Statement stmt = con.createStatement();
try {
con.setAutoCommit(false);
dbUserID = user.getUserID();
if (getUser(dbUserID... | true |
833 | 1,760,351 | 12,728,214 | public static int deleteExecution(String likePatten) {
Connection conn = null;
PreparedStatement psmt = null;
StringBuffer SQL = new StringBuffer(200);
int deleted = 0;
SQL.append(" DELETE FROM JHF_EXCEPTION ").append(" WHERE ORDER_ID LIKE ? ");
try {
c... | protected GraphicalViewer createGraphicalViewer(Composite parent) {
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(parent);
viewer.getControl().setBackground(parent.getBackground());
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
Gr... | false |
834 | 22,564,546 | 763,710 | 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... | public void bubbleSort(int[] arr) {
boolean swapped = true;
int j = 0;
int tmp;
while (swapped) {
swapped = false;
j++;
for (int i = 0; i < arr.length - j; i++) {
if (arr[i] > arr[i + 1]) {
tmp = arr[i];
... | false |
835 | 946,865 | 6,307,954 | 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... | @Override
public List<SheetFullName> importSheets(INetxiliaSystem workbookProcessor, WorkbookId workbookName, URL url, IProcessingConsole console) throws ImportException {
try {
return importSheets(workbookProcessor, workbookName, url.openStream(), console);
} catch (IOException e) {... | false |
836 | 1,951,103 | 21,840,034 | 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 FileOutputStream transfer(File from, File to, long mark) throws IOException, InterruptedException {
if (out != null) {
close();
}
FileChannel fch = new FileInputStream(from).getChannel();
FileChannel rollch = new FileOutputStream(to).getChannel();
long size... | true |
837 | 20,826,358 | 6,322,468 | public String generateDigest(String password, String saltHex, String algorithm) throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase("crypt")) {
return "{CRYPT}" + UnixCrypt.crypt(password);
} else if (algorithm.equalsIgnoreCase("sha")) {
algorithm = "SHA-1";
... | public static String md5(String text) {
MessageDigest msgDigest = null;
try {
msgDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("System doesn't support MD5 algorithm.");
}
try {
... | true |
838 | 2,217,508 | 10,151,252 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (destFile.getParentFile() != null && !destFile.getParentFile().mkdirs()) {
LOG.error("GeneralHelper.copyFile(): Cannot create parent directories from " + destFile);
}
FileInputStream f... | public static void upload(FTPDetails ftpDetails) {
FTPClient ftp = new FTPClient();
try {
String host = ftpDetails.getHost();
logger.info("Connecting to ftp host: " + host);
ftp.connect(host);
logger.info("Received reply from ftp :" + ftp.getReplyStrin... | true |
839 | 2,440,033 | 49,834 | public Blowfish(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA1");
digest.update(password.getBytes());
} catch (Exception e) {
System.out.println(e);
}
m_bfish = new BlowfishCBC(digest.digest()... | public String encryptPassword(String clearPassword) throws NullPointerException {
MessageDigest sha;
try {
sha = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new NullPointerException("NoSuchAlgorithmException: " + e.toString());
... | true |
840 | 20,601,757 | 10,288,282 | public static File copyFileAs(String path, String newName) {
File src = new File(path);
File dest = new File(newName);
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
... | public String getMarketInfo() {
try {
URL url = new URL("http://api.eve-central.com/api/evemon");
BufferedReader s = new BufferedReader(new InputStreamReader(url.openStream()));
String line = "";
String xml = "";
while ((line = s.readLine()) != nul... | false |
841 | 9,104,988 | 16,050,015 | public String getHashedPhoneId(Context aContext) {
if (hashedPhoneId == null) {
final String androidId = BuildInfo.getAndroidID(aContext);
if (androidId == null) {
hashedPhoneId = "EMULATOR";
} else {
try {
final Message... | public static void downloadFile(String htmlUrl, String dirUrl) {
try {
URL url = new URL(htmlUrl);
System.out.println("Opening connection to " + htmlUrl + "...");
URLConnection urlC = url.openConnection();
InputStream is = url.openStream();
Date da... | false |
842 | 778,678 | 9,130,585 | 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... | protected static IFile createTempFile(CodeFile codeFile) {
IPath path = Util.getAbsolutePathFromCodeFile(codeFile);
File file = new File(path.toOSString());
String[] parts = codeFile.getName().split("\\.");
String extension = parts[parts.length - 1];
IPath ext = path.addFileE... | true |
843 | 7,330,695 | 4,347,908 | static final String md5(String text) throws RtmApiException {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("UTF-8"), 0, text.length());
md5hash = md.digest();
return c... | @Override
protected String doInBackground(String... params) {
HttpURLConnection conn = null;
String localFilePath = params[0];
if (localFilePath == null) {
return null;
}
try {
URL url = new URL(ConnectionHandler.getServerURL() + ":" + ConnectionHa... | false |
844 | 19,555,516 | 1,955,681 | public void loadFromFile() {
if (filename == null) return;
try {
BufferedReader reader;
try {
File file = new File(filename);
if (!file.exists()) return;
reader = new BufferedReader(new FileReader(file));
} catch (ja... | public static void ExtraeArchivoJAR(String Archivo, String DirJAR, String DirDestino) {
FileInputStream entrada = null;
FileOutputStream salida = null;
try {
File f = new File(DirDestino + separador + Archivo);
try {
f.createNewFile();
} ca... | false |
845 | 23,613,195 | 1,543,361 | public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in... | public ProgramSymbol createNewProgramSymbol(int programID, String module, String symbol, int address, int size) throws AdaptationException {
ProgramSymbol programSymbol = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
... | false |
846 | 5,826,730 | 9,590,327 | private void copyFromZip(File zipFile) throws GLMRessourceManagerException {
if (zipFile == null) throw new GLMRessourceZIPException(1);
if (!zipFile.exists()) throw new GLMRessourceZIPException(2);
int len = 0;
byte[] buffer = ContentManager.getDefaultBuffer();
try {
... | private void copyFile(File from, File to) throws IOException {
FileUtils.ensureParentDirectoryExists(to);
byte[] buffer = new byte[1024];
int read;
FileInputStream is = new FileInputStream(from);
FileOutputStream os = new FileOutputStream(to);
while ((read = is.read(b... | true |
847 | 5,505,334 | 21,577,152 | public void candidatarAtividade(Atividade atividade) throws SQLException {
Connection conn = null;
String insert = "insert into Atividade_has_recurso_humano " + "(atividade_idatividade, usuario_idusuario, ativo) " + "values " + "(" + atividade.getIdAtividade() + ", " + "" + atividade.getRecursoHuman... | 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 |
848 | 5,026,545 | 20,815,136 | public void writeConfigurationFile() throws IOException, ComponentException {
SystemConfig config = parent.getParentSystem().getConfiguration();
File original = config.getLocation();
File backup = new File(original.getParentFile(), original.getName() + "." + System.currentTimeMillis());
... | public static void copyTo(File src, File dest) throws IOException {
if (src.equals(dest)) throw new IOException("copyTo src==dest file");
FileOutputStream fout = new FileOutputStream(dest);
InputStream in = new FileInputStream(src);
IOUtils.copyTo(in, fout);
fout.flush();
... | true |
849 | 21,823,682 | 13,498,122 | @SuppressWarnings("unchecked")
protected void displayFreeMarkerResponse(HttpServletRequest request, HttpServletResponse response, String templateName, Map<String, Object> variableMap) throws IOException {
Enumeration<String> attrNameEnum = request.getSession().getAttributeNames();
String attrNam... | public boolean createUser(String username, String password, String name) throws Exception {
boolean user_created = false;
try {
statement = connect.prepareStatement("SELECT COUNT(*) from toepen.users WHERE username = ? LIMIT 1");
statement.setString(1, username);
... | false |
850 | 9,383,862 | 17,533,362 | public static String md5It(String data) {
MessageDigest digest;
String output = "";
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(data.getBytes());
byte[] hash = digest.digest();
for (byte b : hash) {
... | private long getLastModified(Set resourcePaths, Map jarPaths) throws Exception {
long lastModified = 0;
Iterator paths = resourcePaths.iterator();
while (paths.hasNext()) {
String path = (String) paths.next();
URL url = context.getServletContext().getResource(path);
... | false |
851 | 17,787,699 | 14,020,143 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.debug("Random GUID error: " + e.getMessage())... | public byte[] evaluateResponse(byte[] responseBytes) throws SaslException {
if (firstEvaluation) {
firstEvaluation = false;
StringBuilder challenge = new StringBuilder(100);
Iterator iter = configurationManager.getRealms().values().iterator();
Realm aRealm;
... | true |
852 | 8,063,675 | 9,547,228 | 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 void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_BACKUP;
URL url;
InputStream stream = null;
try {
url = new URL(masterUrl);
... | false |
853 | 13,669,410 | 10,332,951 | protected void runTests(URL pBaseURL, String pName, String pHref) throws Exception {
URL url = new URL(pBaseURL, pHref);
InputSource isource = new InputSource(url.openStream());
isource.setSystemId(url.toString());
Document document = getDocumentBuilder().parse(isource);
Node... | public static void loginSkyDrive() throws Exception {
System.out.println("login ");
u = new URL(loginurl);
uc = (HttpURLConnection) u.openConnection();
uc.setRequestProperty("Cookie", msprcookie + ";" + mspokcookie);
uc.setDoOutput(true);
uc.setRequestMethod("POST");
... | false |
854 | 8,138,998 | 19,685,311 | private void handleSSI(HttpData data) throws HttpError, IOException {
File tempFile = TempFileHandler.getTempFile();
FileOutputStream out = new FileOutputStream(tempFile);
BufferedReader in = new BufferedReader(new FileReader(data.realPath));
String[] env = getEnvironmentVariables(da... | public static void copyFile(File inputFile, File outputFile) throws IOException {
FileChannel srcChannel = new FileInputStream(inputFile).getChannel();
FileChannel dstChannel = new FileOutputStream(outputFile).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
s... | true |
855 | 12,908,415 | 4,628,439 | private synchronized void persist() {
Connection conn = null;
try {
PoolManager pm = PoolManager.getInstance();
conn = pm.getConnection(JukeXTrackStore.DB_NAME);
conn.setAutoCommit(false);
Statement state = conn.createStatement();
state.exe... | public int executeUpdate(String query, QueryParameter params) throws DAOException {
PreparedStatement ps = null;
Query queryObj = getModel().getQuery(query);
if (conditionalQueries != null && conditionalQueries.containsKey(query)) {
queryObj = (Query) conditionalQueries.get(query... | true |
856 | 22,525,884 | 11,046,598 | public String generateKey(String className, String methodName, String text, String meaning) {
if (text == null) {
return null;
}
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw n... | private String hash(String clearPassword) {
if (salt == 0) return null;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new AssertionError("Can't find the SHA1 algorithm in the java.security p... | true |
857 | 13,420,786 | 11,915,880 | public static void unzip(File zipInFile, File outputDir) throws Exception {
Enumeration<? extends ZipEntry> entries;
ZipFile zipFile = new ZipFile(zipInFile);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipInFile));
ZipEntry entry = (ZipEntry) zipInputStrea... | private static void cut() {
File inputFile = new File(inputFileName);
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), inputCharSet));
} catch (FileNotFoundException e) {
System.err.print("Invalid Fi... | true |
858 | 9,693,857 | 9,528,049 | 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.... | private void copyFile(File file, File targetFile) {
try {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(targetFile));
byte[] tmp = new byte[8192];
int read... | true |
859 | 13,279,978 | 5,102,752 | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("DOWNLOAD - Send content: " + realFile.getAbsolutePath());
LOGGER.debug("Output stream: " + out.toString());
if (ServerConfiguration.isDynami... | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| true |
860 | 12,394,789 | 19,653,581 | public static void copyFile(File in, File out, long maxCount) throws IOException {
final FileChannel sourceChannel = new FileInputStream(in).getChannel();
final FileChannel destinationChannel = new FileOutputStream(out).getChannel();
if (maxCount == 0) maxCount = sourceChannel.size();
... | public List<SuspectFileProcessingStatus> retrieve() throws Exception {
BufferedOutputStream bos = null;
try {
String listFilePath = GeneralUtils.generateAbsolutePath(getDownloadDirectoryPath(), getListName(), "/");
listFilePath = listFilePath.concat(".xml");
if (!... | true |
861 | 19,292,394 | 10,718,506 | public static void main(String[] args) throws Exception {
URL url = new URL("http://www.sohu.com");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is, Charset.forName("GB18030"));
FileOutputStream fos = new FileOutputStream("gen/sohu2.html");
... | public void update() {
if (url == null) {
throw new IllegalArgumentException("URL cannot be null!");
}
try {
URLConnection urlConnection = url.openConnection();
urlConnection.setRequestProperty("User-Agent", Settings.INSTANCE.getUserAgent());
S... | false |
862 | 19,910,630 | 15,460,365 | public String postData(String result, DefaultHttpClient httpclient) {
try {
HttpPost post = new HttpPost("http://3dforandroid.appspot.com/api/v1/note/create");
StringEntity se = new StringEntity(result);
se.setContentEncoding(HTTP.UTF_8);
se.setContentType("ap... | private String calculateMD5(String value) {
String finalString;
try {
MessageDigest md5Alg = MessageDigest.getInstance("MD5");
md5Alg.reset();
md5Alg.update(value.getBytes());
byte messageDigest[] = md5Alg.digest();
StringBuilder hexString ... | false |
863 | 22,415,294 | 22,554,509 | private String getRenderedBody(String spec) throws Exception {
log.entering(Rss2MailTask.class.getName(), "getRenderedBody");
final URL url = new URL(spec);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
final InputStream ... | public void initialize(AtomPropsMenu menu) {
propertiesMenu = menu;
if (shieldings == null) {
try {
URL url = this.getClass().getClassLoader().getResource(RF);
InputStreamReader isr = new InputStreamReader(url.openStream());
BufferedReader ... | false |
864 | 13,254,235 | 11,032,544 | public static void copy(File file, File dir, boolean overwrite) throws IOException {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
File out = new File(dir, file.getName());
if (out.exists() && !overwrite) {
throw new IOException("File: " + out + " ... | @Test
public void testExactCopySize() throws IOException {
final int size = Byte.SIZE + RANDOMIZER.nextInt(TEST_DATA.length - Long.SIZE);
final InputStream in = new ByteArrayInputStream(TEST_DATA);
final ByteArrayOutputStream out = new ByteArrayOutputStream(size);
final int cpySi... | true |
865 | 1,458,629 | 14,188,181 | 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.... | protected void copyFile(String from, String to, String workingDirectory) throws Exception {
URL monitorCallShellScriptUrl = Thread.currentThread().getContextClassLoader().getResource(from);
File f = new File(monitorCallShellScriptUrl.getFile());
String directoryPath = f.getAbsolutePath();
... | true |
866 | 9,152,056 | 13,713,980 | public AbstractASiCSignatureService(InputStream documentInputStream, DigestAlgo digestAlgo, RevocationDataService revocationDataService, TimeStampService timeStampService, String claimedRole, IdentityDTO identity, byte[] photo, TemporaryDataStorage temporaryDataStorage, OutputStream documentOutputStream) throws IOE... | private String sendMessage(HttpURLConnection connection, String reqMessage) throws IOException, XMLStreamException {
if (msgLog.isTraceEnabled()) msgLog.trace("Outgoing SOAPMessage\n" + reqMessage);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
out.write(... | true |
867 | 2,241,900 | 2,109,483 | public static String hashMD5(String entrada) {
MessageDigest m;
try {
m = MessageDigest.getInstance("MD5");
m.update(entrada.getBytes(), 0, entrada.length());
return new BigInteger(1, m.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
... | @Override
public LispObject execute(LispObject first, LispObject second) throws ConditionThrowable {
Pathname zipfilePathname = coerceToPathname(first);
byte[] buffer = new byte[4096];
try {
String zipfileNamestring = zipfilePathname.getNamestring();
if (zipfileNa... | false |
868 | 10,524,166 | 11,333,342 | public static void copyURLToFile(URL source, File destination) throws IOException {
InputStream input = source.openStream();
try {
FileOutputStream output = openOutputStream(destination);
try {
IOUtils.copy(input, output);
} finally {
... | public AssessmentItemType getAssessmentItemType(String filename) {
if (filename.contains(" ") && (System.getProperty("os.name").contains("Windows"))) {
File source = new File(filename);
String tempDir = System.getenv("TEMP");
File dest = new File(tempDir + "/temp.xml");
... | true |
869 | 21,093,039 | 9,480,908 | public ArrayList parseFile(File newfile) throws IOException {
String s;
String firstname;
String secondname;
String direction;
String header;
String name = null;
String[] tokens;
boolean readingHArrays = false;
boolean readingVArrays = false;
... | public Vector Get() throws Exception {
String query_str = BuildYahooQueryString();
if (query_str == null) return null;
Vector result = new Vector();
HttpURLConnection urlc = null;
try {
URL url = new URL(URL_YAHOO_QUOTE + "?" + query_str + "&" + FORMAT);
... | true |
870 | 20,139,125 | 3,088,336 | protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String realUrl = "http:/" + request.getPathInfo();
if (request.getQueryString() != null) {
realUrl += "?" + request.getQueryString();
}
URL url = new UR... | public void run(IAction action) {
int style = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getStyle();
Shell shell = new Shell((style & SWT.MIRRORED) != 0 ? SWT.RIGHT_TO_LEFT : SWT.NONE);
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl... | false |
871 | 1,699,613 | 8,174,539 | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | public static void invokeServlet(String op, String user) throws Exception {
boolean isSayHi = true;
try {
if (!"sayHi".equals(op)) {
isSayHi = false;
}
URL url = new URL("http://localhost:9080/helloworld/*.do");
HttpURLConnection conn =... | false |
872 | 19,295,736 | 7,464,994 | public void setTableBraille(String tableBraille, boolean sys) {
fiConf.setProperty(OptNames.fi_braille_table, tableBraille);
fiConf.setProperty(OptNames.fi_is_sys_braille_table, Boolean.toString(sys));
FileChannel in = null;
FileChannel out = null;
try {
String fi... | public void alterarQuestaoDiscursiva(QuestaoDiscursiva q) throws SQLException {
PreparedStatement stmt = null;
String sql = "UPDATE discursiva SET gabarito=? WHERE id_questao=?";
try {
stmt = conexao.prepareStatement(sql);
stmt.setString(1, q.getGabarito());
... | false |
873 | 12,270,268 | 14,624,031 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
if (System.getProperty("os.name").toUpperCase().indexOf("WIN") != -1) {
... | public static void copyFile(File in, File out) throws ObclipseException {
try {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getC... | true |
874 | 22,643,538 | 9,918,348 | InputStream createInputStream(FileInfo fi) throws IOException, MalformedURLException {
if (fi.inputStream != null) return fi.inputStream; else if (fi.url != null && !fi.url.equals("")) return new URL(fi.url + fi.fileName).openStream(); else {
File f = new File(fi.directory + fi.fileName);
... | public static ArrayList[] imageSearch(String imageQuery, int startingIndex) {
try {
imageQuery = URLEncoder.encode(imageQuery, "UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
String queryS = new String(... | false |
875 | 16,902,397 | 1,896,089 | private void convertClasses(File source, File destination) throws PostProcessingException, CodeCheckException, IOException {
Stack sourceStack = new Stack();
Stack destinationStack = new Stack();
sourceStack.push(source);
destinationStack.push(destination);
while (!sourceStac... | public static void copyFileByNIO(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | true |
876 | 9,668,598 | 3,236,017 | public static Properties parse() {
try {
String userHome = System.getProperty("user.home");
File dsigFolder = new File(userHome, ".dsig");
if (!dsigFolder.exists() && !dsigFolder.mkdir()) {
throw new IOException("Could not create .dsig folder in user home ... | 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)... | true |
877 | 12,202,663 | 7,194,282 | private static byte[] finalizeStringHash(String loginHash) throws NoSuchAlgorithmException {
MessageDigest md5Hasher;
md5Hasher = MessageDigest.getInstance("MD5");
md5Hasher.update(loginHash.getBytes());
md5Hasher.update(LOGIN_FINAL_SALT);
return md5Hasher.digest();
}
| public static String createNormalizedJarDescriptorDigest(String path) throws Exception {
String descriptor = createNormalizedDescriptor(new JarFile2(path));
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(descriptor.getBytes());
byte[]... | true |
878 | 12,973,571 | 6,883,227 | public boolean executeUpdate(String strSql, HashMap<Integer, Object> prams) throws SQLException, ClassNotFoundException {
getConnection();
boolean flag = false;
try {
pstmt = con.prepareStatement(strSql);
setParamet(pstmt, prams);
logger.info("############... | private HttpURLConnection getConnection(String url) throws IOException {
HttpURLConnection con = null;
if (proxyHost != null && !proxyHost.equals("")) {
if (proxyAuthUser != null && !proxyAuthUser.equals("")) {
log("Proxy AuthUser: " + proxyAuthUser);
log(... | false |
879 | 14,549,213 | 12,626,919 | public Result search(Object object) {
if (object == null || !(object instanceof String)) {
return null;
}
String query = (String) object;
Result hitResult = new Result();
Set<Hit> hits = new HashSet<Hit>(8);
try {
query = URLEncoder.encode(quer... | public void xtestFile1() throws Exception {
InputStream inputStream = new FileInputStream(IOTest.FILE);
OutputStream outputStream = new FileOutputStream("C:/Temp/testFile1.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.close();
}
| false |
880 | 21,518,266 | 8,309,142 | 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 boolean check(String password) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes("ISO-8859-1"));
md.update((byte) ':');
md.update(realm.getBytes("ISO-8859-1"));
md.update((by... | false |
881 | 13,209,824 | 8,990,222 | private void loadConfig(ServletContext ctx, String configFileName) {
Digester digester = new Digester();
digester.push(this);
digester.addFactoryCreate("pagespy/server", new AbstractObjectCreationFactory() {
public Object createObject(Attributes attrs) {
String c... | private boolean get(String surl, File dst, Get get) throws IOException {
boolean ret = false;
InputStream is = null;
OutputStream os = null;
try {
try {
if (surl.startsWith("file://")) {
is = new FileInputStream(surl.substring(7));
... | false |
882 | 2,732,151 | 10,318,835 | public static String compute(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("UTF-8"), 0, text.length());
md5hash = md.digest();
return convertToHex(md... | public static synchronized String Encrypt(String plaintextPassword) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (Exception error) {
throw new Exception(error.getMessage());
}
try {
md.upd... | true |
883 | 20,019,846 | 13,987,172 | public static byte[] downloadHttpFile(String url) throws IOException {
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
int responseCode = conn.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) throw new IOException("Invalid HTTP response: " + respo... | public void sendMessageToServer(String msg, Map<String, String> args, StringCallback cb, URLConstructor ctor) {
try {
int tmpPort = port;
for (; tmpPort < port + 10; tmpPort++) {
Socket tmpSock;
try {
tmpSock = socketsManager.connec... | false |
884 | 6,045,800 | 1,502,583 | private void announce(String trackerURL, byte[] hash, byte[] peerId, int port) {
try {
String strUrl = trackerURL + "?info_hash=" + URLEncoder.encode(new String(hash, Constants.BYTE_ENCODING), Constants.BYTE_ENCODING).replaceAll("\\+", "%20") + "&peer_id=" + URLEncoder.encode(new String(peerId, ... | @Override
protected IStatus run(final IProgressMonitor monitor) {
try {
showTileInfo(remoteFileName, -1);
System.out.println(" connect " + host);
ftp.connect();
showTileInfo(remoteFileName, -2);
... | false |
885 | 10,426,070 | 10,912,336 | public static long copy(File src, long amount, File dst) {
final int BUFFER_SIZE = 1024;
long amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputS... | public void verRecordatorio() {
try {
cantidadArchivos = obtenerCantidad() + 1;
boolean existe = false;
String filenametxt = "";
String filenamezip = "";
String hora = "";
String lugar = "";
String actividad = "";
... | true |
886 | 12,477,499 | 7,306,113 | public HttpResponse executeWithoutRewriting(HttpUriRequest request, HttpContext context) throws IOException {
int code = -1;
long start = SystemClock.elapsedRealtime();
try {
HttpResponse response;
mConnectionAllocated.set(null);
if (NetworkStatsEntity.sho... | @Override
public void setOntology1Document(URL url1) throws IllegalArgumentException {
if (url1 == null) throw new IllegalArgumentException("Input parameter URL for ontology 1 is null.");
try {
ont1 = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(url1.openStr... | false |
887 | 7,760,030 | 18,134,394 | private void loadNumberFormats() {
String fileToLocate = "/" + FILENAME_NUMBER_FMT;
URL url = getClass().getClassLoader().getResource(fileToLocate);
if (url == null) {
return;
}
List<String> lines;
try {
lines = IOUtils.readLines(url.openStream... | private String fetch(String urlstring) {
String content = "";
try {
URL url = new URL(urlstring);
InputStream is = url.openStream();
BufferedReader d = new BufferedReader(new InputStreamReader(is));
String s;
while (null != (s = d.readLine(... | true |
888 | 10,392,922 | 17,224,030 | public static void copyCompletely(InputStream input, OutputStream output) throws IOException {
if ((output instanceof FileOutputStream) && (input instanceof FileInputStream)) {
try {
FileChannel target = ((FileOutputStream) output).getChannel();
FileChannel source... | 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);
}
... | false |
889 | 21,644,427 | 9,924,413 | public static Image getImage(String urlChartString) throws IOException, JGoogleChartException {
Image image = null;
HttpURLConnection urlConn = null;
URL url = new URL(urlChartString);
urlConn = (HttpURLConnection) url.openConnection();
urlConn.setDoInput(true);
urlCo... | private void startOpening(final URL url) {
final WebAccessor wa = this;
openerThread = new Thread() {
public void run() {
iStream = null;
try {
tryProxy = false;
URLConnection connection = url.openConnection();
... | false |
890 | 12,415,477 | 1,989,226 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String limitsSet = "";
String synstatus = SystemFilesLoader.getInstance().getNewgenlibProperties().getProperty("SYNDETICS", "OFF");
String synncod... | 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... | false |
891 | 23,192,841 | 11,875,445 | protected boolean loadJarLibrary(final String jarLib) {
final String tempLib = System.getProperty("java.io.tmpdir") + File.separator + jarLib;
boolean copied = IOUtils.copyFile(jarLib, tempLib);
if (!copied) {
return false;
}
System.load(tempLib);
return t... | private static void loadFromZip() {
InputStream in = Resources.class.getResourceAsStream("data.zip");
if (in == null) {
return;
}
ZipInputStream zipIn = new ZipInputStream(in);
try {
while (true) {
ZipEntry entry = zipIn.getNextEntry();... | true |
892 | 23,677,114 | 15,301,724 | public static void copyFile1(File srcFile, File destFile) throws IOException {
if(!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream fis = new FileInputStream(srcFile);
FileOutputStream fos = new FileOutputStream(destFile);
FileChannel source = fis.getChannel();
FileChannel destinat... | InputStream openURL(URL url) throws IOException, WrongMIMETypeException {
InputStream is = null;
if (url.getProtocol().equals("file")) {
if (debug) {
System.out.println("Using direct input stream on file url");
}
URLConnection urlc = url.openConnec... | false |
893 | 7,062,953 | 5,624,313 | public JarClassLoader(ClassLoader parent) {
super(parent);
initLogger();
hmClass = new HashMap<String, Class<?>>();
lstJarFile = new ArrayList<JarFileInfo>();
hsDeleteOnExit = new HashSet<File>();
String sUrlTopJar = null;
pd = getClass().getProtectionDomain()... | private GenomicSequence fetch(Chromosome k, int start, int end) throws IOException {
try {
String chr = k.toString();
if (chr.toLowerCase().startsWith("chr")) chr = chr.substring(3);
SAXParserFactory f = SAXParserFactory.newInstance();
f.setNamespaceAware(fals... | false |
894 | 12,967,783 | 7,143,272 | @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();
... | private void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChanne... | true |
895 | 10,816,827 | 699,718 | protected Object getMethodKey(String methodName, Object[] args) {
StringBuffer key = new StringBuffer(methodName.trim().replace(" ", ".")).append(".");
for (Object o : args) {
if (o != null) key.append(o.hashCode());
}
LOGGER.info("Generation key ->" + key.toString());
... | PasswordTableWindow(String login) {
super(login + ", tecle a senha de uso �nico");
this.login = login;
Error.log(4001, "Autentica��o etapa 3 iniciada.");
Container container = getContentPane();
container.setLayout(new FlowLayout());
btnNumber = new JButton[10];
... | true |
896 | 19,322,940 | 20,741,835 | @Test
public void test_lookupResourceType_FullSearch_TwoWords() throws Exception {
URL url = new URL(baseUrl + "/lookupResourceType/alloyed+tritanium");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequ... | @Override
public Response executeGet(String url) throws IOException {
if (logger.isLoggable(INFO)) logger.info("Making a GET request to " + url);
HttpURLConnection httpUrlConnection = null;
InputStream inputStream = null;
try {
httpUrlConnection = openConnection(new U... | false |
897 | 10,934,628 | 12,247,514 | public static void main(String[] args) {
try {
{
byte[] bytes1 = { (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
byte[] bytes2 = { (byte) 99, (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
System.out.println("Bytes 2,2,3,0,9 as Base64: "... | public static void main(String[] args) throws Exception {
if (args.length != 2) {
PrintUtil.prt("arguments: sourcefile, destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | true |
898 | 5,933,080 | 10,349,782 | public void addUser(String username, String password, String filename) {
String data = "";
try {
open(filename);
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(password.getBytes());
byte[] digest = mdAlgorithm.digest()... | public static byte[] encode(String origin, String algorithm) throws NoSuchAlgorithmException {
String resultStr = null;
resultStr = new String(origin);
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(resultStr.getBytes());
return md.digest();
}
| true |
899 | 22,626,443 | 9,385,030 | public static File jar(File in, String outArc, File tempDir, PatchConfigXML conf) {
FileOutputStream arcFile = null;
JarOutputStream jout = null;
DirectoryScanner ds = null;
ds = new DirectoryScanner();
ds.setCaseSensitive(true);
ds.setBasedir(in);
ds.scan();
... | public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
XSLTBuddy buddy = new XSLTBuddy();
buddy.parseArgs(args);
XSLTransformer transformer = new XSLTransformer();
if (buddy.templateDir != null) {
transformer.setTemplate... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.