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 |
|---|---|---|---|---|---|
2,500 | 555,928 | 13,547,845 | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | public static PortalConfig install(File xml, File dir) throws IOException, ConfigurationException {
if (!dir.exists()) {
log.info("Creating directory {}", dir);
dir.mkdirs();
}
if (!xml.exists()) {
log.info("Installing default configuration to {}", xml);
... | true |
2,501 | 8,559,629 | 15,660,054 | public static String httpGetJson(final List<NameValuePair> nameValuePairs) {
HttpClient httpclient = null;
String data = "";
URI uri = null;
try {
final String paramString = URLEncodedUtils.format(nameValuePairs, "utf-8");
if (HTTPS) {
final Sc... | public static List<PluginInfo> getPluginInfos(String urlRepo) throws MalformedURLException, IOException {
XStream xStream = new XStream();
xStream.alias("plugin", PluginInfo.class);
xStream.alias("plugins", List.class);
List<PluginInfo> infos = null;
URL url;
Buffered... | true |
2,502 | 5,553,144 | 18,616,801 | private void initStreams() throws IOException {
if (audio != null) {
audio.close();
}
if (url != null) {
audio = new OggInputStream(url.openStream());
} else {
audio = new OggInputStream(ResourceLoader.getResourceAsStream(ref));
}
}
| protected InputStream getAudioStream() {
InputStream in = null;
try {
URL url = getAudioURL();
if (url != null) in = url.openStream();
} catch (IOException ex) {
System.err.println(ex);
}
return in;
}
| false |
2,503 | 22,131,351 | 13,908 | private IMolecule readMolecule() throws Exception {
String xpath = "";
if (index.equals("ichi")) {
xpath = URLEncoder.encode("//molecule[./identifier/basic='" + query + "']", UTF8);
} else if (index.equals("kegg")) {
xpath = URLEncoder.encode("//molecule[./@name='" + ... | 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;
... | false |
2,504 | 16,704,464 | 21,374,275 | public static void main(String[] args) {
File directory = new File(args[0]);
File[] files = directory.listFiles();
try {
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(args[1])));
for (int i = 0; i < files.length; i++) {
Buffere... | 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... | true |
2,505 | 19,260,977 | 17,477,953 | public int[] sort() {
boolean t = true;
int temp = 0;
int[] mas = new int[N];
Random rand = new Random();
for (int i = 0; i < N; i++) {
mas[i] = rand.nextInt(10) + 1;
}
while (t) {
t = false;
for (int i = 0; i < mas.length -... | public static void createModelZip(String filename, String tempdir, boolean overwrite) throws Exception {
FileTools.checkOutput(filename, overwrite);
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(filename);
ZipOutputStream out = new ZipOutputStream(ne... | false |
2,506 | 10,013,939 | 10,836,108 | public Object execute(ExecutionEvent event) throws ExecutionException {
try {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
QuizTreeView view = (QuizTreeView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.rcpquizen... | public static void main(String[] args) {
LogFrame.getInstance();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.trim().startsWith(DEBUG_PARAMETER_NAME + "=")) {
properties.put(DEBUG_PARAMETER_NAME, arg.trim().substring(DEBUG_PARAMETER_NA... | false |
2,507 | 2,245,320 | 20,597,304 | void writeToFile(String dir, InputStream input, String fileName) throws FileNotFoundException, IOException {
makeDirs(dir);
FileOutputStream fo = null;
try {
System.out.println(Thread.currentThread().getName() + " : " + "Writing file " + fileName + " to path " + dir);
... | public void addPropertyColumns(WCAChannel destination, Set<Property> properties) throws SQLException {
Session session = HibernateUtil.getSessionFactory().openSession();
Connection con = session.connection();
try {
createPropertyTable(destination);
extendPropertyList(... | false |
2,508 | 20,654,481 | 11,568,400 | private ParserFileReader createParserFileReader(final FromNetRecord record) throws IOException {
final String strUrl = record.getStrUrl();
ParserFileReader parserFileReader;
try {
parserFileReader = parserFileReaderFactory.create(strUrl);
} catch (Exception exception) {
... | private InputStream getInputStream(URI uri) throws IOException {
if (Logging.SHOW_FINE && LOG.isLoggable(Level.FINE)) {
LOG.fine("Loading ACL : " + uri.toString());
}
URL url = uri.toURL();
URLConnection connection = url.openConnection();
connection.setDoInput(tru... | false |
2,509 | 11,651,293 | 12,312,914 | public void render(final HttpServletRequest request, final HttpServletResponse response, final byte[] bytes, final Throwable t, final String contentType, final String encoding) throws Exception {
if (contentType != null) {
response.setContentType(contentType);
}
if (encoding != n... | public static void testclass(String[] args) throws IOException, CodeCheckException {
ClassWriter writer = new ClassWriter();
writer.emptyClass(ClassWriter.ACC_PUBLIC, "TestClass", "java/lang/Object");
MethodInfo newMethod = writer.addMethod(ClassWriter.ACC_PUBLIC | ClassWriter.ACC_STATIC, "m... | true |
2,510 | 21,014,321 | 1,416,342 | public static Search Search(String searchString) throws Exception {
Uri.Builder builder = new Uri.Builder();
builder.scheme("http");
builder.authority("www.goodreads.com");
builder.path("search/search");
builder.appendQueryParameter("format", "xml");
builder.appendQue... | public void run() {
for (int i = 0; i < iClNumberOfCycles; i++) {
try {
long lStartTime = System.currentTimeMillis();
InputStream in = urlClDestinationURL.openStream();
byte buf[] = new byte[1024];
int num;
while ((n... | false |
2,511 | 17,141,933 | 10,345,032 | public static InputSource getInputSource(URL url) throws IOException {
String proto = url.getProtocol().toLowerCase();
if (!("http".equals(proto) || "https".equals(proto))) throw new IllegalArgumentException("OAI-PMH only allows HTTP(S) as network protocol!");
HttpURLConnection conn = (HttpU... | private String GetStringFromURL(String URL) {
InputStream in = null;
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
String outstring = "";
try {
java.net.URL url = new java.net.URL(URL);
in = url.openStream();
... | true |
2,512 | 13,292,327 | 470,160 | 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... | 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 |
2,513 | 1,050,422 | 8,701,067 | public static String getSHA1Digest(String inputStr) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
byte[] sha1hash = null;
md = MessageDigest.getInstance("SHA");
sha1hash = new byte[40];
md.update(inputStr.getBytes("iso-8859-1"), 0, i... | public void markAsCachedHelper(Item item, Date from, Date to, Map<String, Boolean> properties) {
if (properties.size() == 0) {
return;
}
Connection conn = null;
Iterable<Integer> props = representer.getInternalReps(properties.keySet());
Integer hostIndex = represe... | false |
2,514 | 7,421,563 | 12,682,066 | private StringBuffer encoder(String arg) {
if (arg == null) {
arg = "";
}
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(arg.getBytes(SysConstant.charset));
} catch (Exception e) {
e.printStac... | public static void decompressGZIP(File gzip, File to, long skip) throws IOException {
GZIPInputStream gis = null;
BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(new FileOutputStream(to));
FileInputStream fis = new FileInputStream(gzip);
... | false |
2,515 | 7,409,728 | 20,491,150 | protected void innerProcess(CrawlURI curi) throws InterruptedException {
if (!curi.isHttpTransaction()) {
return;
}
if (!TextUtils.matches("^text.*$", curi.getContentType())) {
return;
}
long maxsize = DEFAULT_MAX_SIZE_BYTES.longValue();
try {
... | private void retrieveClasses(URL url, Map<String, T> cmds) {
try {
String resource = URLDecoder.decode(url.getPath(), "UTF-8");
File directory = new File(resource);
if (directory.exists()) {
String[] files = directory.list();
for (String fi... | false |
2,516 | 5,914,388 | 21,822,159 | public static void main(String[] args) throws IOException {
String urltext = "http://www.vogella.de";
URL url = new URL(urltext);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
... | private void loadMtlFile(URL url) throws IOException {
InputStream is = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
int linecounter = 0;
String[] params = null;
try {
String line;
Material mtl = null;
... | true |
2,517 | 15,708,288 | 3,180,857 | private Response postRequest(String urlString, String params) throws Exception {
URL url = new URL(urlString);
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
uc.setUseCaches(false);
uc.setAllowUserInteractio... | void load(URL url) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()));
Vector3f scale = new Vector3f(1, 1, 1);
Group currentGroup = new Group();
currentGroup.name = "default";
groups.add(currentGroup);
String line;
... | false |
2,518 | 8,561,747 | 8,085,496 | public static boolean copyFile(File source, File dest) throws IOException {
int answer = JOptionPane.YES_OPTION;
if (dest.exists()) {
answer = JOptionPane.showConfirmDialog(null, "File " + dest.getAbsolutePath() + "\n already exists. Overwrite?", "Warning", JOptionPane.YES_NO_OPTION);
... | public MemoryBinaryBody(InputStream is) throws IOException {
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(is, out);
out.close();
tempFile = out.toByteArray();
}
| true |
2,519 | 19,488,257 | 15,873,054 | public static boolean copy(final File from, final File to) {
if (from.isDirectory()) {
to.mkdirs();
for (final String name : Arrays.asList(from.list())) {
if (!copy(from, to, name)) {
if (COPY_DEBUG) {
System.out.println("Fa... | public static final long copyFile(final File srcFile, final File dstFile, final long cpySize) throws IOException {
if ((null == srcFile) || (null == dstFile)) return (-1L);
final File dstFolder = dstFile.getParentFile();
if ((!dstFolder.exists()) && (!dstFolder.mkdirs())) throw new IOExcepti... | true |
2,520 | 3,636,960 | 3,436,001 | public void display(WebPage page, HttpServletRequest req, HttpServletResponse resp) throws DisplayException {
page.getDisplayInitialiser().initDisplay(new HttpRequestDisplayContext(req), req);
StreamProvider is = (StreamProvider) req.getAttribute(INPUTSTREAM_KEY);
if (is == null) {
... | public static void copyFile(File in, File out) {
if (!in.exists() || !in.canRead()) {
LOGGER.warn("Can't copy file : " + in);
return;
}
if (!out.getParentFile().exists()) {
if (!out.getParentFile().mkdirs()) {
LOGGER.info("Didn't create par... | true |
2,521 | 2,235,431 | 13,064,742 | private LinkedList<Datum> processDatum(Datum dataset) {
ArrayList<Object[]> markerTestResults = new ArrayList<Object[]>();
ArrayList<Object[]> alleleEstimateResults = new ArrayList<Object[]>();
boolean hasAlleleNames = false;
String blank = new String("");
MarkerPhenotypeAdap... | public DataRecord addRecord(InputStream input) throws DataStoreException {
File temporary = null;
try {
temporary = newTemporaryFile();
DataIdentifier tempId = new DataIdentifier(temporary.getName());
usesIdentifier(tempId);
long length = 0;
... | true |
2,522 | 20,825,937 | 12,120,684 | public void createMd5Hash() {
try {
String vcardObject = new ContactToVcard(TimeZone.getTimeZone("UTC"), "UTF-8").convert(this);
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(vcardObject.getBytes());
this.md5Hash = new BigInteger(m.digest()).toS... | private void getRandomGUID(boolean secure) {
MessageDigest md5;
StringBuilder sbValueBeforeHash = new StringBuilder();
try {
md5 = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
throw new ApplicationIllegalArgumentException(e);
... | true |
2,523 | 17,927,694 | 946,865 | public static void copyFile(FileInputStream source, FileOutputStream target) throws Exception {
FileChannel inChannel = source.getChannel();
FileChannel outChannel = target.getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOException e) ... | 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 |
2,524 | 6,771,711 | 17,239,344 | @SuppressWarnings("deprecation")
public static final ReturnCode runCommand(IOBundle io, String[] args) {
if ((args.length < 3) || (args.length > 4)) return ReturnCode.makeReturnCode(ReturnCode.RET_INVALID_NUM_ARGS, "Invalid number of arguments: " + args.length);
if ((args.length == 3) && (!args[... | @Override
public void doMove(File from, File to) throws IOException {
int res = showConfirmation("File will be moved in p4, are you sure to move ", from.getAbsolutePath());
if (res == JOptionPane.NO_OPTION) {
return;
}
Status status = fileS... | true |
2,525 | 820,872 | 10,118,785 | 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... | @Override
public void download(String remoteFilePath, String localFilePath) {
InputStream remoteStream = null;
try {
remoteStream = client.get(remoteFilePath);
} catch (IOException e) {
e.printStackTrace();
}
OutputStream localStream = null;
... | true |
2,526 | 22,516,784 | 3,298,288 | public static void ftpUpload(FTPConfig config, String directory, File file, String remoteFileName) throws IOException {
FTPClient server = new FTPClient();
server.connect(config.host, config.port);
assertValidReplyCode(server.getReplyCode(), server);
server.login(config.userName, con... | public static String remove_file(String sessionid, String key) {
String resultJsonString = "some problem existed inside the create_new_tag() function if you see this string";
try {
Log.d("current running function name:", "remove_file");
HttpClient httpclient = new DefaultHttp... | false |
2,527 | 19,826,765 | 1,884,327 | private String xifraPassword() throws Exception {
String password2 = instance.getUsuaris().getPassword2();
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(password2.getBytes(), 0, password2.length());
password2 = new BigInteger(1, m.digest()).toString(16);
return... | public void actionPerformed(java.awt.event.ActionEvent e) {
try {
setStatus(DigestSignTask.RESET, "");
if (e.getSource() == sd) if (retriveEncodedDigestFromServer()) setStatus(DigestSignTask.RESET, "Inserire il pin e battere INVIO per firmare.");
if (e.getSource() == pwd)... | true |
2,528 | 17,052,257 | 10,140,299 | public static String encriptar(String string) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
throw new Exception("Algoritmo de Criptografia não encontrado... | protected static byte[] hashPassword(byte[] saltBytes, String plaintextPassword) throws AssertionError {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw (AssertionError) new AssertionError("No MD5 me... | true |
2,529 | 4,519,500 | 23,411,499 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String pathInfo = req.getPathInfo();
String pluginPathInfo = pathInfo.substring(prefix.length());
String gwtPathInfo = pluginPathInfo.substring(pluginKey.length() + 1);... | public void playSIDFromURL(String name) {
player.reset();
player.setStatus("Loading song: " + name);
URL url;
try {
if (name.startsWith("http")) {
url = new URL(name);
} else {
url = getResource(name);
}
... | false |
2,530 | 22,328,842 | 5,375,381 | protected void doBackupOrganizeType() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strSelQuery = "SELECT organize_type_id,organize_type_name,width " + "FROM " + Common.ORGANIZE_TYPE_TABLE;
String strInsQuery = "INSERT ... | public TempFileBinaryBody(InputStream is) throws IOException {
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
tempFile = tempPath.createTempFile("attachment", ".bin");
OutputStream out = tempFile.getOutputStream();
IOUtils.copy(is, out);
out.close();
}
| false |
2,531 | 16,454,974 | 10,337,386 | @Override
public int write(FileStatus.FileTrackingStatus fileStatus, InputStream input, PostWriteAction postWriteAction) throws WriterException, InterruptedException {
String key = logFileNameExtractor.getFileName(fileStatus);
int wasWritten = 0;
FileOutputStreamPool fileOutputStreamPool... | protected void zipFile(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(to));
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = in.read(buffer)) != -1) ou... | true |
2,532 | 9,632,237 | 11,560,551 | private boolean copy_to_file_io(File src, File dst) throws IOException {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(src);
is = new BufferedInputStream(is);
os = new FileOutputStream(dst);
os = new BufferedOutp... | 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... | true |
2,533 | 17,557,352 | 30,237 | 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;
... | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | true |
2,534 | 4,519,500 | 15,999,201 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String pathInfo = req.getPathInfo();
String pluginPathInfo = pathInfo.substring(prefix.length());
String gwtPathInfo = pluginPathInfo.substring(pluginKey.length() + 1);... | @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... | true |
2,535 | 17,831,556 | 15,123,906 | public static String generateHash(String msg) throws NoSuchAlgorithmException {
if (msg == null) {
throw new IllegalArgumentException("Input string can not be null");
}
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(msg.getBytes());
... | private void connectAndLogin() throws SocketException, IOException, ClassNotFoundException, SQLException, FileNotFoundException {
lastOperationTime = System.currentTimeMillis();
exit();
ftp = new FTPClient();
ftp.connect(SERVER);
ftp.login(USERNAME, PASSWORD);
ftp.ent... | false |
2,536 | 750,310 | 13,292,327 | public static boolean changeCredentials() {
boolean passed = false;
boolean credentials = false;
HashMap info = null;
Debug.log("Main.changeCredentials", "show dialog for userinfo");
info = getUserInfo();
if ((Boolean) info.get("submit")) {
try {
... | 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... | false |
2,537 | 12,297,431 | 2,048,627 | public void actionPerformed(ActionEvent ae) {
String actionCommand = ae.getActionCommand();
if (actionCommand == null) {
return;
}
if (DataManager.SHOW_DEBUG) {
System.out.println("Action command : " + actionCommand);
}
DataManager dataManager ... | private void addLocale(Locale locale) throws MissingResourceException {
locale = stripVariant(locale);
Map<String, String> props = localeToMap.get(locale);
if (props == null) props = new HashMap<String, String>();
String urlName = locale.toString() + LOCALE_FILE_URL_SUFFIX;
U... | false |
2,538 | 17,999,564 | 16,397,911 | 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... | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | true |
2,539 | 20,438,542 | 7,604,737 | public static Shader loadShader(String vspath, String fspath, int textureUnits, boolean separateCam, boolean fog) throws ShaderProgramProcessException {
if (vspath == "" || fspath == "") return null;
BufferedReader in;
String vert = "", frag = "";
try {
URL v_url = Graphi... | public String get(String url) {
String buf = null;
StringBuilder resultBuffer = new StringBuilder(512);
if (debug.DEBUG) debug.logger("gov.llnl.tox.util.href", "get(url)>> " + url);
try {
URL theURL = new URL(url);
URLConnection urlConn = theURL.openConnection... | true |
2,540 | 3,046,107 | 12,420,484 | public GGProvinces getListProvinces() throws IllegalStateException, GGException, Exception {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("method", "gg.photos.geo.getListProvinces"));
qparams.add(new BasicNameValuePair("key", this.key));
... | public static void sendData(final HashMap<String, String> data) {
YProgressWindowRepeat y = new YProgressWindowRepeat(I18N.t("Send Data to yaams.de"));
try {
final StringBuffer send = new StringBuffer("1=1");
for (final String key : data.keySet()) {
send.appen... | false |
2,541 | 18,790,182 | 14,429,171 | public void testAddingEntries() throws Exception {
DiskCache c = new DiskCache();
{
c.setRoot(rootFolder.getAbsolutePath());
c.setHtmlExtension("htm");
c.setPropertiesExtension("txt");
assertEquals("htm", c.getHtmlExtension());
assertEquals... | public void salva(UploadedFile imagem, Usuario usuario) {
File destino;
if (usuario.getId() == null) {
destino = new File(pastaImagens, usuario.hashCode() + ".jpg");
} else {
destino = new File(pastaImagens, usuario.getId() + ".jpg");
}
try {
... | true |
2,542 | 13,703,886 | 4,471,001 | public static String encriptarContrasena(String contrasena) throws NoSuchAlgorithmException, UnsupportedEncodingException {
StringBuffer sb = new StringBuffer();
MessageDigest md = MessageDigest.getInstance("SHA-512");
md.update(contrasena.getBytes("UTF-8"));
byte[] digestBytes = md.... | 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.... | false |
2,543 | 7,468,829 | 172,460 | public static String doGetWithBasicAuthentication(URL url, String username, String password, int timeout, Map<String, String> headers) throws Throwable {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setDoInput(true);
if (username ... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
2,544 | 5,590,065 | 41,672 | protected String readFileUsingHttp(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProper... | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | false |
2,545 | 18,349,315 | 4,542,694 | public static boolean copyFile(File from, File to, byte[] buf) {
if (buf == null) buf = new byte[BUFFER_SIZE];
FileInputStream from_s = null;
FileOutputStream to_s = null;
try {
from_s = new FileInputStream(from);
to_s = new FileOutputStream(to);
f... | @Override
public InputStream getInputStream() throws IOException {
if (dfos == null) {
int deferredOutputStreamThreshold = Config.getInstance().getDeferredOutputStreamThreshold();
dfos = new DeferredFileOutputStream(deferredOutputStreamThreshold, Definitions.PROJECT_NAME, "." + D... | true |
2,546 | 11,650,020 | 2,646,424 | public static String encrypt(String message) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(message.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(digest.digest());
} catch (NoSuchAlgorit... | public String downloadFromUrl(URL url) {
BufferedReader dis;
String content = "";
HttpURLConnection urlConn = null;
try {
urlConn = (HttpURLConnection) url.openConnection();
urlConn.setDoInput(true);
urlConn.setUseCaches(false);
urlConn... | false |
2,547 | 20,517,803 | 16,993,715 | public String execute(HttpServletRequest request, HttpServletResponse response, User user, String parameter) throws Exception {
long resourceId = ServletRequestUtils.getLongParameter(request, "resourceId", 0L);
BinaryAttribute binaryAttribute = resourceManager.readAttribute(resourceId, parameter, us... | public static boolean copyFile(String fromfile, String tofile) {
File from = new File(fromfile);
File to = new File(tofile);
if (!from.exists()) return false;
if (to.exists()) {
log.error(tofile + "exists already");
return false;
}
BufferedInpu... | true |
2,548 | 18,178,530 | 22,177,057 | public static void copyFile(File src, File dst) throws IOException {
LOGGER.info("Copying file '" + src.getAbsolutePath() + "' to '" + dst.getAbsolutePath() + "'");
FileChannel in = null;
FileChannel out = null;
try {
FileInputStream fis = new FileInputStream(src);
... | private void saveFile(File destination) {
InputStream in = null;
OutputStream out = null;
try {
if (fileScheme) in = new BufferedInputStream(new FileInputStream(source.getPath())); else in = new BufferedInputStream(getContentResolver().openInputStream(source));
out = ... | true |
2,549 | 608,747 | 23,429,413 | 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 static String plainToMD(LoggerCollection loggerCol, String input) {
byte[] byteHash = null;
MessageDigest md = null;
StringBuilder md4result = new StringBuilder();
try {
md = MessageDigest.getInstance("MD4", new BouncyCastleProvider());
md.reset();
... | false |
2,550 | 16,658,637 | 621,591 | private void initUserExtensions(SeleniumConfiguration seleniumConfiguration) throws IOException {
StringBuilder contents = new StringBuilder();
StringOutputStream s = new StringOutputStream();
IOUtils.copy(SeleniumConfiguration.class.getResourceAsStream("default-user-extensions.js"), s);
... | 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 |
2,551 | 8,401,358 | 317,855 | public void run() {
FileInputStream src;
try {
src = new FileInputStream(srcName);
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
}
FileOutputStream dest;
FileChannel srcC = src.getChannel();
ByteBuffer buf... | 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 |
2,552 | 7,512,156 | 3,402,503 | @Override
public void execute(String[] args) throws Exception {
Options cmdLineOptions = getCommandOptions();
try {
GnuParser parser = new GnuParser();
CommandLine commandLine = parser.parse(cmdLineOptions, TolvenPlugin.getInitArgs());
String srcRepositoryURLS... | public static File insertFileInto(File zipFile, File toInsert, String targetPath) {
Zip64File zip64File = null;
try {
boolean compress = false;
zip64File = new Zip64File(zipFile);
FileEntry testEntry = getFileEntry(zip64File, targetPath);
if (testEntry... | true |
2,553 | 21,032,350 | 19,424,366 | 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... | private String calculateMD5(String input) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.reset();
digest.update(input.getBytes());
byte[] md5 = digest.digest();
String tmp = "";
String res = "";
for (int i = 0... | true |
2,554 | 8,023,601 | 10,398,987 | protected static List<Pattern> getBotPatterns() {
List<Pattern> patterns = new ArrayList<Pattern>();
try {
Enumeration<URL> urls = AbstractPustefixRequestHandler.class.getClassLoader().getResources("META-INF/org/pustefixframework/http/bot-user-agents.txt");
while (urls.hasMor... | public void getDataFiles(String server, String username, String password, String folder, String destinationFolder) {
try {
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username, password);
System.out.println("Connected to " + server + ".");
... | false |
2,555 | 8,702,780 | 12,345,227 | 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... | 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();
out.close... | true |
2,556 | 1,042,184 | 16,810,590 | public static String scramble(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
for (byte b : md.digest()) sb.append(Integer.toString(b & 0xFF, 16));
... | 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 |
2,557 | 12,838,274 | 665,978 | public BufferedImage extract() throws DjatokaException {
boolean useRegion = false;
int left = 0;
int top = 0;
int width = 50;
int height = 50;
boolean useleftDouble = false;
Double leftDouble = 0.0;
boolean usetopDouble = false;
Double topDoub... | 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 |
2,558 | 17,553,389 | 2,141,749 | @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... | public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | false |
2,559 | 2,190,568 | 17,226,920 | public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
if (!dest.exists() || (dest.exists() && overwrite)) {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(d... | public void setUrl(URL url) throws PDFException, PDFSecurityException, IOException {
InputStream in = null;
try {
URLConnection urlConnection = url.openConnection();
in = urlConnection.getInputStream();
String pathOrURL = url.toString();
setInputStream... | false |
2,560 | 14,370,985 | 21,493,548 | public static String encrypt(String password) {
String sign = password;
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(sign.getBytes());
byte[] hash = md.digest();
StringBuffer hexString = new StringBuf... | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
URL url = new URL(upgradeURL);
InputStream in = url.openStream();
BufferedInputStream buffIn = new BufferedInputStream(in);
FileOutputStream out = new FileOutputStream("");
... | true |
2,561 | 2,721,037 | 4,364,579 | public void SplitFile(File in, File out0, File out1, long pos) throws IOException {
FileInputStream fis = new FileInputStream(in);
FileOutputStream fos = new FileOutputStream(out0);
FileChannel fic = fis.getChannel();
FileChannel foc = fos.getChannel();
foc.transferFrom(fic, ... | public static String calcCRC(String phrase) {
StringBuffer crcCalc = new StringBuffer();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(phrase.getBytes());
byte[] tabDigest = md.digest();
for (int i = 0; i < tabDigest.length; i++)... | false |
2,562 | 8,500,021 | 7,039,646 | private Document saveFile(Document document, File file) throws Exception {
List<Preference> preferences = prefService.findAll();
if (preferences != null && !preferences.isEmpty()) {
preference = preferences.get(0);
}
SimpleDateFormat sdf = new SimpleDateFormat(Constants.D... | private static final void cloneFile(File origin, File target) throws IOException {
FileChannel srcChannel = null;
FileChannel destChannel = null;
try {
srcChannel = new FileInputStream(origin).getChannel();
destChannel = new FileOutputStream(target).getChannel();
... | true |
2,563 | 10,005,623 | 6,032,985 | public synchronized String getSerialNumber() {
if (serialNum != null) return serialNum;
final StringBuffer buf = new StringBuffer();
Iterator it = classpath.iterator();
while (it.hasNext()) {
ClassPathEntry entry = (ClassPathEntry) it.next();
buf.append(entry.... | private byte[] md5Digest(String pPassword) {
if (pPassword == null) {
throw new NullPointerException("input null text for hashing");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pPassword.getBytes());
return md.digest(... | true |
2,564 | 17,787,591 | 8,195,292 | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
}
}
try {
digest.update(data.getBytes("utf-8"));
} ca... | @Test
public void testGetJarInformation() throws Exception {
final URL url1 = getClass().getResource("/fakejars/something");
final URL url2 = getClass().getResource("/fakejars/something-else");
final URL url3 = getClass().getResource("/fakejars/another-thing");
final Map<String, ... | false |
2,565 | 23,620,425 | 21,907,871 | private static long copy(InputStream source, OutputStream sink) {
try {
return IOUtils.copyLarge(source, sink);
} catch (IOException e) {
throw new FaultException("System error copying stream", e);
} finally {
IOUtils.closeQuietly(source);
IOUt... | public static void extractFile(String jarArchive, String fileToExtract, String destination) {
FileWriter writer = null;
ZipInputStream zipStream = null;
try {
FileInputStream inputStream = new FileInputStream(jarArchive);
BufferedInputStream bufferedStream = new Buffe... | true |
2,566 | 16,948,799 | 11,319,479 | public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
if (!dest.exists() || (dest.exists() && overwrite)) {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(d... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
2,567 | 13,879,984 | 763,493 | public static String readFromURL(String urlStr) throws IOException {
URL url = new URL(urlStr);
StringBuilder sb = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != nul... | @Override
public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException {
String url = request.getParameter(URL_PARAM_NAME);
if (StringUtils.isEmpty(url)) {
log.error("url parameter not provided.");
throw new DataSourceException(Re... | false |
2,568 | 10,596,393 | 19,279,820 | public static String BaiKe(String unknown) {
String encodeurl = "";
long sTime = System.currentTimeMillis();
long eTime;
try {
String regEx = "\\#(.+)\\#";
String searchText = "";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matche... | private void copyFile(URL from, File to) {
try {
InputStream is = from.openStream();
IOUtils.copy(is, new FileOutputStream(to));
} catch (IOException e) {
e.printStackTrace();
}
}
| false |
2,569 | 1,833,576 | 2,721,034 | public FTPClient getFTP(final Credentials credentials, final String remoteFile) throws NumberFormatException, SocketException, IOException, AccessDeniedException {
String fileName = extractFilename(remoteFile);
String fileDirectory = getPathName(remoteFile).substring(0, getPathName(remoteFile).index... | public File takeFile(File f, String prefix, String suffix) throws IOException {
File nf = createNewFile(prefix, suffix);
FileInputStream fis = new FileInputStream(f);
FileChannel fic = fis.getChannel();
FileOutputStream fos = new FileOutputStream(nf);
FileChannel foc = fos.ge... | false |
2,570 | 23,531,657 | 6,491,370 | public void imagesParserAssesmentItem(int file, int currentquestion, Resource resTemp) {
NodeList nl = null;
Node n = null;
NamedNodeMap nnp = null;
Node nsrc = null;
URL url = null;
String sFilename = "";
String sNewPath = "";
int index;
Strin... | @Override
protected Object transform(Row inputs) throws FunctionException {
StringBuffer buffer = new StringBuffer();
for (IColumn c : inputs.getColumns()) {
buffer.append(c.getValueAsString() + "|");
}
try {
MessageDigest digest = java.security.MessageDig... | false |
2,571 | 19,682,242 | 12,670,358 | private boolean getRemoteFiles() throws Exception {
boolean resp = false;
int respCode = 0;
URL url = new URL(storageUrlString);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
RequestUtils requestUtils = new RequestUtils();
requestUtil... | private InputStream loadFromUrl(URL url, String contentType) throws IOException {
Proxy proxy = null;
if (isUseProxy) {
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAu... | false |
2,572 | 5,903,539 | 3,210,076 | public int next() {
int sequenceValue = current();
try {
Update update = dbi.getUpdate();
update.setTableName(sequenceTable);
update.assignValue("SEQUENCE_VALUE", --sequenceValue);
Search search = new Search();
search.addAttributeCriteria(s... | private void readHomePage(ITestThread testThread) throws IOException {
if (null == testThread) {
throw new IllegalArgumentException("Test thread may not be null.");
}
final InputStream urlIn = new URL(testUrl).openStream();
final int availableBytes = urlIn.available();
... | false |
2,573 | 7,194,282 | 2,188,303 | public static String createNormalizedJarDescriptorDigest(String path) throws Exception {
String descriptor = createNormalizedDescriptor(new JarFile2(path));
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(descriptor.getBytes());
byte[]... | @SuppressWarnings(value = "RetentionPolicy.SOURCE")
public static byte[] getHashMD5(String chave) {
byte[] hashMd5 = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(chave.getBytes());
hashMd5 = md.digest();
} catch (NoSuchAlg... | true |
2,574 | 1,966,263 | 20,287,675 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pathInfo = request.getPathInfo();
getLog().info("Process request " + pathInfo);
if (null != pathInfo) {
String pathId = getPathId(pathInfo);
J... | true |
2,575 | 10,079,611 | 22,948,959 | public static void copy(File source, File sink) throws IOException {
if (source == null) throw new NullPointerException("Source file must not be null");
if (sink == null) throw new NullPointerException("Target file must not be null");
if (!source.exists()) throw new IOException("Source file ... | private static void copyFile(File sourceFile, File targetFile) throws FileSaveException {
try {
FileInputStream inputStream = new FileInputStream(sourceFile);
FileOutputStream outputStream = new FileOutputStream(targetFile);
FileChannel readableChannel = inputStream.getCh... | true |
2,576 | 1,434,799 | 18,420,618 | public int executeBatch(String[] commands, String applicationid) throws Exception {
Statement statement = null;
int errors = 0;
int commandCount = 0;
Connection conn = null;
try {
conn = getConnection(applicationid);
conn.setAutoCommit(false);
... | public static String hashURL(String url) {
if (url == null) {
throw new IllegalArgumentException("URL may not be null. ");
}
String result = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
if (md != null) {
md.res... | false |
2,577 | 35,934 | 23,512,890 | public void covertFile(File file) throws IOException {
if (!file.isFile()) {
return;
}
Reader reader = null;
OutputStream os = null;
File newfile = null;
String filename = file.getName();
boolean succeed = false;
try {
newfile =... | private boolean write(File file) {
String filename = file.getPath();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream out = new PrintStream(byteArrayOutputStream);
try {
StringBuffer xml = null;
if (MainFrame.getInstance()... | true |
2,578 | 653,371 | 291,167 | 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 static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | true |
2,579 | 16,410,666 | 7,158,123 | public void backup(File source) throws BackupException {
try {
int index = source.getAbsolutePath().lastIndexOf(".");
if (index == -1) return;
File dest = new File(source.getAbsolutePath().substring(0, index) + ".bak");
FileChannel srcChannel = new FileInputSt... | public void truncateLog(long finalZxid) throws IOException {
long highestZxid = 0;
for (File f : dataDir.listFiles()) {
long zxid = isValidSnapshot(f);
if (zxid == -1) {
LOG.warn("Skipping " + f);
continue;
}
if (zxid > ... | true |
2,580 | 21,291,602 | 17,187,738 | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | public Music(URL url, boolean streamingHint) throws SlickException {
SoundStore.get().init();
String ref = url.getFile();
try {
if (ref.toLowerCase().endsWith(".ogg")) {
if (streamingHint) {
sound = SoundStore.get().getOggStream(url);
... | false |
2,581 | 17,147,420 | 22,287,078 | public final String latestVersion() {
String latestVersion = "";
try {
URL url = new URL(Constants.officialSite + ":80/LatestVersion");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLi... | @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 |
2,582 | 16,031,464 | 14,548,507 | private static boolean initLOG4JProperties(String homeDir) {
String Log4jURL = homeDir + LOG4J_URL;
try {
URL log4jurl = getURL(Log4jURL);
InputStream inStreamLog4j = log4jurl.openStream();
Properties propertiesLog4j = new Properties();
try {
... | private static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | false |
2,583 | 20,326,462 | 22,271,847 | public void bindDownload(Download download) throws BindingException {
List<ChunkDownload> chunks = download.getChunks();
File destination = download.getFile();
FileOutputStream fos = null;
try {
fos = FileUtils.openOutputStream(destination);
for (ChunkDownload... | public static String encryptPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
byte[] hash = md.digest();
int hashLength = hash.length;
StringBuffer hashStringBuf = new StringBuffe... | false |
2,584 | 21,817,956 | 19,662,493 | public void moveNext(String[] showOrder, String[] orgID, String targetShowOrder, String targetOrgID) throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
int moveCount = showOrder.length;
DBOperation dbo = factory.createDBOperation(P... | private static String md5Encode(String pass) {
String string;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pass.getBytes());
byte[] result = md.digest();
string = bytes2hexStr(result);
} catch (NoSuchAlgorithmException e... | false |
2,585 | 19,344,016 | 15,402,323 | public static synchronized String encrypt(String plaintext) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BAS... | 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();
... | true |
2,586 | 21,642,217 | 7,109,222 | private String searchMetabolite(String name) {
{
BufferedReader in = null;
try {
String urlName = name;
URL url = new URL(urlName);
in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
... | 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... | false |
2,587 | 17,615,292 | 10,819,149 | public BufferedImage processUsingTemp(InputStream input, DjatokaDecodeParam params) throws DjatokaException {
File in;
try {
in = File.createTempFile("tmp", ".jp2");
FileOutputStream fos = new FileOutputStream(in);
in.deleteOnExit();
IOUtils.copyStream... | public String insertBuilding() {
homeMap = homeMapDao.getHomeMapById(homeMap.getId());
homeBuilding.setHomeMap(homeMap);
Integer id = homeBuildingDao.saveHomeBuilding(homeBuilding);
String dir = "E:\\ganymede_workspace\\training01\\web\\user_buildings\\";
FileOutputStream fos... | true |
2,588 | 20,953,665 | 18,284,812 | private void packageDestZip(File tmpFile) throws FileNotFoundException, IOException {
log("Creating launch profile package " + destfile);
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destfile)));
ZipEntry e = new ZipEntry(RESOURCE_JAR_FILENAME);
... | protected void discoverRegistryEntries() {
DataSourceRegistry registry = this;
try {
ClassLoader loader = DataSetURI.class.getClassLoader();
Enumeration<URL> urls;
if (loader == null) {
urls = ClassLoader.getSystemResources("META-INF/org.virbo.data... | false |
2,589 | 18,519,248 | 23,188,867 | public String fetchContent(PathObject file) throws NetworkException {
if (file.isFetched()) {
return file.getContent();
}
if (!"f".equals(file.getType())) {
return null;
}
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(... | public void createZipCopy(IUIContext ui, final String zipFileName, final File[] filesToZip, final FilenameFilter fileFilter, Timestamp timestamp) {
TestCase.assertNotNull(ui);
TestCase.assertNotNull(zipFileName);
TestCase.assertFalse(zipFileName.trim().length() == 0);
TestCase.assert... | false |
2,590 | 3,024,973 | 14,533,184 | @Test
public void testCopy_inputStreamToOutputStream_IO84() throws Exception {
long size = (long) Integer.MAX_VALUE + (long) 1;
InputStream in = new NullInputStreamTest(size);
OutputStream out = new OutputStream() {
@Override
public void write(int b) throws IOExc... | public boolean delete(int id) {
boolean deletionOk = false;
Connection conn = null;
try {
conn = db.getConnection();
conn.setAutoCommit(false);
String sql = "DELETE FROM keyphrases WHERE website_id=?";
PreparedStatement ps = conn.prepareStateme... | false |
2,591 | 11,101,252 | 22,186,637 | @Override
public void handler(Map<String, Match> result, TargetPage target) {
List<String> lines = new LinkedList<String>();
List<String> page = new LinkedList<String>();
try {
URL url = new URL(target.getUrl());
BufferedReader reader = new BufferedReader(new Inpu... | public static boolean processUrl(String urlPath, UrlLineHandler handler) {
boolean ret = true;
URL url;
InputStream in = null;
BufferedReader bin = null;
try {
url = new URL(urlPath);
in = url.openStream();
bin = new BufferedReader(new Inpu... | true |
2,592 | 19,670,855 | 10,315,215 | private synchronized void configure() {
final Map res = new HashMap();
try {
final Enumeration resources = getConfigResources();
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
while (resources.hasMoreElements()) {
final URL ur... | public final void testT4CClientWriter() throws Exception {
InputStream is = ClassLoader.getSystemResourceAsStream(this.testFileName);
T4CClientReader reader = new T4CClientReader(is, rc);
File tmpFile = File.createTempFile("barde", ".log", this.tmpDir);
System.out.println("tmp=" + tm... | false |
2,593 | 22,307,690 | 7,999,742 | public static void main(String args[]) {
int summ = 0;
int temp = 0;
int[] a1 = { 0, 6, -7, -7, 61, 8, 20, 0, 8, 3, 6, 2, 7, 99, 0, 23, 12, 7, 9, 5, 33, 1, 3, 99, 99, 61, 99, 99, 99, 61, 61, 61, -3, -3, -3, -3 };
for (int j = 0; j < (a1.length * a1.length); j++) {
for (in... | private InputStream urlToInputStream(URL url) throws IOException {
URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent", IE);
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.connect();
String encoding = conn.getContentEncoding();
... | false |
2,594 | 17,499,276 | 5,102,752 | public static void unzip(File zipInFile, File outputDir) throws Exception {
Enumeration<? extends ZipEntry> entries;
ZipFile zipFile = new ZipFile(zipInFile);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipInFile));
ZipEntry entry = (ZipEntry) zipInputStrea... | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| true |
2,595 | 21,837,100 | 6,881,934 | public void saveMapping() throws SQLException {
Connection connection = null;
PreparedStatement ps = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = (Connection) DriverManager.getConnection(this.jdbcURL);
connection.setAutoCommit(false);
... | public static String sendSoapMsg(String SOAPUrl, byte[] b, String SOAPAction) throws IOException {
log.finest("HTTP REQUEST SIZE " + b.length);
if (SOAPAction.startsWith("\"") == false) SOAPAction = "\"" + SOAPAction + "\"";
URL url = new URL(SOAPUrl);
HttpURLConnection httpConn = (H... | false |
2,596 | 9,564,133 | 18,600,188 | public void copy(File aSource, File aDestDir) throws IOException {
FileInputStream myInFile = new FileInputStream(aSource);
FileOutputStream myOutFile = new FileOutputStream(new File(aDestDir, aSource.getName()));
FileChannel myIn = myInFile.getChannel();
FileChannel myOut = myOutFil... | 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");
... | true |
2,597 | 19,782,619 | 12,760,982 | public synchronized String encrypt(String p_plainText) throws ServiceUnavailableException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new ServiceUnavailableException(e.getMessage());
}
... | public static String MD5Encode(String password) {
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(password.getBytes());
final byte[] digest = messageDigest.digest();
final StringBuilder buf = ne... | true |
2,598 | 17,874,921 | 22,821,011 | public static boolean buildCFItem2ItemStats(String outFileName, String movieAvgFileName, String custAvgFileName) {
try {
File infile = new File(completePath + fSep + "SmartGRAPE" + fSep + movieAvgFileName);
FileChannel inC = new FileInputStream(infile).getChannel();
int s... | public static void main(String[] args) {
String command = "java -jar ";
String linkerJarPath = "";
String path = "";
String osName = System.getProperty("os.name");
String temp = Launcher.class.getResource("").toString();
int index = temp.indexOf(".jar");
int ... | true |
2,599 | 19,144,041 | 20,547,900 | public ChatClient registerPlayer(int playerId, String playerLogin) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.reset();
md.update(playerLogin.getBytes("UTF-8"), 0, playerLogin.length());
byte[] accountTok... | public static String md5(String source) {
MessageDigest md;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
try {
md = MessageDigest.getInstance("MD5");
md.update(source.getBytes());
byte[] digested = md.digest();
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.