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 |
|---|---|---|---|---|---|
899,800 | 10,453,631 | 19,556,732 | public synchronized String encrypt(String plaintext) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
log().error("failed to encrypt the password.", e);
... | public boolean verifySignature() {
try {
byte[] data = readFile(name + ".tmp1.bin");
if (data == null) return false;
if (data[data.length - 0x104] != 'N' || data[data.length - 0x103] != 'G' || data[data.length - 0x102] != 'I' || data[data.length - 0x101] != 'S') return fa... | true |
899,801 | 23,595,064 | 3,585,152 | public void writeTo(OutputStream out) throws IOException {
if (!closed) {
throw new IOException("Stream not closed");
}
if (isInMemory()) {
memoryOutputStream.writeTo(out);
} else {
FileInputStream fis = new FileInputStream(outputFile);
... | public static void copy(FileInputStream from, FileOutputStream to) throws IOException {
FileChannel fromChannel = from.getChannel();
FileChannel toChannel = to.getChannel();
copy(fromChannel, toChannel);
fromChannel.close();
toChannel.close();
}
| true |
899,802 | 12,078,160 | 2,240,927 | public String getIpAddress() {
try {
URL url = new URL("http://checkip.dyndns.org");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String linha;
String rtn = "";
while ((linha = in.readLine()) != null) rtn += linh... | public boolean getFile(String pRemoteDirectory, String pLocalDirectory, String pFileName) throws IOException {
FTPClient fc = new FTPClient();
fc.connect(getRemoteHost());
fc.login(getUserName(), getPassword());
fc.changeWorkingDirectory(pRemoteDirectory);
String workingDirec... | false |
899,803 | 7,529,744 | 20,130,103 | public Document retrieveDefinition(String uri) throws IOException, UnvalidResponseException {
if (!isADbPediaURI(uri)) throw new IllegalArgumentException("Not a DbPedia Resource URI");
String rawDataUri = fromResourceToRawDataUri(uri);
URL url = new URL(rawDataUri);
URLConnection con... | public static Collection<Class<? extends Page>> loadPages() throws IOException {
ClassLoader ldr = Thread.currentThread().getContextClassLoader();
Collection<Class<? extends Page>> pages = new ArrayList<Class<? extends Page>>();
Enumeration<URL> e = ldr.getResources("META-INF/services/" + Pa... | true |
899,804 | 15,760,850 | 6,399,107 | public static void main(String[] args) {
File container = new File(ArchiveFeature.class.getProtectionDomain().getCodeSource().getLocation().toURI());
if (container == null) {
throw new RuntimeException("this use-case isn't being invoked from the executable jar");
}
JarFil... | private 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);
sourceChannel.... | true |
899,805 | 16,946,193 | 21,741,649 | public void deploy(final File extension) {
log.info("Deploying new extension from {}", extension.getPath());
RequestContextHolder.setRequestContext(new RequestContext(SZoneConfig.getDefaultZoneName(), SZoneConfig.getAdminUserName(SZoneConfig.getDefaultZoneName()), new BaseSessionContext()));
... | private InputStream getInputStream() throws URISyntaxException, MalformedURLException, IOException {
InputStream inStream = null;
try {
URL url = new URI(wsdlFile).toURL();
URLConnection connection = url.openConnection();
connection.connect();
inStream... | false |
899,806 | 13,974,204 | 744,368 | 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);
}
... | void run(String[] args) {
InputStream istream = System.in;
System.out.println("TradeMaximizer " + version);
String filename = parseArgs(args, false);
if (filename != null) {
System.out.println("Input from: " + filename);
try {
if (filename.star... | true |
899,807 | 14,667,674 | 17,590,757 | @Override
protected FTPClient ftpConnect() throws SocketException, IOException, NoSuchAlgorithmException {
FilePathItem fpi = getFilePathItem();
FTPClient f = new FTPSClient();
f.connect(fpi.getHost());
f.login(fpi.getUsername(), fpi.getPassword());
return f;
}
| private boolean initConnection() {
try {
if (ftp == null) {
ftp = new FTPClient();
serverIP = getServer();
userName = getUserName();
password = getPassword();
}
ftp.connect(serverIP);
ftp.login(us... | true |
899,808 | 20,681,845 | 16,477,574 | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | public static ArrayList search(String query) throws Exception {
ArrayList list = new ArrayList();
String url = "http://hypem.com/playlist/search/" + query + "/xml/1/list.xspf";
HttpURLConnection conn = (HttpURLConnection) (new URL(url)).openConnection();
conn.setRequestProperty("User... | false |
899,809 | 4,453,922 | 5,843,848 | public static void request() {
try {
URL url = new URL("http://www.nseindia.com/marketinfo/companyinfo/companysearch.jsp?cons=ghcl§ion=7");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
BufferedReader rd = new BufferedReader(new InputS... | private static void loadListFromRecouces(String category, URL url, DataSetArray<DataSetList> list, final StatusLineManager slm) {
i = 0;
try {
if (url == null) return;
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(... | true |
899,810 | 11,980,724 | 10,006,171 | protected IRunnableWithProgress getProjectCreationRunnable() {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
int remainingWorkUnits = 10;
monitor.beginTask("New Modulo Proje... | byte[] makeIDPFXORMask() {
if (idpfMask == null) {
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
String temp = strip(getPrimaryIdentifier());
sha.update(temp.getBytes("UTF-8"), 0, temp.length());
idpfMask = sha.diges... | false |
899,811 | 613,085 | 5,735,102 | private Document getDocument(URL url) throws SAXException, IOException {
InputStream is;
try {
is = url.openStream();
} catch (IOException io) {
System.out.println("parameter error : The specified reading data is mistaken.");
System.out.println(" Request U... | private static PointGeomReader[] loadResourceList(final String resourceName, ClassLoader loader) {
if (loader == null) loader = ClassLoader.getSystemClassLoader();
final FastSet<PointGeomReader> result = FastSet.newInstance();
try {
final Enumeration<URL> resources = loader.getRe... | false |
899,812 | 9,819,955 | 19,549,575 | @Override
public void write(OutputStream output) throws IOException, WebApplicationException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final GZIPOutputStream gzipOs = new GZIPOutputStream(baos);
IOUtils.copy(is, gzipOs);
baos.close();
gzipOs.close(... | protected InputStream callApiGet(String apiUrl, int expected) {
try {
URL url = new URL(apiUrl);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
if (ApplicationConstants.CONNECT_TIMEOUT > -1) {
request.setConnectTimeout(ApplicationCon... | false |
899,813 | 11,522,419 | 5,138,456 | public static void copyFile(File in, File out) {
int len;
byte[] buffer = new byte[1024];
try {
FileInputStream fin = new FileInputStream(in);
FileOutputStream fout = new FileOutputStream(out);
while ((len = fin.read(buffer)) >= 0) fout.write(buffer, 0, le... | public static int save(File inputFile, File outputFile) throws IOException {
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(inputFile);
outputFile.getParentFile().mkdirs();
out = new FileOutputStream(outputFile);
} c... | true |
899,814 | 6,527,977 | 18,578,541 | public static void copy(File in, File out) throws IOException {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
}
| public static boolean copyFile(File outFile, File inFile) {
InputStream inStream = null;
OutputStream outStream = null;
try {
if (outFile.createNewFile()) {
inStream = new FileInputStream(inFile);
outStream = new FileOutputStream(outFile);
... | true |
899,815 | 11,088,628 | 2,232,617 | public static void copyWithClose(InputStream is, OutputStream os) throws IOException {
try {
IOUtils.copy(is, os);
} catch (IOException ioe) {
try {
if (os != null) os.close();
} catch (Exception e) {
}
try {
... | public void testStorageString() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
r.addText("This is an example");
r.addText(" and another one.");
assertEquals("This is an example and another one.", r.getText());
InputStream in... | true |
899,816 | 19,584,493 | 7,343,430 | @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) {
... | protected boolean writeFile(Interest outstandingInterest) throws IOException {
File fileToWrite = ccnNameToFilePath(outstandingInterest.name());
Log.info("CCNFileProxy: extracted request for file: " + fileToWrite.getAbsolutePath() + " exists? ", fileToWrite.exists());
if (!fileToWrite.exists... | true |
899,817 | 4,960,417 | 4,684,098 | public static boolean writeFileByBinary(InputStream pIs, File pFile, boolean pAppend) {
boolean flag = false;
try {
FileOutputStream fos = new FileOutputStream(pFile, pAppend);
IOUtils.copy(pIs, fos);
fos.flush();
fos.close();
pIs.close();
... | public static void copyFile(String sIn, String sOut) throws IOException {
File fIn = new File(sIn);
File fOut = new File(sOut);
FileChannel fcIn = new FileInputStream(fIn).getChannel();
FileChannel fcOut = new FileOutputStream(fOut).getChannel();
try {
fcIn.transf... | true |
899,818 | 5,257,755 | 6,322,468 | protected URLConnection openConnection(URL url) throws IOException {
if (url == null) return null;
if (!url.getProtocol().equals("nntp")) return null;
if (m_connection != null) {
if (m_connection.getURL().getHost().equals(url.getHost()) && (m_connection.getURL().getPort() == url.... | 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 {
... | false |
899,819 | 8,565,955 | 16,596,670 | private static String webService(String strUrl) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(strUrl);
InputStream input = url.openStream();
String sCurrentLine = "";
InputStreamReader read = new InputStreamReader(input, "utf-8");... | private static List lookupForImplementations(final Class clazz, final ClassLoader loader, final String[] defaultImplementations, final boolean onlyFirst, final boolean returnInstances) throws ClassNotFoundException {
if (clazz == null) {
throw new IllegalArgumentException("Argument 'clazz' canno... | true |
899,820 | 13,221,212 | 22,712,288 | public static void generate(final InputStream input, String format, Point dimension, IPath outputLocation) throws CoreException {
MultiStatus status = new MultiStatus(GraphVizActivator.ID, 0, "Errors occurred while running Graphviz", null);
File dotInput = null, dotOutput = outputLocation.toFile();
... | public static void fileCopy(String from_name, String to_name) throws IOException {
File fromFile = new File(from_name);
File toFile = new File(to_name);
if (fromFile.equals(toFile)) abort("cannot copy on itself: " + from_name);
if (!fromFile.exists()) abort("no such currentSourcepart... | true |
899,821 | 12,415,477 | 6,304,366 | 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 static String uploadArticleMedia(String localPath, String articleImageName, String year, String month, String day, DataStore db, HttpSession session) {
CofaxToolsUser user = (CofaxToolsUser) session.getAttribute("user");
if (!localPath.endsWith(File.separator)) {
localPath += File... | false |
899,822 | 369,844 | 4,877,185 | private boolean enregistreToi() {
PrintWriter lEcrivain;
String laDest = "./img_types/" + sonImage;
if (!new File("./img_types").exists()) {
new File("./img_types").mkdirs();
}
try {
FileChannel leFicSource = new FileInputStream(sonFichier).getChannel(... | public byte[] getEncoded(X509Certificate checkCert, X509Certificate rootCert, String url) {
try {
if (checkCert == null || rootCert == null) return null;
if (url == null) {
url = PdfPKCS7.getOCSPURL(checkCert);
}
if (url == null) return null;
... | false |
899,823 | 7,303,337 | 18,935,086 | public static void downloadJars(IProject project, String repositoryUrl, String jarDirectory, String[] jars) {
try {
File tmpFile = null;
for (String jar : jars) {
try {
tmpFile = File.createTempFile("tmpPlugin_", ".zip");
URL ur... | private void copia(FileInputStream input, FileOutputStream output) throws ErrorException {
if (input == null || output == null) {
throw new ErrorException("Param null");
}
FileChannel inChannel = input.getChannel();
FileChannel outChannel = output.getChannel();
tr... | true |
899,824 | 12,512,647 | 4,424,457 | @Override
public void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
String userAgentGroup = processUserAgent(request);
final LiwenxRequest lRequest = new LiwenxRequestImpl(request, response, messageSource, userAgentGroup);
Locator loc = router.route... | public static void main(String[] args) throws IOException {
long start = System.currentTimeMillis();
FileResourceManager frm = CommonsTransactionContext.configure(new File("C:/tmp"));
try {
frm.start();
} catch (ResourceManagerSystemException e) {
throw new Ru... | true |
899,825 | 670,011 | 10,846,725 | public static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("FileCopy: no such source file: " + from_name);
if (!from_file.isFile()) abort("FileCopy: can't copy d... | private DataFileType[] getDataFiles(Collection<ContentToSend> contentsToSend) {
DataFileType[] files = new DataFileType[contentsToSend.size()];
int fileIndex = 0;
for (ContentToSend contentToSend : contentsToSend) {
DataFileType dataFile = DataFileType.Factory... | true |
899,826 | 23,243,320 | 13,845,913 | 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 synchronized boolean copyTmpDataFile(String fpath) throws IOException {
if (tmpDataOutput != null) tmpDataOutput.close();
tmpDataOutput = null;
if (tmpDataFile == null) return false;
File nfp = new File(fpath);
if (nfp.exists()) nfp.delete();
FileInputStream sr... | false |
899,827 | 1,854,052 | 12,335,897 | @Before
public void setUp() throws Exception {
configureSslSocketConnector();
SecurityHandler securityHandler = createBasicAuthenticationSecurityHandler();
HandlerList handlerList = new HandlerList();
handlerList.addHandler(securityHandler);
handlerList.addHandler(new Abs... | protected void assignListeners() {
groupsList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
refreshInfo();
}
});
saveButton.addActionListener(new ActionListener() {
... | true |
899,828 | 7,600,378 | 9,540,845 | 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... | static void copy(String scr, String dest) throws IOException {
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(scr);
out = new FileOutputStream(dest);
byte[] buf = new byte[1024];
int n;
while ((n = in... | true |
899,829 | 16,663,549 | 15,940,692 | private void prepareQueryResultData(ZipEntryRef zer, String nodeDir, String reportDir, Set<ZipEntryRef> statusZers) throws Exception {
String jobDir = nodeDir + File.separator + "job_" + zer.getUri();
if (!WorkDirectory.isWorkingDirectoryValid(jobDir)) {
throw new Exception("Cannot acces... | @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String fileName = request.getParameter("tegsoftFileName");
if (fileName.startsWith("Tegsoft_BACKUP_")) {
fileName = fileName.sub... | true |
899,830 | 1,327,097 | 11,335,657 | public String generateMappackMD5(File mapPackFile) throws IOException, NoSuchAlgorithmException {
ZipFile zip = new ZipFile(mapPackFile);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
MessageDigest md5Total = MessageDigest.getInstance("MD5");
Mess... | public void sorter() {
String inputLine1, inputLine2;
String epiNames[] = new String[1000];
String epiEpisodes[] = new String[1000];
int lineCounter = 0;
try {
String pluginDir = pluginInterface.getPluginDirectoryName();
String eplist_file = pluginDir ... | false |
899,831 | 11,522,419 | 9,766,481 | public static void copyFile(File in, File out) {
int len;
byte[] buffer = new byte[1024];
try {
FileInputStream fin = new FileInputStream(in);
FileOutputStream fout = new FileOutputStream(out);
while ((len = fin.read(buffer)) >= 0) fout.write(buffer, 0, le... | public void copy(final File source, final File target) throws FileSystemException {
LogHelper.logMethod(log, toObjectString(), "copy(), source = " + source + ", target = " + target);
FileChannel sourceChannel = null;
FileChannel targetChannel = null;
try {
sourceChannel =... | true |
899,832 | 687,106 | 7,507,773 | public boolean copyDirectoryTree(File srcPath, File dstPath) {
try {
if (srcPath.isDirectory()) {
if (!dstPath.exists()) dstPath.mkdir();
String files[] = srcPath.list();
for (int i = 0; i < files.length; i++) copyDirectoryTree(new File(srcPath, fi... | public boolean restore(File directory) {
log.debug("restore file from directory " + directory.getAbsolutePath());
try {
if (!directory.exists()) return false;
String[] operationFileNames = directory.list();
if (operationFileNames.length < 6) {
log.... | true |
899,833 | 4,518,933 | 2,469,707 | 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
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.addHeader("Cache-Control", "max-age=" + Constants.HTTP_CACHE_SECONDS);
String uuid = req.getRequestURI().substring(req.getRequestURI().indexOf(Constants.SERVLET_FULL_PREFI... | true |
899,834 | 19,740,782 | 7,005,223 | public static void parseRDFXML(String url, StatementHandler handler) throws IOException {
ARP parser = new ARP();
parser.getHandlers().setStatementHandler(handler);
URLConnection conn = new URL(url).openConnection();
String encoding = conn.getContentEncoding();
InputStream in... | public void checkFilesAndCopyValid(String filename) {
downloadResults();
loadResults();
File tmpFolderF = new File(tmpFolder);
deleteFileFromTMPFolder(tmpFolderF);
ZipReader zr = new ZipReader();
zr.UnzipFile(filename);
try {
LogManager.getInstance... | false |
899,835 | 21,680,551 | 1,605,515 | private static File createTempWebXml(Class portletClass, File portletDir, String appName, String portletName) throws IOException, FileNotFoundException {
File pathToWebInf = new File(portletDir, "WEB-INF");
File tempWebXml = File.createTempFile("web", ".xml", pathToWebInf);
tempWebXml.delete... | public void createZip(String baseDir, String objFileName) throws Exception {
logger.info("createZip: [ " + baseDir + "] [" + objFileName + "]");
baseDir = baseDir + "/" + timesmpt;
File folderObject = new File(baseDir);
if (folderObject.exists()) {
List<?> fileList = ge... | true |
899,836 | 254,725 | 5,414,796 | 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 void upper() throws Exception {
File input = new File("dateiname");
PostMethod post = new PostMethod("url");
post.setRequestBody(new FileInputStream(input));
if (input.length() < Integer.MAX_VALUE) post.setRequestContentLength((int) input.length()); else post.setRequest... | true |
899,837 | 11,158,190 | 4,076,620 | public static void copyFile(String fromPath, String toPath) {
try {
File inputFile = new File(fromPath);
String dirImg = (new File(toPath)).getParent();
File tmp = new File(dirImg);
if (!tmp.exists()) {
tmp.mkdir();
}
Fi... | public boolean downloadFile(String sourceFilename, String targetFilename) throws RQLException {
checkFtpClient();
InputStream in = null;
try {
in = ftpClient.retrieveFileStream(sourceFilename);
if (in == null) {
return false;
}
... | true |
899,838 | 9,647,574 | 16,537,089 | private void FindAvail() throws ParserConfigurationException, SQLException {
Savepoint sp1;
String availsql = "select xmlquery('$c/coach_status/class[@name=\"" + booking_details.getTclass() + "\"]' ";
availsql += "passing hp_administrator.availability.AVAIL as \"c\") ";
availsql += "... | static String getMD5Hash(String str) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] b = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
int v = (int) ... | false |
899,839 | 10,379,908 | 3,067,994 | public void setContentMD5() {
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
contentMD5 = null;
}
messagedigest.update(content.getBytes... | private String hashMD5(String strToHash) throws Exception {
try {
byte[] bHash = new byte[strToHash.length() * 2];
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(strToHash.getBytes("UTF-16LE"));
bHash = md.digest();
StringBuffer hex... | true |
899,840 | 5,953,607 | 2,691,849 | public synchronized void write() throws IOException {
ZipOutputStream jar = new ZipOutputStream(new FileOutputStream(jarPath));
int index = className.lastIndexOf('.');
String packageName = className.substring(0, index);
String clazz = className.substring(index + 1);
String di... | public static void compress(final File zip, final Map<InputStream, String> entries, final IProgressMonitor monitor) throws IOException {
if (zip == null || entries == null || CollectionUtils.isEmpty(entries.keySet())) throw new IllegalArgumentException("One ore more parameters are empty!");
if (zip.... | true |
899,841 | 16,353,023 | 15,340,278 | public void setRemoteConfig(String s) {
try {
HashMap<String, String> map = new HashMap<String, String>();
URL url = new URL(s);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
while ((line = in.... | @Override
public String encode(String password) {
String hash = null;
MessageDigest m;
try {
m = MessageDigest.getInstance("MD5");
m.update(password.getBytes(), 0, password.length());
hash = String.format("%1$032X", new BigInteger(1, m.digest()));
... | false |
899,842 | 11,572,565 | 22,300,980 | public static final boolean copy(File source, File target, boolean overwrite) {
if (!overwrite && target.exists()) {
LOGGER.error("Target file exist and it not permitted to overwrite it !");
return false;
}
FileChannel in = null;
FileChannel out = null;
... | @Test
public void testTransactWriteAndRead() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | true |
899,843 | 2,972,949 | 9,581,835 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (req.getParameter("i") != null) {
String img = req.getParameter("i");
if (img == null) {
resp.sendError(404, "Image was null");
... | public static void main(String[] args) {
String WTKdir = null;
String sourceFile = null;
String instrFile = null;
String outFile = null;
String jadFile = null;
Manifest mnf;
if (args.length == 0) {
usage();
return;
}
int... | true |
899,844 | 8,969,949 | 9,719,583 | 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 synchronized String getEncryptedPassword(String plaintext, String algorithm) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance(algorithm);
md.update(plaintext.getBytes("UTF-8"));
return bytesToHexString(md.d... | true |
899,845 | 885,948 | 23,496,080 | 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 void fillTemplate(String resource, OutputStream outputStream, Map<String, String> replacements) throws IOException {
URL url = Tools.getResource(resource);
if (url == null) {
throw new IOException("could not find resource");
}
BufferedReader reader = new BufferedR... | true |
899,846 | 5,086,587 | 17,267,601 | public static void copyFromTo(String src, String des) {
staticprintln("Copying:\"" + src + "\"\nto:\"" + des + "\"");
try {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(des).getChannel();
dstChannel.... | public void setBckImg(String newPath) {
try {
File inputFile = new File(getPath());
File outputFile = new File(newPath);
if (!inputFile.getCanonicalPath().equals(outputFile.getCanonicalPath())) {
FileInputStream in = new FileInputStream(inputFile);
... | true |
899,847 | 21,940,225 | 18,803,363 | public void echo(HttpRequest request, HttpResponse response) throws IOException {
InputStream in = request.getInputStream();
if ("gzip".equals(request.getField("Content-Encoding"))) {
in = new GZIPInputStream(in);
}
IOUtils.copy(in, response.getOutputStream());
}
| public void patchFile(final File classFile) {
if (!classFile.exists()) {
myErrors.add(new FormErrorInfo(null, "Class to bind does not exist: " + myRootContainer.getClassToBind()));
return;
}
FileInputStream fis;
try {
byte[] patchedData;
... | true |
899,848 | 23,141,718 | 20,944,080 | protected URLConnection openConnection(URL url) throws IOException {
if (bundleEntry != null) return (new BundleURLConnection(url, bundleEntry));
String bidString = url.getHost();
if (bidString == null) {
throw new IOException(NLS.bind(AdaptorMsg.URL_NO_BUNDLE_ID, url.toExternalF... | public InputStream loadDriver(String id) throws IOException {
Hashtable drivers = loadDriverDB();
DriverInfo di = (DriverInfo) drivers.get(id);
InputStream stream = null;
if (di == null) {
log.warn("No id" + id);
throw new IOException("No driver id '" + id + "... | false |
899,849 | 16,058,262 | 11,353,263 | public static boolean copyFile(final File src, final File dest, long extent, final boolean overwrite) throws FileNotFoundException, IOException {
boolean result = false;
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Copying file " + src + " to " + dest + " extent " + extent + " exist... | @Test
@Ignore
public void testToJson() throws IOException {
JsonSerializer js = new StreamingJsonSerializer(new ObjectMapper());
BulkOperation op = js.createBulkOperation(createTestData(10000), false);
IOUtils.copy(op.getData(), System.out);
}
| true |
899,850 | 10,880,875 | 21,431,679 | @Override
public final boolean save() throws RecordException, RecordValidationException, RecordValidationSyntax {
if (frozen) {
throw new RecordException("The object is frozen.");
}
boolean toReturn = false;
Class<? extends Record> actualClass = this.getClass();
... | public static String get(String u, String usr, String pwd) {
String response = "";
logger.debug("Attempting to call: " + u);
logger.debug("Creating Authenticator: usr=" + usr + ", pwd=" + pwd);
Authenticator.setDefault(new CustomAuthenticator(usr, pwd));
try {
URL... | false |
899,851 | 9,104,988 | 11,021,107 | public String getHashedPhoneId(Context aContext) {
if (hashedPhoneId == null) {
final String androidId = BuildInfo.getAndroidID(aContext);
if (androidId == null) {
hashedPhoneId = "EMULATOR";
} else {
try {
final Message... | private String getResourceAsString(final String name) throws IOException {
final InputStream is = JiBXTestCase.class.getResourceAsStream(name);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copyAndClose(is, baos);
return baos.toString();
}
| false |
899,852 | 6,146,146 | 14,254,575 | 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... | private byte[] _generate() throws NoSuchAlgorithmException {
if (host == null) {
try {
seed = InetAddress.getLocalHost().toString();
} catch (UnknownHostException e) {
seed = "localhost/127.0.0.1";
} catch (SecurityException e) {
... | true |
899,853 | 11,145,818 | 880,670 | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | public static void main(String args[]) {
int i, j, l;
short NUMNUMBERS = 256;
short numbers[] = new short[NUMNUMBERS];
Darjeeling.print("START");
for (l = 0; l < 100; l++) {
for (i = 0; i < NUMNUMBERS; i++) numbers[i] = (short) (NUMNUMBERS - 1 - i);
fo... | false |
899,854 | 2,890,392 | 4,628,439 | public String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | 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... | false |
899,855 | 7,760,990 | 1,415,765 | public DatabaseDefinitionFactory(final DBIf db, final String adapter) throws IOException {
_db = db;
LOG.debug("Loading adapter: " + adapter);
final URL url = getClass().getClassLoader().getResource("adapter/" + adapter + ".properties");
_props = new Properties();
_props.load... | public static String getMD5(String _pwd) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(_pwd.getBytes());
return toHexadecimal(new String(md.digest()).getBytes());
} catch (NoSuchAlgorithmException x) {
x.printStackTrace();
... | false |
899,856 | 13,868,519 | 11,101,256 | public static void addClasses(URL url) {
BufferedReader reader = null;
String line;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
while ((line = reader.readLine()) !... | private void innerJob(String inFrom, String inTo, String line, Map<String, Match> result) throws UnsupportedEncodingException, IOException {
String subline = line.substring(line.indexOf(inTo) + inTo.length());
String tempStr = subline.substring(subline.indexOf(inFrom) + inFrom.length(), subline.inde... | true |
899,857 | 13,591,323 | 23,609,709 | private void downloadFiles() throws SocketException, IOException {
HashSet<String> files_set = new HashSet<String>();
boolean hasWildcarts = false;
FTPClient client = new FTPClient();
for (String file : downloadFiles) {
files_set.add(file);
if (file.contains(W... | private File downloadPDB(String pdbId) {
File tempFile = new File(path + "/" + pdbId + ".pdb.gz");
File pdbHome = new File(path);
if (!pdbHome.canWrite()) {
System.err.println("can not write to " + pdbHome);
return null;
}
String ftp = String.format("f... | false |
899,858 | 12,829,112 | 14,450,903 | public String getDigest(String algorithm, String data) throws IOException, NoSuchAlgorithmException {
MessageDigest md = java.security.MessageDigest.getInstance(algorithm);
md.reset();
md.update(data.getBytes());
return md.digest().toString();
}
| public void login() {
if (email.isEmpty() || pass.isEmpty()) {
NotifyUtil.warn("Acount Data", "You need to specify and account e-mail and password.", false);
return;
}
final ProgressHandle handle = ProgressHandleFactory.createHandle("Connecting to Facebook ...");
... | false |
899,859 | 4,195,183 | 11,322,573 | public Image getURLImage(String url) {
if (!images.containsKey(url)) {
try {
URL img = new URL(url);
images.put(url, new Image(null, img.openStream()));
} catch (Exception e) {
throw new RuntimeException(e.getMessage() + ": " + url);
... | private void preprocessObjects(GeoObject[] objects) throws IOException {
System.out.println("objects.length " + objects.length);
for (int i = 0; i < objects.length; i++) {
String fileName = objects[i].getPath();
int dotindex = fileName.lastIndexOf(".");
dotindex =... | false |
899,860 | 7,781,594 | 1,752,722 | @Override
protected IStatus runCancelableRunnable(IProgressMonitor monitor) {
IStatus returnValue = Status.OK_STATUS;
monitor.beginTask(NLS.bind(Messages.SaveFileOnDiskHandler_SavingFiles, open), informationUnitsFromExecutionEvent.size());
... | @Override
public Object getImage(String key) {
if (key.indexOf("exhibition/") != -1) {
InputStream inputStream = null;
try {
URL url = new URL(getBaseURL() + "icons/" + key + ".png");
inputStream = url.openStream();
return url;
... | false |
899,861 | 481,375 | 5,859,133 | 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];
... | protected int sendData(String submitName, String submitValue) throws HttpException, IOException, SAXException {
PostMethod postMethod = null;
try {
postMethod = new PostMethod(getDocumentBase().toString());
postMethod.getParams().setCookiePolicy(org.apache.commons.httpclient.... | false |
899,862 | 11,701,818 | 317,855 | private static void copyFile(File source, File destination) throws IOException, SecurityException {
if (!destination.exists()) destination.createNewFile();
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(s... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | true |
899,863 | 18,573,528 | 15,402,323 | public int process(ProcessorContext context) throws InterruptedException, ProcessorException {
logger.info("JAISaveTask:process");
final RenderedOp im = (RenderedOp) context.get("RenderedOp");
final String path = "s3://s3.amazonaws.com/rssfetch/" + (new Guid());
final PNGEncodeParam.... | public static String getMd5Hash(String text) {
StringBuffer result = new StringBuffer(32);
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
Formatter f = new Formatter(result);
byte[] digest = md5.digest();
... | false |
899,864 | 1,152,136 | 5,080,723 | @SuppressWarnings("unchecked")
public ArrayList<GmailContact> getAllContacts() throws GmailException {
String query = properties.getString("export_page");
query = query.replace("[RANDOM_INT]", "" + random.nextInt());
int statusCode = -1;
GetMethod get = new GetMethod(query);
... | public static URL getAuthenticationURL(String apiKey, String permission, String sharedSecret) throws Exception {
String apiSig = sharedSecret + "api_key" + apiKey + "perms" + permission;
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(apiSig.getBytes(), 0, apiSig.length());
... | true |
899,865 | 14,635,922 | 9,096,317 | public String contactService(String service, StringBuffer xmlRequest) throws Exception {
Logger.debug(UPSConnections.class, "UPS CONNECTIONS ***** Started " + service + " " + new Date().toString() + " *****");
HttpURLConnection connection;
URL url;
String response = "";
try {... | private void handleNodeUp(long eventID, long nodeID, String eventTime) {
Category log = ThreadCategory.getInstance(OutageWriter.class);
if (eventID == -1 || nodeID == -1) {
log.warn(EventConstants.NODE_UP_EVENT_UEI + " ignored - info incomplete - eventid/nodeid: " + eventID + "/" + nodeI... | false |
899,866 | 8,702,780 | 17,907,353 | final void saveProject(Project project, final File file) {
if (projectsList.contains(project)) {
if (project.isDirty() || !file.getParentFile().equals(workspaceDirectory)) {
try {
if (!file.exists()) {
if (!file.createNewFile()) throw n... | public static void resourceToFile(final String resource, final String filePath) throws IOException {
log.debug("Classloader is " + IOCopyUtils.class.getClassLoader());
InputStream in = IOCopyUtils.class.getResourceAsStream(resource);
if (in == null) {
log.warn("Resource not '" + ... | true |
899,867 | 22,765,730 | 16,095,007 | public void addUser(String name, String unit, String organizeName, int userId, int orgId, String email) {
Connection connection = null;
PreparedStatement ps = null;
DBOperation dbo = factory.createDBOperation(POOL_NAME);
try {
connection = dbo.getConnection();
... | private static void getFileFtp(String user, String password, String host, int port, String fileName, String location) throws Exception {
Log.info("\nretrieve " + fileName + NEW_LINE);
FTPClient client = new FTPClient();
client.connect(host, port);
int reply = client.getReplyCode();
... | false |
899,868 | 16,954,340 | 12,614,306 | public static boolean copyFile(String sourceFileName, String destFileName) {
if (sourceFileName == null || destFileName == null) return false;
if (sourceFileName.equals(destFileName)) return false;
try {
java.io.FileInputStream in = new java.io.FileInputStream(sourceFileName);
... | 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.... | true |
899,869 | 13,834,118 | 3,461,964 | 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 String useService(HashMap<String, String> input) {
String output = "";
if (input.size() < 1) {
return "";
}
String data = "";
try {
for (String key : input.keySet()) {
data += "&" + URLEncoder.encode(key, "UTF-8") + "=" + URLEnco... | false |
899,870 | 6,668,684 | 7,464,992 | public static void doIt(String action) {
int f = -1;
Statement s = null;
Connection connection = null;
try {
init();
log.info("<<< Looking up UserTransaction >>>");
UserTransaction usertransaction = (UserTransaction) context.lookup("java:comp/UserT... | public void criarTopicoQuestao(Questao q, Integer idTopico) throws SQLException {
PreparedStatement stmt = null;
String sql = "INSERT INTO questao_topico (id_questao, id_disciplina, id_topico) VALUES (?,?,?)";
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1,... | true |
899,871 | 5,995,233 | 146,579 | public void postProcess() throws StopWriterVisitorException {
dxfWriter.postProcess();
try {
FileChannel fcinDxf = new FileInputStream(fTemp).getChannel();
FileChannel fcoutDxf = new FileOutputStream(m_Fich).getChannel();
DriverUtilities.copy(fcinDxf, fcoutDxf);
... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
899,872 | 15,599,611 | 4,298,180 | private void setInlineXML(Entry entry, DatastreamXMLMetadata ds) throws UnsupportedEncodingException, StreamIOException {
String content;
if (m_obj.hasContentModel(Models.SERVICE_DEPLOYMENT_3_0) && (ds.DatastreamID.equals("SERVICE-PROFILE") || ds.DatastreamID.equals("WSDL"))) {
content =... | public static String md5(String texto) {
String resultado;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(texto.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
resultado = hash.toString(16);
if (resul... | false |
899,873 | 20,661,433 | 265,214 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | false |
899,874 | 16,621,498 | 9,096,320 | public static byte[] loadURLToBuffer(URL url, int maxLength) throws IOException {
byte[] buf = new byte[maxLength];
byte[] data = null;
int iCount = 0;
BufferedInputStream in = new BufferedInputStream(url.openStream(), 20480);
iCount = in.read(buf, 0, buf.length);
if ... | private void handleInterfaceReparented(String ipAddr, Parms eventParms) {
Category log = ThreadCategory.getInstance(OutageWriter.class);
if (log.isDebugEnabled()) log.debug("interfaceReparented event received...");
if (ipAddr == null || eventParms == null) {
log.warn(EventConstan... | false |
899,875 | 9,871,401 | 9,312,243 | protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
String pathInfo = httpServletRequest.getPathInfo();
log.info("PathInfo: " + pathInfo);
if (pathInfo == null || pathInfo.equals("") || pathInfo.equals("... | void shutdown(final boolean unexpected) {
if (unexpected) {
log.warn("S H U T D O W N --- received unexpected shutdown request.");
} else {
log.info("S H U T D O W N --- start regular shutdown.");
}
if (this.uncaughtException != null) {
log... | true |
899,876 | 15,712,380 | 8,121,415 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Specify name of the file, just one entry per line");
System.exit(0);
}
File inFile = new File(args[0]);
BufferedReader myBR = null;
File outFile = new File(args[0] + "... | public static File writeInternalFile(Context cx, URL url, String dir, String filename) {
FileOutputStream fos = null;
File fi = null;
try {
fi = newInternalFile(cx, dir, filename);
fos = FileUtils.openOutputStream(fi);
int length = IOUtils.copy(url.openStr... | true |
899,877 | 5,590,065 | 6,597,132 | protected String readFileUsingHttp(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProper... | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream inStream = null;
FileOutputStream outStream = null;
FileChannel source = null;
FileChannel de... | false |
899,878 | 7,861,020 | 15,890,129 | private void writeToFile(Body b, File mime4jFile) throws FileNotFoundException, IOException {
if (b instanceof TextBody) {
String charset = CharsetUtil.toJavaCharset(b.getParent().getCharset());
if (charset == null) {
charset = "ISO8859-1";
}
O... | public File getAppHome() {
if (appHome == null) {
if (System.getProperty("app.home") != null) {
appHome = new File(System.getProperty("app.home"));
}
if (appHome == null) {
URL url = Main.class.getClassLoader().getResource("com/hs/mail/cont... | false |
899,879 | 21,919,199 | 1,708,100 | private Datastream addManagedDatastreamVersion(Entry entry) throws StreamIOException, ObjectIntegrityException {
Datastream ds = new DatastreamManagedContent();
setDSCommonProperties(ds, entry);
ds.DSLocationType = "INTERNAL_ID";
ds.DSMIME = getDSMimeType(entry);
IRI contentL... | private void sendFile(File file, HttpExchange response) throws IOException {
response.getResponseHeaders().add(FileUploadBase.CONTENT_LENGTH, Long.toString(file.length()));
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
IOUtils.copy(inp... | true |
899,880 | 11,238,195 | 21,125,856 | public void init() {
System.out.println("Init applet...");
int port = Integer.parseInt(getParameter("port"));
int useUDP = Integer.parseInt(getParameter("udp"));
boolean bUseUDP = false;
if (useUDP > 0) bUseUDP = true;
m_strWorld = getParameter("world");
m_str... | public File createWindow(String pdfUrl) {
URL url;
InputStream is;
try {
int fileLength = 0;
String str;
if (pdfUrl.startsWith("jar:/")) {
str = "file.pdf";
is = this.getClass().getResourceAsStream(pdfUrl.substring(4));
... | false |
899,881 | 6,037,295 | 15,854,397 | public void copyContent(long mailId1, long mailId2) throws Exception {
File file1 = new File(this.getMailDir(mailId1) + "/");
File file2 = new File(this.getMailDir(mailId2) + "/");
this.recursiveDir(file2);
if (file1.isDirectory()) {
File[] files = file1.listFiles();
... | public static Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileIn... | true |
899,882 | 15,599,613 | 13,600,574 | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | public String getWeather(String cityName, String fileAddr) {
try {
URL url = new URL("http://www.google.com/ig/api?hl=zh_cn&weather=" + cityName);
InputStream inputstream = url.openStream();
String s, str;
BufferedReader in = new BufferedReader(new InputStream... | false |
899,883 | 18,600,188 | 21,454,371 | private void copyFile(String fileName, String messageID, boolean isError) {
try {
File inputFile = new File(fileName);
File outputFile = null;
if (isError) {
outputFile = new File(provider.getErrorDataLocation(folderName) + messageID + ".xml");
... | private static void compressZip(String source, String dest) throws Exception {
File baseFolder = new File(source);
if (baseFolder.exists()) {
if (baseFolder.isDirectory()) {
List<File> fileList = getSubFiles(new File(source));
ZipOutputStream zos = new Zip... | true |
899,884 | 21,674,149 | 2,533,570 | public static String md5(String text, String charset) {
MessageDigest msgDigest = null;
try {
msgDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("System doesn't support MD5 algorithm.");
}
... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | true |
899,885 | 4,721,547 | 13,131,643 | public static void main(String[] args) throws Exception {
String infile = "C:\\copy.sql";
String outfile = "C:\\copy.txt";
FileInputStream fin = new FileInputStream(infile);
FileOutputStream fout = new FileOutputStream(outfile);
FileChannel fcin = fin.getChannel();
Fi... | public void init(File file) {
InputStream is = null;
ByteArrayOutputStream os = null;
try {
is = new FileInputStream(file);
os = new ByteArrayOutputStream();
IOUtils.copy(is, os);
} catch (Throwable e) {
throw new VisualizerEngineExcept... | true |
899,886 | 21,752,108 | 421,187 | private void copy(File from, File to) {
if (from.isDirectory()) {
File[] files = from.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
File newTo = new File(to.getPath() + File.separator + files[i].getName());
... | 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... | true |
899,887 | 17,366,812 | 18,985,881 | public String tranportRemoteUnitToLocalTempFile(String urlStr) throws UnitTransportException {
InputStream input = null;
BufferedOutputStream bos = null;
File tempUnit = null;
try {
URL url = null;
int total = 0;
try {
url = new URL... | public static final String crypt(String password, String salt) throws NoSuchAlgorithmException {
String magic = "$1$";
byte finalState[];
MessageDigest ctx, ctx1;
long l;
if (salt.startsWith(magic)) {
salt = salt.substring(magic.length());
}
if (sa... | false |
899,888 | 22,654,851 | 22,287,078 | 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);
... | @Override
List<String> HttpGet(URL url) throws IOException {
List<String> responseList = new ArrayList<String>();
Logger.getInstance().logInfo("HTTP GET: " + url, null, getGatewayId());
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setConnectTimeout(20000)... | false |
899,889 | 12,206,255 | 11,919,249 | private void parseTemplate(File templateFile, Map dataMap) throws ContainerException {
Debug.log("Parsing template : " + templateFile.getAbsolutePath(), module);
Reader reader = null;
try {
reader = new InputStreamReader(new FileInputStream(templateFile));
} catch (FileNo... | protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
Session session = HibernateUtil.getInstance().getSession();
response.setBufferSize(65536);
ServletOutputStream outStream = response.getOutputStream();
Fil... | true |
899,890 | 15,700,439 | 22,600,512 | private void getViolationsReportByProductOfferIdYearMonthDay() throws IOException {
String xmlFile9Send = System.getenv("SLASOI_HOME") + System.getProperty("file.separator") + "Integration" + System.getProperty("file.separator") + "soap" + System.getProperty("file.separator") + "getViolationsReportByProduct... | public void readFully(String urlS) throws Exception {
URL url = new URL(urlS);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
byte[] data = new byte[10240];
int b = is.read(data);
while (b > 0) {
... | false |
899,891 | 11,603,577 | 23,201,697 | private void analyseCorpus(final IStatusDisplayer fStatus) {
final String sDistrosFile = "Distros.tmp";
final String sSymbolsFile = "Symbols.tmp";
Chunker = new EntropyChunker();
int Levels = 2;
sgOverallGraph = new SymbolicGraph(1, Levels);
siIndex = new SemanticInde... | private byte[] loadResourceFromCodeBase(String name) {
byte[] bytecode;
InputStream is = null;
logger.debug("LoadResourceFromCodeBase()++");
try {
URL url = new URL(this._codeBase, name);
int content_length = -1;
URLConnection connection = url.open... | false |
899,892 | 3,076,854 | 19,753,981 | public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | private void download(String address, String localFileName, String host, int porta) {
InputStream in = null;
URLConnection conn = null;
OutputStream out = null;
System.out.println("Update.download() BAIXANDO " + address);
try {
URL url = new URL(address);
... | false |
899,893 | 21,032,350 | 1,160,946 | public byte[] md5(String clearText) {
MessageDigest md;
byte[] digest;
try {
md = MessageDigest.getInstance("MD5");
md.update(clearText.getBytes());
digest = md.digest();
} catch (NoSuchAlgorithmException e) {
throw new UnsupportedOpera... | @Override
public KeySelectorResult select(KeyInfo keyInfo, Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException {
try {
return super.select(keyInfo, purpose, method, context);
} catch (KeySelectorException e) {
LOG.debug("no key f... | false |
899,894 | 13,969,472 | 346,058 | protected void readLockssConfigFile(URL url, List<String> peers) {
PrintWriter out = null;
try {
out = new PrintWriter(new OutputStreamWriter(System.out, "utf8"), true);
out.println("unicode-output-ready");
} catch (UnsupportedEncodingException ex) {
Syste... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
899,895 | 9,835,797 | 14,820,646 | public static void loadFile(final URL url, final StringBuffer buffer) throws IOException {
InputStream in = null;
BufferedReader dis = null;
try {
in = url.openStream();
dis = new BufferedReader(new InputStreamReader(in));
int i;
while ((i = di... | public byte[] getCoded(String name, String pass) {
byte[] digest = null;
if (pass != null && 0 < pass.length()) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(name.getBytes());
md.update(pass.getBytes());
... | false |
899,896 | 3,395,310 | 16,214,714 | private void execute(File file) throws IOException {
if (file == null) throw new RuntimeException("undefined file");
if (!file.exists()) throw new RuntimeException("file not found :" + file);
if (!file.isFile()) throw new RuntimeException("not a file :" + file);
String login = cfg.ge... | private Element makeRequest(String link) {
try {
URL url = new URL(link);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
InputStream in = conn.getInputStream();
DocumentB... | false |
899,897 | 19,984,804 | 15,774,654 | public void registerSchema(String newSchemaName, String objectControlller, long boui, String expression, String schema) throws SQLException {
Connection cndef = null;
PreparedStatement pstm = null;
try {
cndef = this.getRepositoryConnection(p_ctx.getApplication(), "default", 2);
... | public static synchronized String getMD5_Base64(final String input) {
if (isInited == false) {
isInited = true;
try {
digest = MessageDigest.getInstance("MD5");
} catch (Exception ex) {
logger.error("Cannot get MessageDigest. Application ma... | false |
899,898 | 10,499,553 | 12,202,844 | private static InputStream connect(final String url) throws IOException {
InputStream in = null;
try {
final URLConnection conn = new URL(url).openConnection();
conn.setConnectTimeout(YahooGeocoding.connectTimeOut);
conn.setReadTimeout(YahooGeocoding.readTimeOut);... | private String getMD5(String data) {
try {
MessageDigest md5Algorithm = MessageDigest.getInstance("MD5");
md5Algorithm.update(data.getBytes(), 0, data.length());
byte[] digest = md5Algorithm.digest();
StringBuffer hexString = new StringBuffer();
St... | false |
899,899 | 9,913,454 | 18,600,879 | private void createScript(File scriptsLocation, String relativePath, String scriptContent) {
Writer fileWriter = null;
try {
File scriptFile = new File(scriptsLocation.getAbsolutePath() + "/" + relativePath);
scriptFile.getParentFile().mkdirs();
fileWriter = new F... | public static void copyFile(File input, File output) throws Exception {
FileReader in = new FileReader(input);
FileWriter out = new FileWriter(output);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.