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 |
|---|---|---|---|---|---|
897,800 | 17,557,352 | 2,033,320 | public void copyFile(String source_name, String dest_name) throws IOException {
File source_file = new File(source_name);
File destination_file = new File(dest_name);
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
... | public static void gunzip(File gzippedFile, File destinationFile) throws IOException {
int buffer = 2048;
FileInputStream in = new FileInputStream(gzippedFile);
GZIPInputStream zipin = new GZIPInputStream(in);
byte[] data = new byte[buffer];
FileOutputStream out = new FileOut... | true |
897,801 | 21,570,965 | 10,535,319 | public static void main(String[] args) throws FileNotFoundException, IOException {
String filePath = "/Users/francisbaril/Downloads/test-1.pdf";
String testFilePath = "/Users/francisbaril/Desktop/testpdfbox/test.pdf";
File file = new File(filePath);
final File testFile = new File(tes... | private static Collection<String> createTopLevelFiles(Configuration configuration, Collections collections, Sets sets) throws FlickrException, SAXException, IOException, JDOMException, TransformerException {
Collection<String> createdFiles = new HashSet<String>();
File toplevelXmlFilename = getTople... | true |
897,802 | 3,803,030 | 16,116,214 | public static String getRolesString(HttpServletRequest hrequest, HttpServletResponse hresponse, String username, String servicekey) {
String registerapp = SSOFilter.getRegisterapp();
String u = SSOUtil.addParameter(registerapp + "/api/getroles", "username", username);
u = SSOUtil.addParamete... | public static void processString(String text) throws Exception {
MessageDigest md5 = MessageDigest.getInstance(MD5_DIGEST);
md5.reset();
md5.update(text.getBytes());
displayResult(null, md5.digest());
}
| false |
897,803 | 10,205,542 | 19,883,483 | public static String encrypt(String plaintext) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
logger.error("NoSuchAlgorithmException:" + e);
}
try {
md.update(plaintext.getBy... | public static void copy(String file1, String file2) throws IOException {
File inputFile = new File(file1);
File outputFile = new File(file2);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
System.out.println("Copy file from: " + file1 ... | false |
897,804 | 14,193,057 | 15,999,201 | public static void writeURLToFile(String url, String path) throws MalformedURLException, IOException {
java.io.BufferedInputStream in = new java.io.BufferedInputStream(new java.net.URL(url).openStream());
java.io.FileOutputStream fos = new java.io.FileOutputStream(path);
java.io.BufferedOutp... | @Override
public void downloadByUUID(final UUID uuid, final HttpServletRequest request, final HttpServletResponse response) throws IOException {
if (!exportsInProgress.containsKey(uuid)) {
throw new IllegalStateException("No download with UUID: " + uuid);
}
final File compres... | false |
897,805 | 21,246,898 | 10,313,906 | public static void main(String[] args) throws ParseException, FileNotFoundException, IOException {
InputStream input = new BufferedInputStream(UpdateLanguages.class.getResourceAsStream("definition_template"));
Translator t = new Translator(input, "UTF8");
Node template = Translator.Start();
... | private File copyFile(File file, String newName, File folder) {
File newFile = null;
if (!file.exists()) {
System.out.println("File " + file + " does not exist");
return null;
}
if (file.isFile()) {
BufferedOutputStream out = null;
Buff... | true |
897,806 | 8,292,552 | 8,894,166 | public void run() {
BufferedReader inp = null;
try {
String urlString = "http://www.hubtracker.com/query.php?action=add&username=" + user + "&password=" + pass + "&email=" + e_mail + "&address=" + Vars.Hub_Host;
URL url = new URL(urlString);
URLConnection conn;
... | public static void saveFileFromURL(URL url, File destinationFile) throws IOException {
FileOutputStream fo = new FileOutputStream(destinationFile);
InputStream is = url.openStream();
byte[] data = new byte[1024];
int bytecount = 0;
do {
fo.write(data, 0, bytecount... | false |
897,807 | 21,644,427 | 12,109,713 | 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... | protected long loadFromSource(long afterThisTime) {
long startTime = System.currentTimeMillis();
QuoteDataSourceDescriptor quoteDataSourceDescriptor = (QuoteDataSourceDescriptor) dataSourceDescriptor;
List<Quote> dataPool = dataPools.get(quoteDataSourceDescriptor.sourceSymbol);
Calen... | false |
897,808 | 2,396,214 | 14,284,458 | public static String toMD5Sum(String arg0) {
String ret;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(arg0.getBytes());
ret = toHexString(md.digest());
} catch (Exception e) {
ret = arg0;
}
return ret;
... | private String md5(String txt) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(txt.getBytes(), 0, txt.length());
return new BigInteger(1, m.digest()).toString(16);
} catch (Exception e) {
return "BAD MD5";
}
}
| true |
897,809 | 10,934,628 | 17,999,564 | 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 decompressFile(File f) throws IOException {
File target = new File(f.toString().substring(0, f.toString().length() - 3));
System.out.print("Decompressing: " + f.getName() + ".. ");
long initialSize = f.length();
GZIPInputStream in = new GZIPInputStream(new FileInpu... | true |
897,810 | 11,422,574 | 10,252,057 | protected boolean update(String sql, int requiredRows, int maxRows) throws SQLException {
if (LOG.isDebugEnabled()) {
LOG.debug("executing " + sql + "...");
}
Connection connection = null;
boolean oldAutoCommit = true;
try {
connection = dataSource.get... | public void deletePortletName(PortletName portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (portletNameBean.getPortletId() == null) throw new IllegalArgumentException("portletNameId is null")... | true |
897,811 | 5,981,201 | 23,188,868 | public static void copyFile(File src, File dst) throws IOException {
if (T.t) T.info("Copying " + src + " -> " + dst + "...");
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dst);
byte buf[] = new byte[40 * KB];
int read;
wh... | public void run(IProgressMonitor runnerMonitor) throws CoreException {
try {
Map<String, File> projectFiles = new HashMap<String, File>();
IPath basePath = new Path("/");
for (File nextLocation : filesToZip) {
... | true |
897,812 | 11,560,551 | 21,958,776 | private static void extract(ZipFile zipFile) throws Exception {
FileUtils.deleteQuietly(WEBKIT_DIR);
WEBKIT_DIR.mkdirs();
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
i... | public void filter(File source, File destination, MNamespace mNamespace) throws Exception {
BufferedReader reader = new BufferedReader(new FileReader(source));
BufferedWriter writer = new BufferedWriter(new FileWriter(destination));
int line = 0;
int column = 0;
Stack parseSt... | true |
897,813 | 2,964,000 | 4,013,485 | private void addConfigurationResource(final String fileName, final boolean ensureLoaded) {
try {
final ClassLoader cl = this.getClass().getClassLoader();
final Properties p = new Properties();
final URL url = cl.getResource(fileName);
if (url == null) {
... | void copyFileOnPeer(String path, RServerInfo peerserver, boolean allowoverwrite) throws IOException {
RFile file = new RFile(path);
OutputStream out = null;
FileInputStream in = null;
try {
in = fileManager.openFileRead(path);
out = localClient.openWrite(file,... | false |
897,814 | 170,006 | 9,935,769 | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | public static InputSource openInputSource(String resource) {
InputSource src = null;
URL url = findResource(resource);
if (url != null) {
try {
InputStream in = url.openStream();
src = new InputSource(in);
src.setSystemId(url.toExte... | false |
897,815 | 19,142,736 | 3,578,392 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void copyFile(File in, File out) throws FileNotFoundException, IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
destinationChannel = new FileOutputStream(ou... | true |
897,816 | 9,031,629 | 2,285,441 | public static byte[] readFromURI(URI uri) throws IOException {
if (uri.toString().contains("http:")) {
URL url = uri.toURL();
URLConnection urlConnection = url.openConnection();
int length = urlConnection.getContentLength();
System.out.println("length of conte... | static synchronized Person lookup(PhoneNumber number, String siteName) {
Vector<Person> foundPersons = new Vector<Person>(5);
if (number.isFreeCall()) {
Person p = new Person("", "FreeCall");
p.addNumber(number);
foundPersons.add(p);
} else if (number.isSI... | false |
897,817 | 1,686,479 | 3,673,887 | @SuppressWarnings("static-access")
@RequestMapping(value = "/upload/upload.html", method = RequestMethod.POST)
protected void save(HttpServletRequest request, HttpServletResponse response) throws ServletException {
UPLOAD_DIRECTORY = uploadDiretory();
File diretorioUsuario = new File(UPLOAD_... | public static final void copyFile(File source, File destination) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel targetChannel = new FileOutputStream(destination).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChan... | true |
897,818 | 2,481,505 | 3,058,819 | @Override
public void run() {
try {
File[] inputFiles = new File[this.previousFiles != null ? this.previousFiles.length + 1 : 1];
File copiedInput = new File(this.randomFolder, this.inputFile.getName());
IOUtils.copyFile(this.inputFile, copiedInput);
input... | 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 |
897,819 | 832,234 | 5,777,003 | 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 void testDecodeJTLM_publish100() throws Exception {
EXISchema corpus = EXISchemaFactoryTestUtil.getEXISchema("/JTLM/schemas/TLMComposite.xsd", getClass(), m_compilerErrors);
Assert.assertEquals(0, m_compilerErrors.getTotalCount());
GrammarCache grammarCache = new GrammarCache(corpus, ... | false |
897,820 | 17,724,878 | 3,803,022 | public byte[] getDigest(OMProcessingInstruction pi, String digestAlgorithm) throws OMException {
byte[] digest = new byte[0];
try {
MessageDigest md = MessageDigest.getInstance(digestAlgorithm);
md.update((byte) 0);
md.update((byte) 0);
md.update((byte... | public static String validateSession(String sessionid, String servicekey, HttpServletRequest request) {
if (sessionid == null) {
return "error";
}
String loginapp = SSOFilter.getLoginapp();
String u = SSOUtil.addParameter(loginapp + "/api/validatesessionid", "sessionid", ... | false |
897,821 | 5,705,521 | 91,017 | protected static URL[] createUrls(URL jarUrls[]) {
ArrayList<URL> additionalUrls = new ArrayList<URL>(Arrays.asList(jarUrls));
for (URL ju : jarUrls) {
try {
JarFile jar = new JarFile(ju.getFile());
Enumeration<JarEntry> entries = jar.entries();
... | 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 |
897,822 | 17,325,960 | 13,139,266 | private String getMD5(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] data = md.digest();
return convertToHex(data);
} catch (Exception ex) {
ex.printStackTrace();
... | public static String encripta(String senha) throws GCIException {
LOGGER.debug(INICIANDO_METODO + "encripta(String)");
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
... | true |
897,823 | 17,467,777 | 8,052,478 | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| private static void execute(String fileName) throws IOException, SQLException {
InputStream input = DatabaseConstants.class.getResourceAsStream(fileName);
StringWriter writer = new StringWriter();
IOUtils.copy(input, writer);
String sql = writer.toString();
Statement statemen... | true |
897,824 | 1,642,489 | 126,187 | public void testAddFiles() throws Exception {
File original = ZipPlugin.getFileInPlugin(new Path("testresources/test.zip"));
File copy = new File(original.getParentFile(), "1test.zip");
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
897,825 | 21,374,275 | 11,130,567 | private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExce... | public static boolean copyFile(File sourceFile, File destFile) throws IOException {
long flag = 0;
if (!destFile.exists()) destFile.createNewFile();
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChanne... | true |
897,826 | 643,933 | 11,514,180 | 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... | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | true |
897,827 | 11,893,997 | 15,340,278 | private String digestPassword(String password) {
StringBuffer hexString = new StringBuffer();
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(password.getBytes());
byte[] messageDigest = algorithm.d... | @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()));
... | true |
897,828 | 189,777 | 1,008,325 | 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... | 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... | true |
897,829 | 16,902,397 | 18,820,147 | 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 String MD5(String text) {
byte[] md5hash = new byte[32];
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
} catch (NoSuchAlgorithmExcep... | false |
897,830 | 14,440,431 | 14,293,059 | public static String generateHash(final String sText, final String sAlgo) throws NoSuchAlgorithmException {
final MessageDigest md = MessageDigest.getInstance(sAlgo);
md.update(sText.getBytes());
final Formatter formatter = new Formatter();
for (final Byte curByte : md.digest()) form... | public static final String crypt(final String password, String salt, final String magic) {
if (password == null) throw new IllegalArgumentException("Null password!");
if (salt == null) throw new IllegalArgumentException("Null salt!");
if (magic == null) throw new IllegalArgumentException("Nu... | true |
897,831 | 5,767,800 | 18,985,881 | private String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash... | public 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... | true |
897,832 | 592,607 | 18,731,109 | 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 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.... | false |
897,833 | 17,545,948 | 20,077,101 | public void run() {
try {
URL url = new URL("http://pokedev.org/time.php");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringTokenizer s = new StringTokenizer(in.readLine());
m_day = Integer.parseInt(s.nextToken());
... | public void maj(String titre, String num_version) {
int res = 2;
String content_xml = "";
try {
URL url = new URL("http://code.google.com/feeds/p/tux-team/downloads/basic");
InputStreamReader ipsr = new InputStreamReader(url.openStream());
BufferedReader b... | true |
897,834 | 7,109,222 | 6,464,850 | public static void zipMapBos(DitaBoundedObjectSet mapBos, File outputZipFile, MapBosProcessorOptions options) throws Exception {
log.debug("Determining zip file organization...");
BosVisitor visitor = new DxpFileOrganizingBosVisitor();
visitor.visit(mapBos);
if (!options.isQuiet()) l... | private void exportJar(File root, List<File> list, Manifest manifest) throws Exception {
JarOutputStream jarOut = null;
FileInputStream fin = null;
try {
jarOut = new JarOutputStream(new FileOutputStream(jarFile), manifest);
for (int i = 0; i < list.size(); i++) {
... | true |
897,835 | 20,644,476 | 14,540,145 | private static AtomContainer askForMovieSettings() throws IOException, QTException {
final InputStream inputStream = QuickTimeFormatGenerator.class.getResourceAsStream(REFERENCE_MOVIE_RESOURCE);
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream(1024 * 100);
IOUtils.copy(input... | public void copyFile(String source_name, String dest_name) throws IOException {
File source_file = new File(source_name);
File destination_file = new File(dest_name);
Reader source = null;
Writer destination = null;
char[] buffer;
int bytes_read;
try {
... | true |
897,836 | 13,498,122 | 21,319,938 | 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);
... | String getOutputPage(String action, String XML, String xslFileName, InputStream pageS, HttpServletRequest request) throws NoSuchAlgorithmException, UnsupportedEncodingException, TransformerException {
String sPage = null;
Transformer transformer = null;
String dig = null;
CharArrayWr... | true |
897,837 | 414,463 | 241,286 | 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... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
897,838 | 7,292,100 | 7,511,780 | public Ftp(Resource resource, String basePath) throws Exception {
super(resource, basePath);
client = new FTPClient();
client.addProtocolCommandListener(new CommandLogger());
client.connect(resource.getString("host"), Integer.parseInt(resource.getString("port")));
client.logi... | public static String md5(String word) {
MessageDigest alg = null;
try {
alg = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ServletUtils.class.getName()).log(Level.SEVERE, null, ex);
}
alg.reset();
a... | false |
897,839 | 6,535,232 | 22,502,712 | public String encodePassword(String password, byte[] salt) throws Exception {
if (salt == null) {
salt = new byte[12];
secureRandom.nextBytes(salt);
}
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(salt);
md.update(password.getBytes("UT... | public static String crypt(String passwd, boolean pad) {
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.update(passwd.getBytes());
String c = new String(sha.digest());
return toNumeric(c, pad, true);
} catch (java.security.NoSuchAlgo... | true |
897,840 | 2,831,663 | 13,029,548 | public void onMessage(Message message) {
LOG.debug("onMessage");
DownloadMessage downloadMessage;
try {
downloadMessage = new DownloadMessage(message);
} catch (JMSException e) {
LOG.error("JMS error: " + e.getMessage(), e);
return;
}
... | public String getUser() {
try {
HttpGet get = new HttpGet("http://twemoi.status.net/api/account/verify_credentials.xml");
consumer.sign(get);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
if (response != ... | false |
897,841 | 22,625,085 | 7,553,634 | @Transient
private String md5sum(String text) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(text.getBytes());
byte messageDigest[] = md.digest();
return bufferToHex(messageDigest, 0, messageDigest.length);
... | public static String calcolaMd5(String messaggio) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
md.reset();
md.update(messaggio.getBytes());
byte... | true |
897,842 | 20,661,433 | 21,319,238 | 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);
... | FileCacheInputStreamFountain(FileCacheInputStreamFountainFactory factory, InputStream in) throws IOException {
file = factory.createFile();
OutputStream out = new FileOutputStream(file);
IOUtils.copy(in, out);
in.close();
out.close();
}
| true |
897,843 | 14,288,306 | 3,799,026 | public static String encrypt(String senha) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(digest.digest());
} catch (NoSuchAlgorithmEx... | public RecordIterator(URL fileUrl, ModelDataFile modelDataFile) throws DataFileException {
this.modelDataFile = modelDataFile;
InputStream urlStream = null;
try {
urlStream = fileUrl.openStream();
} catch (IOException e) {
throw new DataFileException("Error op... | false |
897,844 | 7,726,949 | 23,294,396 | protected static String readUrl(URL url) throws IOException {
BufferedReader in = null;
StringBuffer buf = new StringBuffer();
try {
in = new BufferedReader(new InputStreamReader(url.openStream()));
final char[] charBuf = new char[1024];
int len = 0;
... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileOutputStream fos = new FileOutputStream(out);
FileChannel outChannel = fos.getChannel();
try {
inChannel.transferTo(0, inChannel.size(), o... | false |
897,845 | 18,048,834 | 13,646,834 | public void delete(DeleteInterceptorChain chain, DistinguishedName dn, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + this.dbInsertName);
if (con == null) {
throw new LDAPException("Operations Error", LDAP... | public TestReport runImpl() throws Exception {
String parser = XMLResourceDescriptor.getXMLParserClassName();
DocumentFactory df = new SAXDocumentFactory(GenericDOMImplementation.getDOMImplementation(), parser);
File f = (new File(testFileName));
URL url = f.toURL();
Document... | false |
897,846 | 2,736,183 | 13,904,781 | public static String getURLContent(String urlPath, String charset) {
BufferedReader reader = null;
HttpURLConnection conn = null;
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(urlPath);
HttpURLConnection.setFollowRedirects(false);
... | public void run() {
if (software == null) return;
Jvm.hashtable(HKEY).put(software, this);
try {
software.setException(null);
software.setDownloaded(false);
software.setDownloadStartTime(System.currentTimeMillis());
try {
softwa... | false |
897,847 | 2,832,003 | 431,295 | public static String computeDigest(String str, String alg) {
MessageDigest currentAlgorithm = null;
try {
currentAlgorithm = MessageDigest.getInstance(alg);
} catch (NoSuchAlgorithmException e) {
return str;
}
currentAlgorithm.reset();
currentA... | 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 |
897,848 | 11,288,113 | 21,426,410 | public AssemblyConfig load() {
AssemblyConfig assembly = null;
Digester digester = createParser();
try {
if (inputStream != null) {
if (logger.isDebugEnabled()) {
logger.debug("XML config loader is parsing an inputstream:" + inputStream);
... | public String parse(String queryText) throws ParseException {
try {
StringBuilder sb = new StringBuilder();
queryText = Val.chkStr(queryText);
if (queryText.length() > 0) {
URL url = new URL(getUrl(queryText));
InputStream in = url.openStre... | false |
897,849 | 924,033 | 3,732,503 | public static void main(String[] args) throws Exception {
InputStream in = null;
try {
in = new URL(args[0]).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
} finally {
IOUtils.closeStream(in);
}
}
| protected KMLRoot parseCachedKMLFile(URL url, String linkBase, String contentType, boolean namespaceAware) throws IOException, XMLStreamException {
KMLDoc kmlDoc;
InputStream refStream = url.openStream();
if (KMLConstants.KMZ_MIME_TYPE.equals(contentType)) kmlDoc = new KMZInputStream(refStre... | false |
897,850 | 6,926,155 | 14,768,963 | public boolean download(String address, String localFileName) {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
URL url = new URL(address);
out = new BufferedOutputStream(new FileOutputStream(localFileName));
conn =... | public static boolean exec_applet(String fname, VarContainer vc, ActionContainer ac, ThingTypeContainer ttc, Output OUT, InputStream IN, boolean AT, Statement state, String[] arggies) {
if (!urlpath.endsWith("/")) {
urlpath = urlpath + '/';
}
if (!urlpath.startsWith("http://")) {... | false |
897,851 | 17,553,389 | 10,852,631 | @Override
public boolean putUserDescription(String openID, String uuid, String description) throws DatabaseException {
if (uuid == null) throw new NullPointerException("uuid");
if (description == null) throw new NullPointerException("description");
try {
getConnection().setAu... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
final StringBuilder sbValueBeforeMD5 = new StringBuilder();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.fatal("", e);
return;
... | false |
897,852 | 9,354,771 | 18,544,889 | public void encryptPassword() {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
System.out.print(e);
}
try {
digest.update(passwordIn.getBytes("UTF-8"));
} catch (... | public static boolean delete(String url, int ip, int port) {
try {
HttpURLConnection request = (HttpURLConnection) new URL(url).openConnection();
request.setRequestMethod("DELETE");
request.setRequestProperty(GameRecord.GAME_IP_HEADER, String.valueOf(ip));
req... | false |
897,853 | 1,639,107 | 23,439,557 | 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 void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("arguments: sourcefile destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | true |
897,854 | 11,158,190 | 8,043,217 | 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 static Image getImage(URL url) throws IOException {
InputStream is = null;
try {
is = url.openStream();
Image img = getImage(is);
img.setUrl(url);
return img;
} finally {
if (is != null) {
is.close();
... | false |
897,855 | 19,897,048 | 7,088,303 | public void insertRight(final String right) throws IOException {
try {
Connection conn = null;
boolean autoCommit = false;
try {
conn = pool.getConnection();
autoCommit = conn.getAutoCommit();
conn.setAutoCommit(true);
... | public void delete(DeleteInterceptorChain chain, DistinguishedName dn, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + this.dbInsertName);
if (con == null) {
throw new LDAPException("Operations Error", LDAP... | true |
897,856 | 5,746,453 | 2,198,030 | private void getDownloadLink() throws Exception {
status = UploadStatus.GETTINGLINK;
NULogger.getLogger().info("Now Getting Download link...");
HttpClient client = new DefaultHttpClient();
HttpGet h = new HttpGet(uploadresponse);
h.setHeader("Referer", postURL);
if (z... | private void copy(String imgPath, String path) {
try {
File input = new File(imgPath);
File output = new File(path, input.getName());
if (output.exists()) {
if (!MessageDialog.openQuestion(getShell(), "Overwrite", "There is already an image file " + input.... | false |
897,857 | 7,292,100 | 4,758,044 | public Ftp(Resource resource, String basePath) throws Exception {
super(resource, basePath);
client = new FTPClient();
client.addProtocolCommandListener(new CommandLogger());
client.connect(resource.getString("host"), Integer.parseInt(resource.getString("port")));
client.logi... | private static void readServicesFromUrl(Collection<String> list, URL url) throws IOException {
InputStream in = url.openStream();
try {
if (in == null) return;
BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
while (true) {
... | false |
897,858 | 9,480,908 | 3,021,780 | 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);
... | private Integer getInt(String sequence) throws NoSuchSequenceException {
Connection conn = null;
PreparedStatement read = null;
PreparedStatement write = null;
boolean success = false;
try {
conn = ds.getConnection();
conn.setTransactionIsolation(conn.... | false |
897,859 | 9,918,348 | 7,093,300 | public static ArrayList[] imageSearch(String imageQuery, int startingIndex) {
try {
imageQuery = URLEncoder.encode(imageQuery, "UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
String queryS = new String(... | public static InputStream getRequest(String path) throws Exception {
HttpGet httpGet = new HttpGet(path);
HttpResponse httpResponse = sClient.execute(httpGet);
if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(httpResponse.getEnti... | false |
897,860 | 7,275,980 | 5,405,559 | public static void main(String[] args) throws IOException {
PostParameter a1 = new PostParameter("v", Utils.encode("1.0"));
PostParameter a2 = new PostParameter("api_key", Utils.encode(RenRenConstant.apiKey));
PostParameter a3 = new PostParameter("method", Utils.encode("notifications.send"))... | public void sort(int[] order, double[] values) {
int temp = 0;
boolean done = false;
for (int i = 0; i < values.length; i++) {
order[i] = i;
}
if (desendingValues) {
while (!done) {
done = true;
for (int i = values.lengt... | false |
897,861 | 330,216 | 18,317,332 | 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... | void execute(Connection conn, Component parent, String context, final ProgressMonitor progressMonitor, ProgressWrapper progressWrapper) throws Exception {
int noOfComponents = m_components.length;
Statement statement = null;
StringBuffer pmNoteBuf = new StringBuffer(m_update ... | false |
897,862 | 6,190,167 | 6,061,403 | public void xtest11() throws Exception {
PDFManager manager = new ITextManager();
InputStream pdf = new FileInputStream("/tmp/UML2.pdf");
InputStream page1 = manager.cut(pdf, 1, 1);
OutputStream outputStream = new FileOutputStream("/tmp/page.pdf");
IOUtils.copy(page1, outputS... | 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 |
897,863 | 7,911,674 | 19,800,554 | public static String getStringHash(String fileName) {
try {
MessageDigest digest = MessageDigest.getInstance("md5");
digest.reset();
digest.update(fileName.getBytes());
byte messageDigest[] = digest.digest();
StringBuilder builder = new StringBuild... | public MemoryTextBody(InputStream is, String mimeCharset) throws IOException {
this.mimeCharset = mimeCharset;
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(is, out);
out.close();
... | false |
897,864 | 16,518,661 | 10,798,829 | public String quebraLink(String link) throws StringIndexOutOfBoundsException {
link = link.replace(".url", "");
int cod = 0;
final String linkInit = link.replace("#", "");
boolean estado = false;
char letra;
String linkOrig;
String newlink = "";
linkOr... | private boolean handlePart(Part p) throws MessagingException, GetterException {
String filename = p.getFileName();
if (!p.isMimeType("multipart/*")) {
String disp = p.getDisposition();
if (disp == null || disp.equalsIgnoreCase(Part.ATTACHMENT)) {
if (checkCrit... | false |
897,865 | 23,403,205 | 11,343,453 | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | public static String getWebpage(String url) {
String content = "";
if (!url.trim().toLowerCase().startsWith("http://")) {
url = "http://" + url;
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
S... | false |
897,866 | 22,098,632 | 21,134,287 | private String getMd5(String base64image) {
String token = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(base64image.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
token = hash.toString(16);
} cat... | private List<Document> storeDocuments(List<Document> documents) {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
List<Document> newDocuments = new ArrayList<Document>();
try {
session.beginTransaction();
Preference preference = new Preference... | false |
897,867 | 7,823,489 | 18,661,682 | protected String getPostRequestContent(String urlText, String postParam) throws Exception {
URL url = new URL(urlText);
HttpURLConnection urlcon = (HttpURLConnection) url.openConnection();
String line = null;
try {
urlcon.setRequestMethod("POST");
urlcon.setUs... | public static OMElement createOMRequest(String file, int count, String[] documentIds) throws Exception {
ObjectFactory factory = new ObjectFactory();
SubmitDocumentRequest sdr = factory.createSubmitDocumentRequest();
IdType pid = factory.createIdType();
pid.setRoot("1.3.6.1.4.1.21367... | false |
897,868 | 1,728,000 | 13,462,484 | public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException {
if (baseName == null || locale == null || format == null || loader == null) throw new NullPointerException();
... | public static GoogleResponse getElevation(String lat, String lon) throws IOException {
String url = "http://maps.google.com/maps/api/elevation/xml?locations=";
url = url + String.valueOf(lat);
url = url + ",";
url = url + String.valueOf(lon);
url = url + "&sensor=false";
... | false |
897,869 | 17,615,293 | 11,113,074 | public BufferedImage process(final InputStream is, DjatokaDecodeParam params) throws DjatokaException {
if (isWindows) return processUsingTemp(is, params);
ArrayList<Double> dims = null;
if (params.getRegion() != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
... | public void backupXML() {
try {
TimeStamp timeStamp = new TimeStamp();
String fnameIn = this.fnameXML();
String pathBackup = this.pathXML + "\\Backup\\";
String fnameOut = fnameIn.substring(fnameIn.indexOf(this.fname), fnameIn.length());
fnameOut =... | true |
897,870 | 15,629,443 | 16,543,560 | public static String encryptPassword(String password) throws PasswordException {
String hash = null;
if (password != null && !password.equals("")) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
... | public String login() {
String authSuccess = "false";
try {
String errorMesg = "";
int error;
if ((error = utils.stringIsNull(passwd)) != -1) {
errorMesg += rb.getString("passwdField") + ": " + utils.errors[error] + " ";
} else if ((err... | true |
897,871 | 14,446,404 | 21,664,404 | @Override
public void convert() throws Exception {
URL url = new URL("http://qsardb.jrc.it/qmrf/download.jsp?filetype=xml&id=" + Integer.parseInt(this.id));
InputStream is = url.openStream();
try {
QMRF qmrf = QmrfUtil.loadQmrf(is);
Qmrf2Qdb.convert(getQdb(), qmrf... | public void store(Component component, String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("UPDATE component_prop " + "SET size_height = ?, size_width = ?, pos_x = ?, pos_y = ? " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.setI... | false |
897,872 | 4,776,985 | 7,015,918 | public static ByteBuffer join(ByteBuffer buffer1, ByteBuffer buffer2) {
if (buffer2 == null || buffer2.remaining() == 0) return NIOUtils.copy(buffer1);
if (buffer1 == null || buffer1.remaining() == 0) return NIOUtils.copy(buffer2);
ByteBuffer buffer = ByteBuffer.allocate(buffer1.remaining() ... | public static void copy(File srcDir, File dstDir) throws IOException {
if (srcDir.isDirectory()) {
if (!dstDir.exists()) dstDir.mkdir();
String[] children = srcDir.list();
for (int i = 0; i < children.length; i++) copy(new File(srcDir, children[i]), new File(dstDir, child... | true |
897,873 | 23,525,479 | 19,394,412 | protected static final void copyFile(String from, String to) throws SeleniumException {
try {
java.io.File fileFrom = new File(from);
java.io.File fileTo = new File(to);
FileReader in = new FileReader(fileFrom);
FileWriter out = new FileWriter(fileTo);
... | public static long checksum(IFile file) throws IOException {
InputStream contents;
try {
contents = file.getContents();
} catch (CoreException e) {
throw new CausedIOException("Failed to calculate checksum.", e);
}
CheckedInputStream in = new CheckedIn... | true |
897,874 | 467,550 | 106,595 | 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 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 |
897,875 | 370,458 | 16,850,376 | public static void copy(URL url, String outPath) throws IOException {
System.out.println("copying from: " + url + " to " + outPath);
InputStream in = url.openStream();
FileOutputStream fout = new FileOutputStream(outPath);
byte[] data = new byte[8192];
int read = -1;
... | public static void uncompress(File srcFile, File destFile) throws IOException {
InputStream input = null;
OutputStream output = null;
try {
input = new GZIPInputStream(new FileInputStream(srcFile));
output = new BufferedOutputStream(new FileOutputStream(destFile));
... | false |
897,876 | 14,900,320 | 11,751,791 | @Override
public User updateUser(User bean) throws SitoolsException {
checkUser();
Connection cx = null;
try {
cx = ds.getConnection();
cx.setAutoCommit(false);
PreparedStatement st;
int i = 1;
if (bean.getSecret() != null && !"... | private void connect(URL url) throws IOException {
String protocol = url.getProtocol();
if (!protocol.equals("http")) throw new IllegalArgumentException("URL must use 'http:' protocol");
int port = url.getPort();
if (port == -1) port = 80;
fileName = url.getFile();
co... | false |
897,877 | 4,518,933 | 7,005,226 | 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.... | private void copyValidFile(File file, int cviceni) {
try {
String filename = String.format("%s%s%02d%s%s", validovane, File.separator, cviceni, File.separator, file.getName());
boolean copy = false;
File newFile = new File(filename);
if (newFile.exists()) {
... | true |
897,878 | 8,446,877 | 7,407,008 | public static byte[] ComputeForText(String ThisString) throws Exception {
byte[] Result;
MessageDigest MD5Hasher;
MD5Hasher = MessageDigest.getInstance("MD5");
MD5Hasher.update(ThisString.replaceAll("\r", "").getBytes("iso-8859-1"));
Result = MD5Hasher.digest();
retur... | public static Image loadImage(String path) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = mainFrame.getClass().getResourceAsStream(path);
if (in == null) throw new RuntimeException("Ressource " + path + " not found");
try {
IOUtils.copy(in, ou... | false |
897,879 | 4,937,926 | 1,008,326 | @Override
public RServiceResponse execute(final NexusServiceRequest inData) throws NexusServiceException {
final RServiceRequest data = (RServiceRequest) inData;
final RServiceResponse retval = new RServiceResponse();
final StringBuilder result = new StringBuilder("R service call results... | public long copyDirAllFilesToDirectoryRecursive(String baseDirStr, String destDirStr, boolean copyOutputsRtIDsDirs) throws Exception {
long plussQuotaSize = 0;
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.... | true |
897,880 | 8,320,377 | 4,557,988 | private static String md5(String pwd) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(pwd.getBytes(), 0, pwd.length());
return new BigInteger(1, md5.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
e.printStackTra... | public Attributes getAttributes() throws SchemaViolationException, NoSuchAlgorithmException, UnsupportedEncodingException {
BasicAttributes outAttrs = new BasicAttributes(true);
BasicAttribute oc = new BasicAttribute("objectclass", "inetOrgPerson");
oc.add("organizationalPerson");
oc... | true |
897,881 | 21,456,136 | 5,169,138 | @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "getLocalPrincipal", args = { })
public final void test_getLocalPrincipal() {
try {
URL url = new URL("https://localhost:55555");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
... | public final void run() {
active = true;
String s = findcachedir();
uid = getuid(s);
try {
File file = new File(s + "main_file_cache.dat");
if (file.exists() && file.length() > 0x3200000L) file.delete();
cache_dat = new RandomAccessFile(s + "main_f... | false |
897,882 | 5,824,704 | 941,896 | @Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, final HttpServletResponse response) throws Exception {
final String id = request.getParameter("id");
if (id == null) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return null;
... | 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 |
897,883 | 19,710,228 | 18,397,102 | public void init(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes("UTF-8"), 0, password.length());
byte[] rawKey = md.digest();
skeySpec = new SecretKeySpec(rawKey, "AES");
ivSpec = new IvPar... | protected void extractArchive(File archive) {
ZipInputStream zis = null;
FileOutputStream fos;
ZipEntry entry;
File curEntry;
int n;
try {
zis = new ZipInputStream(new FileInputStream(archive));
while ((entry = zis.getNextEntry()) != null) {
... | false |
897,884 | 9,456,659 | 9,792,904 | public static String getHash(String text) {
if (text == null) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
byte[] hashedTextBytes = md.digest();
BigInteger hashedTextBigInteger = new BigInteger(1, ... | public static 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();
... | true |
897,885 | 4,464,301 | 727,183 | protected void shutdown(final boolean unexpected) {
ControlerState oldState = this.state;
this.state = ControlerState.Shutdown;
if (oldState == ControlerState.Running) {
if (unexpected) {
log.warn("S H U T D O W N --- received unexpected shutdown request.");
... | 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 |
897,886 | 3,883,870 | 12,096,098 | public String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | public static String calculatesMD5(String plainText) throws NoSuchAlgorithmException {
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(plainText.getBytes());
byte[] digest = mdAlgorithm.digest();
StringBuffer hexString = new StringBuffer();
fo... | true |
897,887 | 19,288,024 | 4,224,228 | private void copyFile(File file, File dir) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(file));
BufferedWriter out = new BufferedWriter(new FileWriter(new File(dir.getAbsolutePath() + File.separator + file.getName())));
char[] buffer = new char[512];
int... | public static 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();
... | false |
897,888 | 21,426,410 | 13,207,438 | public String parse(String queryText) throws ParseException {
try {
StringBuilder sb = new StringBuilder();
queryText = Val.chkStr(queryText);
if (queryText.length() > 0) {
URL url = new URL(getUrl(queryText));
InputStream in = url.openStre... | public String sendRequestHTTPTunelling(java.lang.String servletName, java.lang.String request) {
String reqxml = "";
org.jdom.Document retdoc = null;
String myurl = java.util.prefs.Preferences.systemRoot().get("serverurl", "");
String myport = java.util.prefs.Preferences.systemRoot()... | true |
897,889 | 15,236,847 | 19,296,521 | private static MapEntry<String, Properties> loadFpmConf() throws ConfigurationReadException {
MapEntry<String, Properties> ret = null;
Scanner sc = new Scanner(CONF_PATHS).useDelimiter(SEP_P);
String prev = "";
while (sc.hasNext() && !hasLoaded) {
Properties fpmConf = nul... | private InputStream get(String url, long startOffset, long expectedLength) throws ClientProtocolException, IOException {
url = normalizeUrl(url);
Log.i(LOG_TAG, "Get " + url);
mHttpGet = new HttpGet(url);
int expectedStatusCode = HttpStatus.SC_OK;
if (... | false |
897,890 | 14,317,426 | 22,923,598 | 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.... | public static String getCssFile(String url) {
StringBuffer buffer = new StringBuffer();
try {
buffer = new StringBuffer();
URL urlToCrawl = new URL(url);
URLConnection urlToCrawlConnection = urlToCrawl.openConnection();
urlToCrawlConnection.setRequestP... | false |
897,891 | 19,842,959 | 21,570,965 | public boolean receiveFile(FileDescriptor fileDescriptor) {
try {
byte[] block = new byte[1024];
int sizeRead = 0;
int totalRead = 0;
File dir = new File(Constants.DOWNLOAD_DIR + fileDescriptor.getLocation());
if (!dir.exists()) {
d... | public static void main(String[] args) throws FileNotFoundException, IOException {
String filePath = "/Users/francisbaril/Downloads/test-1.pdf";
String testFilePath = "/Users/francisbaril/Desktop/testpdfbox/test.pdf";
File file = new File(filePath);
final File testFile = new File(tes... | true |
897,892 | 15,202,805 | 16,864,880 | public static String getDigest(String user, String realm, String password, String method, String uri, String nonce, String nc, String cnonce, String qop) {
String digest1 = user + ":" + realm + ":" + password;
String digest2 = method + ":" + uri;
try {
MessageDigest digestOne = M... | public String md5(String phrase) {
MessageDigest m;
String coded = new String();
try {
m = MessageDigest.getInstance("MD5");
m.update(phrase.getBytes(), 0, phrase.length());
coded = (new BigInteger(1, m.digest()).toString(16)).toString();
} catch (... | true |
897,893 | 14,778,832 | 7,366,687 | private boolean runValidation(PropertyMap map, URL url, URL schema) {
ValidationDriver vd = new ValidationDriver(map);
try {
vd.loadSchema(new InputSource(schema.openStream()));
return vd.validate(new InputSource(url.openStream()));
} catch (SAXException e) {
... | public static void DecodeMapFile(String mapFile, String outputFile) throws Exception {
byte magicKey = 0;
byte[] buffer = new byte[2048];
int nread;
InputStream map;
OutputStream output;
try {
map = new FileInputStream(mapFile);
} catch (Exception ... | false |
897,894 | 15,461,843 | 20,965,286 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public void openAndClose(ZKEntry zke, LinkedList toOpen, LinkedList toRemove) throws SQLException {
conn.setAutoCommit(false);
try {
Statement stm = conn.createStatement();
ResultSet rset = stm.executeQuery("SELECT now();");
rset.next();
Timestamp now ... | false |
897,895 | 19,910,630 | 22,346,314 | 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... | public URLConnection makeURLcon() {
URI uri;
URL url;
try {
uri = new URI(this.URLString);
url = uri.toURL();
this.urlcon = (HttpURLConnection) url.openConnection();
} catch (final URISyntaxException e) {
e.printStackTrace();
} ... | false |
897,896 | 1,139,230 | 12,977,779 | public static File copyFile(File srcFile, File destFolder, FileCopyListener copyListener) {
File dest = new File(destFolder, srcFile.getName());
try {
FileInputStream in = new FileInputStream(srcFile);
FileOutputStream out = new FileOutputStream(dest);
byte[] read... | public void run() {
FileInputStream src;
FileOutputStream dest;
try {
dest = new FileOutputStream(srcName);
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
}
FileChannel destC = dest.getChannel();
FileChanne... | true |
897,897 | 20,020,133 | 5,430,189 | private boolean loadSymbol(QuoteCache quoteCache, Symbol symbol, TradingDate startDate, TradingDate endDate) {
boolean success = true;
String URLString = constructURL(symbol, startDate, endDate);
PreferencesManager.ProxyPreferences proxyPreferences = PreferencesManager.loadProxySettings();
... | public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
... | false |
897,898 | 21,752,108 | 23,618,963 | 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());
... | public static void copyFile(File src, File dst) {
try {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dst);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = fis.read(buf... | true |
897,899 | 5,498,222 | 3,788,863 | public static void copyFile(String inputFile, String outputFile) throws IOException {
FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
for (int b = fis.read(); b != -1; b = fis.read()) fos.write(b);
fos.close();
fi... | public static void home4www(String location) throws NetworkException {
HttpClient client = HttpUtil.newInstance();
HttpGet get = new HttpGet(HttpUtil.KAIXIN_WWW_URL + location);
HttpUtil.setHeader(get);
try {
HttpResponse response = client.execute(get);
HTTPUt... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.