id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
899,400 | 12,394,789 | 7,169,018 | public static void copyFile(File in, File out, long maxCount) throws IOException {
final FileChannel sourceChannel = new FileInputStream(in).getChannel();
final FileChannel destinationChannel = new FileOutputStream(out).getChannel();
if (maxCount == 0) maxCount = sourceChannel.size();
... | private void show(String fileName, HttpServletResponse response) throws IOException {
TelnetInputStream ftpIn = ftpClient_sun.get(fileName);
OutputStream out = null;
try {
out = response.getOutputStream();
IOUtils.copy(ftpIn, out);
} finally {
if (... | true |
899,401 | 1,152,136 | 5,467,376 | @SuppressWarnings("unchecked")
public ArrayList<GmailContact> getAllContacts() throws GmailException {
String query = properties.getString("export_page");
query = query.replace("[RANDOM_INT]", "" + random.nextInt());
int statusCode = -1;
GetMethod get = new GetMethod(query);
... | protected boolean check(String username, String password, String realm, String nonce, String nc, String cnonce, String qop, String uri, String response, HttpServletRequest request) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes());
... | true |
899,402 | 638,963 | 12,923,790 | 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 void insertContent(ImageData imageData, Element element) {
URL url = getClass().getResource(imageData.getURL());
try {
File imageFileRead = new File(url.toURI());
FileInputStream inputStream = new FileInputStream(imageFileRead);
String imageFileWritePath =... | true |
899,403 | 17,545,948 | 4,937,926 | 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());
... | @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... | false |
899,404 | 16,410,666 | 8,637,246 | 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... | @Override
public void setDocumentSpace(DocumentSpace space) {
for (Document doc : space) {
File result = new File(parent, doc.getName());
if (doc instanceof XMLDOMDocument) {
new PlainXMLDocumentWriter(result).writeDocument(doc);
} else if (doc instanc... | true |
899,405 | 18,492,103 | 1,477,955 | public void shouldAllowClosingInputStreamTwice() throws IOException {
OutputStream outputStream = fileSystem.createOutputStream(_("hello"), OutputMode.OVERWRITE);
outputStream.write(new byte[] { 1, 2, 3 });
outputStream.close();
InputStream inputStream = fileSystem.createInputStream(... | private String copyAndHash(InputStream input, File into) throws IOException {
MessageDigest digest = createMessageDigest();
DigestInputStream dis = new DigestInputStream(input, digest);
IOException ex;
FileOutputStream fos = null;
try {
fos = new FileOutputStream(... | true |
899,406 | 4,960,419 | 13,748,907 | public static boolean writeFileByChars(Reader pReader, File pFile, boolean pAppend) {
boolean flag = false;
try {
FileWriter fw = new FileWriter(pFile, pAppend);
IOUtils.copy(pReader, fw);
fw.flush();
fw.close();
pReader.close();
... | public static String getDigest(String input) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(input.getBytes());
byte[] outDigest = md5.digest();
StringBuffer outBuf = new StringBuffer(33);
for (int i = 0; i < outDigest.length... | false |
899,407 | 4,471,000 | 3,959,503 | 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 source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
in.transferTo(0, in.size(), out);
} catch (FileN... | true |
899,408 | 2,217,508 | 10,104,168 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (destFile.getParentFile() != null && !destFile.getParentFile().mkdirs()) {
LOG.error("GeneralHelper.copyFile(): Cannot create parent directories from " + destFile);
}
FileInputStream f... | public static String calculateHash(String data, String algorithm) {
if (data == null) {
return null;
}
algorithm = (algorithm == null ? INTERNAL : algorithm.toUpperCase());
if (algorithm.equals(PLAIN)) {
return data;
}
if (algorithm.startsWith(... | false |
899,409 | 16,445,797 | 46,158 | @Override
public void run() {
String src = null;
try {
src = File.readText(srcFile);
if (Char.isValidate(src)) {
java.net.URL url = new java.net.URL(ConsEnv.HOMEPAGE + "code/code0001.ashx");
java.util.HashMap<String, String> params = new ja... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
899,410 | 860,848 | 10,721,229 | 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 String connect(String host, int port, String init) {
HttpURLConnection c = null;
String ret = "";
int response;
URL url = null;
try {
url = new URL("http://" + gwhost + ":" + gwport + "/connect?host=" + Utils.URLEncode(host.getBytes()) + "&port=" + Utils.UR... | false |
899,411 | 21,754,657 | 14,555,517 | private JButton getButtonImagen() {
if (buttonImagen == null) {
buttonImagen = new JButton();
buttonImagen.setText(Messages.getString("gui.AdministracionResorces.6"));
buttonImagen.setIcon(new ImageIcon(getClass().getResource("/es/unizar/cps/tecnoDiscap/data/icons/view_si... | @Override
@RemoteMethod
public boolean encrypt(int idAnexo) {
try {
Anexo anexo = anexoService.selectById(idAnexo);
aes.init(Cipher.ENCRYPT_MODE, aeskeySpec);
FileInputStream fis = new FileInputStream(config.baseDir + "/arquivos_upload_direto/" + anexo.getAnexoCam... | true |
899,412 | 15,896,100 | 12,174,403 | public String SHA1(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
return convToHex(sha1hash);
} c... | public static String encryptPass2(String pass) throws UnsupportedEncodingException {
String passEncrypt;
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
}
md5.update(pass.getBytes());
... | true |
899,413 | 20,081,740 | 5,523,389 | public static void main(String[] args) throws Exception {
if (args.length < 3) {
usage(System.out);
System.exit(1);
}
final File tmpFile = File.createTempFile("sej", null);
tmpFile.deleteOnExit();
final FileOutputStream destination = new FileOutputStre... | public static void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
... | true |
899,414 | 19,131,858 | 19,063,414 | private String fetchContent() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String str;
while ((str = reader.readLine()) != null) {
buf.append(str);
}
return... | public void readData() throws IOException {
i = 0;
j = 0;
URL url = getClass().getResource("resources/Chrom_623_620.dat");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
s = br... | true |
899,415 | 1,624,010 | 20,081,740 | public static void copy(String a, String b) throws IOException {
File inputFile = new File(a);
File outputFile = new File(b);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
... | public static void main(String[] args) throws Exception {
if (args.length < 3) {
usage(System.out);
System.exit(1);
}
final File tmpFile = File.createTempFile("sej", null);
tmpFile.deleteOnExit();
final FileOutputStream destination = new FileOutputStre... | true |
899,416 | 12,690,725 | 2,746,011 | public void login(String a_username, String a_password) throws GB_SecurityException {
Exception l_exception = null;
try {
if (clientFtp == null) {
clientFtp = new FTPClient();
clientFtp.connect("ftp://" + ftp);
}
boolean b = clientF... | @RequestMapping(value = "/privatefiles/{file_name}")
public void getFile(@PathVariable("file_name") String fileName, HttpServletResponse response, Principal principal) {
try {
Boolean validUser = false;
final String currentUser = principal.getName();
Authentication au... | false |
899,417 | 21,273,060 | 21,273,056 | public RobotList<Location> sort_decr_Location(RobotList<Location> list, String field) {
int length = list.size();
Index_value[] enemy_dist = new Index_value[length];
if (field.equals("") || field.equals("location")) {
Location cur_loc = this.getLocation();
for (int i ... | public RobotList<Resource> sort_decr_Resource(RobotList<Resource> list, String field) {
int length = list.size();
Index_value[] resource_dist = new Index_value[length];
if (field.equals("") || field.equals("location")) {
Location cur_loc = this.getLocation();
for (int... | true |
899,418 | 4,928,349 | 18,797,768 | private static String getHashString(String text, String algorithm) throws NoSuchAlgorithmException, UnsupportedEncodingException {
AssertUtility.notNull(text);
AssertUtility.notNullAndNotSpace(algorithm);
MessageDigest md;
md = MessageDigest.getInstance(algorithm);
md.update(... | public static String hashPassword(String password) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
byte result[] = md5.digest("InTeRlOgY".getBytes());
StringBuffer sb = new StringBuffer();
for (int i =... | true |
899,419 | 20,979,580 | 19,392,395 | public void doAction() throws MalformedURLException, IOException, Exception {
URL url = new URL(CheckNewVersionAction.VERSION_FILE);
InputStream is = url.openStream();
byte[] buffer = Utils.loadBytes(is);
is.close();
String version = new String(buffer);
if (version !=... | private void updateIngredients(Recipe recipe, int id) throws Exception {
PreparedStatement pst1 = null;
PreparedStatement pst2 = null;
try {
conn = getConnection();
pst1 = conn.prepareStatement("DELETE FROM ingredients WHERE recipe_id = ?");
pst1.setInt(1,... | false |
899,420 | 7,518,607 | 11,467,950 | private ArrayList<String> getFiles(String date) {
ArrayList<String> files = new ArrayList<String>();
String info = "";
try {
obtainServerFilesView.setLblProcessText(java.util.ResourceBundle.getBundle("bgpanalyzer/resources/Bundle").getString("ObtainServerFilesView.Label.Progress.... | public String getMediaURL(String strLink) {
try {
String res = de.nomule.mediaproviders.KeepVid.getAnswer(strLink, "aa");
if (NoMuleRuntime.DEBUG) System.out.println(res);
String regexp = "http:\\/\\/[^\"]+\\/get_video[^\"]+";
Pattern p = Pattern.compile(regex... | false |
899,421 | 6,171,405 | 15,909,533 | public static File createGzip(File inputFile) {
File targetFile = new File(inputFile.getParentFile(), inputFile.getName() + ".gz");
if (targetFile.exists()) {
log.warn("The target file '" + targetFile + "' already exists. Will overwrite");
}
FileInputStream in = null;
... | public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpClientInfo clientInfo = HttpUtil.parseClientInfo((HttpServletRequest) request);
if (request.getParameter("_debug_") != null) {
StringBuffer buffer = new StringBuffer();
... | true |
899,422 | 1,455,792 | 20,655,774 | public void generate(String rootDir, RootModel root) throws Exception {
IOUtils.copyStream(HTMLGenerator.class.getResourceAsStream("stylesheet.css"), new FileOutputStream(new File(rootDir, "stylesheet.css")));
Velocity.init();
VelocityContext context = new VelocityContext();
context.... | private static void initialize() throws IOException {
System.out.println("Getting startup cookies from localhostr.com");
HttpGet httpget = new HttpGet("http://localhostr.com/");
if (login) {
httpget.setHeader("Cookie", sessioncookie);
}
HttpResponse myresponse = h... | false |
899,423 | 12,493,156 | 18,420,618 | public static String hashPassword(String plaintext) {
if (plaintext == null) {
return "";
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
md.update(plaintext.getBytes("UTF-8"));
} catch (Exception e) {
l... | 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... | true |
899,424 | 7,377,245 | 13,122,193 | public void write(HttpServletRequest req, HttpServletResponse res, Object bean) throws IntrospectionException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException {
res.setContentType(contentType);
final Object r;
if (HttpRpcServer.HttpRpcOutput.class.isAssi... | public static void createModelZip(String filename, String tempdir) throws EDITSException {
try {
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(filename);
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest));
... | true |
899,425 | 8,370,046 | 6,381,991 | public static String downloadJar(URL url) throws IOException {
String localFile = null;
char[] buf = new char[4096];
int num;
localFile = Settings.getFreeTsUserPath() + "lib" + Settings.SLASH + getURLFileName(url);
DebugDialog.print("Downloading jar-file " + url + " to " + lo... | private static String hashToMD5(String sig) {
try {
MessageDigest lDigest = MessageDigest.getInstance("MD5");
lDigest.update(sig.getBytes());
BigInteger lHashInt = new BigInteger(1, lDigest.digest());
return String.format("%1$032X", lHashInt).toLowerCase();
... | false |
899,426 | 21,518,266 | 16,099,225 | public void initGet() throws Exception {
cl = new DefaultHttpClient();
GetAuthPromter hp = new GetAuthPromter();
cl.setCredentialsProvider(hp);
get = new HttpGet(getURL());
get.setHeader("User-Agent", "test");
get.setHeader("Accept", "*/*");
get.setHeader("Ran... | public static String digest(String text, String algorithm, String charsetName) {
try {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(text.getBytes(charsetName), 0, text.length());
return convertToHex(md.digest());
} catch (NoSuchAlgorithmExcep... | false |
899,427 | 4,989,975 | 19,322,940 | public InputStream sendReceive(String trackerURL) throws TorrentException {
try {
URL url = new URL(trackerURL);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
in = conn.getInputStream();
} catch (MalformedURLException e) {
... | @Test
public void test_lookupResourceType_FullSearch_TwoWords() throws Exception {
URL url = new URL(baseUrl + "/lookupResourceType/alloyed+tritanium");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequ... | false |
899,428 | 10,846,739 | 7,015,918 | public void run() {
GZIPInputStream gzipInputStream = null;
try {
gzipInputStream = new GZIPInputStream(pipedInputStream);
IOUtils.copy(gzipInputStream, outputStream);
} catch (Throwable t) {
... | 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 |
899,429 | 1,663,419 | 3,753,583 | 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 void generateCode(File flowFile, String packagePath, File destDir, File scriptRootFolder) throws IOException {
InputStream javaSrcIn = generateCode(flowFile, packagePath, scriptRootFolder);
File outputFolder = new File(destDir, packagePath.replace('.', File.separatorChar));
Str... | true |
899,430 | 5,537,138 | 9,568,958 | public static String getDigest(String seed, String code) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(seed.getBytes("UTF-8"));
byte[] passwordMD5Byte = md.digest(code.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
... | private void getRandomGuid(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | true |
899,431 | 12,530,708 | 2,069,219 | private int mergeFiles(Merge merge) throws MojoExecutionException {
String encoding = DEFAULT_ENCODING;
if (merge.getEncoding() != null && merge.getEncoding().length() > 0) {
encoding = merge.getEncoding();
}
int numMergedFiles = 0;
Writer ostream = null;
... | public static void copieFichier(File fichier1, File fichier2) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(fichier1).getChannel();
out = new FileOutputStream(fichier2).getChannel();
in.transferTo(0, in.size(), out);
... | true |
899,432 | 20,336,343 | 716,032 | public static Properties loadProperties() {
try {
if (url == null) url = ClassLoader.getSystemResource("application.properties");
if (url == null) throw new FileNotFoundException("application.properties");
props = new Properties();
props.load(url.openStream())... | public void getZipFiles(String filename) {
try {
String destinationname = "c:\\mods\\peu\\";
byte[] buf = new byte[1024];
ZipInputStream zipinputstream = null;
ZipEntry zipentry;
zipinputstream = new ZipInputStream(new FileInputStream(filename));
... | false |
899,433 | 23,390,255 | 18,600,879 | 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 static void copyFile(File input, File output) throws Exception {
FileReader in = new FileReader(input);
FileWriter out = new FileWriter(output);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| true |
899,434 | 19,299,263 | 21,879,268 | String extractTiffFile(String path) throws IOException {
ZipInputStream in = new ZipInputStream(new FileInputStream(path));
OutputStream out = new FileOutputStream(dir + TEMP_NAME);
byte[] buf = new byte[1024];
int len;
ZipEntry entry = in.getNextEntry();
if (entry ==... | protected InputSource defaultResolveEntity(String publicId, String systemId) throws SAXException {
if (systemId == null) return null;
if (systemId.indexOf("file:/") >= 0) {
try {
final InputSource is = new InputSource(new URL(systemId).openStream());
is.se... | false |
899,435 | 23,370,708 | 2,190,569 | private final long test(final boolean applyFilter, final int executionCount) throws NoSuchAlgorithmException, NoSuchPaddingException, FileNotFoundException, IOException, RuleLoadingException {
final boolean stripHtmlEnabled = true;
final boolean injectSecretTokensEnabled = true;
final boolea... | public static void copyFileStreams(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) {
return;
}
FileInputStream fis = new FileInputStream(fromFile);
FileOutputStream fos = new FileOutputStream(toFile);
int read = 0;
byte[] buf = new... | true |
899,436 | 22,690,093 | 10,658,266 | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | public static void copy(File srcFile, File destFile) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile);
final byte[] buf = new byte[4096];
... | true |
899,437 | 17,385,831 | 3,239,919 | public static void copyFile(String sourceName, String destName) throws IOException {
FileChannel sourceChannel = null;
FileChannel destChannel = null;
try {
sourceChannel = new FileInputStream(sourceName).getChannel();
destChannel = new FileOutputStream(destName).getC... | public static byte[] getHashedPassword(String password, byte[] randomBytes) {
byte[] hashedPassword = null;
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(randomBytes);
messageDigest.update(password.getBytes("UTF-8"));
... | false |
899,438 | 12,859,344 | 3,402,498 | private void sendFile(File file, HttpServletResponse response) throws IOException {
response.setContentLength((int) file.length());
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
IOUtils.copy(inputStream, response.getOutputStream());
... | private static void readFileEntry(Zip64File zip64File, FileEntry fileEntry, File destFolder) {
FileOutputStream fileOut;
File target = new File(destFolder, fileEntry.getName());
File targetsParent = target.getParentFile();
if (targetsParent != null) {
targetsParent.mkdirs... | true |
899,439 | 16,788,944 | 23,388,829 | private void refreshCacheFile(RepositoryFile file, File cacheFile) throws FileNotFoundException, IOException {
FileOutputStream fos = new FileOutputStream(cacheFile);
InputStream is = file.getInputStream();
int count = IOUtils.copy(is, fos);
logger.debug("============================... | protected <T extends AbstractResponse> T readResponse(HttpUriRequest httpUriRequest, Class<T> clazz) throws IOException, TranslatorException {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Executing request " + httpUriRequest.getURI());
}
HttpResponse httpResponse = httpClient.exe... | false |
899,440 | 778,678 | 636,262 | 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 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 |
899,441 | 16,588,230 | 19,409,751 | public static void main(String[] args) throws IOException {
MSPack pack = new MSPack(new FileInputStream(args[0]));
String[] files = pack.getFileNames();
for (int i = 0; i < files.length; i++) System.out.println(i + ": " + files[i] + ": " + pack.getLengths()[i]);
System.out.println("... | public static void compress(final File zip, final Map<InputStream, String> entries) throws IOException {
if (zip == null || entries == null || CollectionUtils.isEmpty(entries.keySet())) throw new IllegalArgumentException("One ore more parameters are empty!");
if (zip.exists()) zip.delete(); else if ... | true |
899,442 | 480,017 | 18,972,686 | 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 jsFunction_addFile(ScriptableFile infile) throws IOException {
if (!infile.jsFunction_exists()) throw new IllegalArgumentException("Cannot add a file that doesn't exists to an archive");
ZipArchiveEntry entry = new ZipArchiveEntry(infile.getName());
entry.setSize(infile.jsFunctio... | true |
899,443 | 3,104,483 | 8,300,620 | @Override
public void writeTo(final TrackRepresentation t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws WebApplicationException {
if (mediaType.isCompatibl... | @Override
public void copierPhotos(FileInputStream fichierACopier, FileOutputStream fichierDestination) {
FileChannel in = null;
FileChannel out = null;
try {
in = fichierACopier.getChannel();
out = fichierDestination.getChannel();
in.transferTo(0, in.... | true |
899,444 | 9,705,209 | 16,954,340 | public static void main(String[] args) throws Exception {
PatternLayout pl = new PatternLayout("%d{ISO8601} %-5p %c: %m\n");
ConsoleAppender ca = new ConsoleAppender(pl);
Logger.getRoot().addAppender(ca);
Logger.getRoot().setLevel(Level.INFO);
Options options = new Options();... | public static boolean copyFile(String sourceFileName, String destFileName) {
if (sourceFileName == null || destFileName == null) return false;
if (sourceFileName.equals(destFileName)) return false;
try {
java.io.FileInputStream in = new java.io.FileInputStream(sourceFileName);
... | true |
899,445 | 21,079,416 | 18,850,012 | public static void writeDataResourceText(GenericValue dataResource, String mimeTypeId, Locale locale, Map templateContext, CmsOFBizRemoteClient remoteClient, Writer out, boolean cache) throws IOException, GeneralException {
Map context = (Map) templateContext.get("context");
if (context == null) {
... | public void copy(String fromFileName, String toFileName) throws IOException {
log.info("copy() file:" + fromFileName + " toFile:" + toFileName);
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "n... | false |
899,446 | 22,136,224 | 9,217 | protected Class findClass(String name) throws ClassNotFoundException {
String classFile = name.replace('.', '/') + ".class";
InputStream classInputStream = null;
if (this.extensionJars != null) {
for (int i = 0; i < this.extensionJars.length; i++) {
JarFile extens... | 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 |
899,447 | 1,577,151 | 14,175,531 | public static void copyFile(final String src, final String dest) {
Runnable r1 = new Runnable() {
public void run() {
try {
File inf = new File(dest);
if (!inf.exists()) {
inf.getParentFile().mkdirs();
... | public String getShortToken(String md5Str) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(md5Str.getBytes(JspRunConfig.charset));
} catch (Exception e) {
e.printStackTrace();
}
StringBuffer token = toHe... | false |
899,448 | 18,318,816 | 3,402,498 | public static void invokeMvnArtifact(final IProject project, final IModuleExtension moduleExtension, final String location) throws CoreException, InterruptedException, IOException {
final Properties properties = new Properties();
properties.put("archetypeGroupId", "org.nexopenframework.plugins");
... | private static void readFileEntry(Zip64File zip64File, FileEntry fileEntry, File destFolder) {
FileOutputStream fileOut;
File target = new File(destFolder, fileEntry.getName());
File targetsParent = target.getParentFile();
if (targetsParent != null) {
targetsParent.mkdirs... | true |
899,449 | 4,928,349 | 20,586,748 | private static String getHashString(String text, String algorithm) throws NoSuchAlgorithmException, UnsupportedEncodingException {
AssertUtility.notNull(text);
AssertUtility.notNullAndNotSpace(algorithm);
MessageDigest md;
md = MessageDigest.getInstance(algorithm);
md.update(... | public static String getMD5(String text) {
if (text == null) {
return null;
}
String result = null;
try {
MessageDigest md5 = MessageDigest.getInstance(ALG_MD5);
md5.update(text.getBytes(ENCODING));
result = "" + new BigInteger(1, md5.d... | true |
899,450 | 18,397,102 | 20,954,717 | 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) {
... | private static final void copyFile(File srcFile, File destDir, byte[] buffer) {
try {
File destFile = new File(destDir, srcFile.getName());
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
int bytesRead;
... | true |
899,451 | 8,372,919 | 12,835,734 | private String MD5(String s) {
Log.d("MD5", "Hashing '" + s + "'");
String hash = "";
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
hash = new BigInteger(1, m.digest()).toString(16);
Log.d("MD5... | public static String md5(String plainText) {
String ret = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
... | true |
899,452 | 6,877,678 | 15,072,228 | public static void exportGestureSet(List<GestureSet> sets, File file) {
try {
FileOutputStream outputStream = new FileOutputStream(file);
IOUtils.copy(exportGestureSetsAsStream(sets), outputStream);
outputStream.close();
} catch (FileNotFoundException e) {
... | protected void createFile(File sourceActionDirectory, File destinationActionDirectory, LinkedList<String> segments) throws DuplicateActionFileException {
File currentSrcDir = sourceActionDirectory;
File currentDestDir = destinationActionDirectory;
String segment = "";
for (int i = 0;... | true |
899,453 | 13,753,266 | 7,015,918 | public static void s_copy(FileInputStream fis, FileOutputStream fos) throws Exception {
FileChannel in = fis.getChannel();
FileChannel out = fos.getChannel();
in.transferTo(0, in.size(), out);
if (in != null) in.close();
if (out != null) out.close();
}
| 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 |
899,454 | 18,076,450 | 15,047,558 | public void fetch(URL url, HTTPMethod method, String payload, WithResponse wr) throws IOException {
System.out.println("fetchin' " + url.toString() + " with GAE fetch service");
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
... | protected void ensureProjectExists(String projectName) {
List<IClasspathEntry> classpathEntries = new UniqueEList<IClasspathEntry>();
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
try {
boolean isEmptyProject = true;
IProjectDesc... | false |
899,455 | 21,106,860 | 1,426,634 | private boolean tryGet(String url, Hashtable<String, String> req) throws Exception {
boolean result = false;
Enumeration<String> keys = req.keys();
String key;
String value;
String data = "";
while (keys.hasMoreElements()) {
key = keys.nextElement();
... | @Override
public URLConnection openConnection(URL url, Proxy proxy) throws IOException {
if (null == url) {
throw new IllegalArgumentException(Messages.getString("luni.1B"));
}
String host = url.getHost();
if (host == null || host.length() == 0 || host.equalsIgnoreCas... | false |
899,456 | 13,337,915 | 17,360,683 | private static String calculateMD5(String s) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(s.getBytes());
return new BigInteger(1, m.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
throw new ... | public static String generateMD5(String clear) {
byte hash[] = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(clear.getBytes());
hash = md5.digest();
} catch (NoSuchAlgorithmException e) {
}
if (hash != null) {... | true |
899,457 | 10,421,893 | 8,063,675 | private static FTPClient getFtpClient(String ftpHost, String ftpUsername, String ftpPassword) throws SocketException, IOException {
FTPClient ftp = new FTPClient();
ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
ftp.connect(ftpHost);
int reply ... | private static int ejecutaUpdate(String database, String SQL) throws Exception {
int i = 0;
DBConnectionManager dbm = null;
Connection bd = null;
try {
dbm = DBConnectionManager.getInstance();
bd = dbm.getConnection(database);
Statement st = bd.cre... | false |
899,458 | 16,192,368 | 16,164,368 | public static Version getWebRelease(String url) {
InputStream is = null;
try {
is = new URL(url).openStream();
Reader reader = new InputStreamReader(new BufferedInputStream(is), "UTF-8");
String word = findWord(reader, "<description>Release:", "</description>").tr... | public static String getHashedPassword(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(password.getBytes());
BigInteger hashedInt = new BigInteger(1, digest.digest());
return String.format("%1$032X", hashedInt);
... | false |
899,459 | 17,586,130 | 4,114,808 | protected N save(String sql, Object[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
pstmt = conn.prepareStatement(sql, Statement.RETURN_GENERA... | public boolean copier(String source, String nomFichierSource, java.io.File destination) {
boolean resultat = false;
OutputStream tmpOut;
try {
tmpOut = new BufferedOutputStream(new FileOutputStream(nomFichierSource + "001.tmp"));
InputStream is = getClass().getResourc... | false |
899,460 | 4,260,650 | 3,024,977 | public void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
Closer c = new Closer();
try {
source = c.register(new Fi... | @Test
public void testCopy_inputStreamToWriter() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new YellOnFlushAndC... | true |
899,461 | 3,024,983 | 736,738 | @Test
public void testCopy_inputStreamToWriter_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
899,462 | 16,543,560 | 21,273,058 | 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... | public RobotList<Percentage> sort_decr_Percentage(RobotList<Percentage> list, String field) {
int length = list.size();
Index_value[] distri = new Index_value[length];
for (int i = 0; i < length; i++) {
distri[i] = new Index_value(i, list.get(i).percent);
}
boolea... | false |
899,463 | 20,924,118 | 6,368,468 | public static void zip() throws Exception {
System.out.println("zip()");
ZipOutputStream zipout = new ZipOutputStream(new FileOutputStream(new File("/zip/myzip.zip")));
ZipEntry entry = new ZipEntry("asdf.script");
zipout.putNextEntry(entry);
byte buffer[] = new byte[BLOCKSIZ... | boolean copyFileStructure(File oldFile, File newFile) {
if (oldFile == null || newFile == null) return false;
File searchFile = newFile;
do {
if (oldFile.equals(searchFile)) return false;
searchFile = searchFile.getParentFile();
} while (searchFile != null);
... | true |
899,464 | 10,943,077 | 23,029,916 | private void copy(File fromFile, File toFile) throws IOException {
String fromFileName = fromFile.getName();
File tmpFile = new File(fromFileName);
String toFileName = toFile.getName();
if (!tmpFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName... | public static void notify(String msg) throws Exception {
String url = "http://api.clickatell.com/http/sendmsg?";
url = add(url, "user", user);
url = add(url, "password", password);
url = add(url, "api_id", apiId);
url = add(url, "to", to);
url = add(url, "text", msg);... | true |
899,465 | 813,588 | 8,587,541 | 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 List importSymbol(Report report, Symbol symbol, TradingDate startDate, TradingDate endDate) throws IOException {
List quotes = new ArrayList();
String URLString = constructURL(symbol, startDate, endDate);
QuoteFilter filter = new YahooQuoteFilter(symbol);
PreferencesMan... | true |
899,466 | 5,977,093 | 19,946,541 | public FileBean create(MimeTypeBean mimeType, SanBean san) throws SQLException {
long fileId = 0;
DataSource ds = getDataSource(DEFAULT_DATASOURCE);
Connection conn = ds.getConnection();
try {
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();... | public int commit() throws TransactionException, SQLException, ConnectionFactoryException {
Connection conn = ConnectionFactoryProxy.getInstance().getConnection(_poolName);
conn.setAutoCommit(false);
int numRowsUpdated = 0;
try {
Iterator statements = _statements.iterator... | true |
899,467 | 13,212,350 | 2,538,511 | public static void copyFile(File source, File dest) {
try {
FileChannel in = new FileInputStream(source).getChannel();
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
FileChannel out = new FileOutputStream(dest).getChannel();
in.transferTo(0... | public static void copyFile(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| true |
899,468 | 14,386,499 | 11,046,598 | public synchronized String encrypt(String plaintext) throws SystemUnavailableException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new SystemUnavailableException(e.getMessage());
}
... | private String hash(String clearPassword) {
if (salt == 0) return null;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new AssertionError("Can't find the SHA1 algorithm in the java.security p... | true |
899,469 | 5,834,020 | 17,916,170 | protected byte[] retrieveImageData() throws IOException {
URL url = new URL(imageUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
int fileSize = connection.getContentLength();
if (fileSize < 0) {
return null;
}
byte[] imageDat... | public String getWebPage(String url) {
String content = "";
URL urlObj = null;
try {
urlObj = new URL(url);
} catch (MalformedURLException urlEx) {
urlEx.printStackTrace();
throw new Error("URL creation failed.");
}
try {
... | false |
899,470 | 20,162,871 | 9,219,797 | public static void copyFile(String f_in, String f_out, boolean remove) throws FileNotFoundException, IOException {
if (remove) {
PogoString readcode = new PogoString(PogoUtil.readFile(f_in));
readcode = PogoUtil.removeLogMessages(readcode);
PogoUtil.writeFile(f_out, readc... | public static void encryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | true |
899,471 | 22,427,840 | 23,486,114 | public static void copyFile(File from, File to) {
try {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
byte[] buffer = new byte[1024 * 16];
int read = 0;
while ((read = i... | public void createTableIfNotExisting(Connection conn) throws SQLException {
String sql = "select * from " + tableName;
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
ps.executeQuery();
} catch (SQLException sqle) {
ps.close();
... | false |
899,472 | 6,310,593 | 6,937 | @Override
public String execute() throws Exception {
SystemContext sc = getSystemContext();
if (sc.getExpireTime() == -1) {
return LOGIN;
} else if (upload != null) {
try {
Enterprise e = LicenceUtils.get(upload);
sc.setEnterpriseNa... | public static void main(String[] args) throws Exception {
String urlString = "http://php.tech.sina.com.cn/download/d_load.php?d_id=7877&down_id=151542";
urlString = EncodeUtils.encodeURL(urlString);
URL url = new URL(urlString);
System.out.println("第一次:" + url);
HttpURLConnec... | false |
899,473 | 17,907,353 | 7,655,679 | public static void resourceToFile(final String resource, final String filePath) throws IOException {
log.debug("Classloader is " + IOCopyUtils.class.getClassLoader());
InputStream in = IOCopyUtils.class.getResourceAsStream(resource);
if (in == null) {
log.warn("Resource not '" + ... | public static void copy(String sourceName, String destName) throws IOException {
File src = new File(sourceName);
File dest = new File(destName);
BufferedInputStream source = null;
BufferedOutputStream destination = null;
byte[] buffer;
int bytes_read;
long by... | true |
899,474 | 22,545,244 | 1,292,366 | public static String encryptStringWithSHA2(String input) {
String output = null;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md.update(input.getBytes())... | public void command() {
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File(dir));
int returnVal = chooser.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
filename = chooser.getSelectedFile().getAbsolutePath();
... | false |
899,475 | 14,799,225 | 21,090,887 | public FTPUtil(final String server) {
log.debug("~ftp.FTPUtil() : Creating object");
ftpClient = new FTPClient();
try {
ftpClient.connect(server);
ftpClient.login("anonymous", "");
ftpClient.setConnectTimeout(120000);
ftpClient.setSoTimeout(120... | public static String digest(String ha1, String ha2, String nonce) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getBytes(ha1, ISO_8859_1));
md.update((byte) ':');
md.update(getBytes(nonce, ISO_8859_1));
md.update((byte) ':'... | false |
899,476 | 7,975,225 | 22,328,843 | protected void downloadFile(String filename, java.io.File targetFile, File partFile, ProgressMonitor monitor) throws java.io.IOException {
FileOutputStream out = null;
InputStream is = null;
try {
filename = toCanonicalFilename(filename);
URL url = new URL(root + file... | protected void doBackupOrganizeTypeRelation() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strSelQuery = "SELECT parent_organize_type,child_organize_type " + "FROM " + Common.ORGANIZE_TYPE_RELATION_TABLE;
String strIns... | false |
899,477 | 7,927,385 | 10,912,335 | private String send(String method, String contentType, String urlStr, String body) throws MalformedURLException, IOException {
HttpURLConnection postCon = (HttpURLConnection) new URL(getUrl(urlStr)).openConnection();
postCon.setRequestMethod(method);
postCon.setDoOutput(true);
postCo... | public void guardarCantidad() {
try {
String can = String.valueOf(cantidadArchivos);
File archivo = new File("cantidadArchivos.txt");
FileWriter fw = new FileWriter(archivo);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter salida = new Prin... | false |
899,478 | 15,376,881 | 8,567,304 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream inStream = null;
FileOutputStream outStream = null;
FileChannel source = null;
FileChannel de... | public TapdocContextImpl(Registry registry, FileObject javaDom, List<String> javadocLinks, List<String> libraryLocations, FileObject outputDirectory, List<String> tapdocLinks, DocumentGenerator documentGenerator) {
this.registry = registry;
this.documentGenerator = documentGenerator;
try {
... | true |
899,479 | 15,909,533 | 7,110,627 | public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpClientInfo clientInfo = HttpUtil.parseClientInfo((HttpServletRequest) request);
if (request.getParameter("_debug_") != null) {
StringBuffer buffer = new StringBuffer();
... | void loadListFile(String listFileName, String majorType, String minorType, String languages, String annotationType) throws MalformedURLException, IOException {
Lookup defaultLookup = new Lookup(listFileName, majorType, minorType, languages, annotationType);
URL lurl = new URL(listsURL, listFileName)... | false |
899,480 | 9,568,958 | 426,705 | 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);
}
... | private InputStream getPart() throws IOException {
HttpGet get = new HttpGet(url);
get.addHeader("Range", "bytes=" + startAt + "-");
HttpResponse res = client.execute(get);
System.out.println("requesting kBs from " + startAt + " server reply:" + res.getStatusLine());
if (... | false |
899,481 | 20,059,828 | 14,212,319 | public synchronized AbstractBaseObject update(AbstractBaseObject obj) throws ApplicationException {
PreparedStatement preStat = null;
StringBuffer sqlStat = new StringBuffer();
MailSetting tmpMailSetting = (MailSetting) ((MailSetting) obj).clone();
synchronized (dbConn) {
... | @Override
public String resolveItem(String oldJpgFsPath) throws DatabaseException {
if (oldJpgFsPath == null || "".equals(oldJpgFsPath)) throw new NullPointerException("oldJpgFsPath");
try {
getConnection().setAutoCommit(false);
} catch (SQLException e) {
LOGGER.w... | true |
899,482 | 22,942,858 | 7,288,760 | public void readHTMLFromURL(URL url) throws IOException {
InputStream in = url.openStream();
try {
readHTMLFromStream(new InputStreamReader(in));
} finally {
try {
in.close();
} catch (IOException ex) {
Logger.getLogger(HTML... | public void testDecode1000BinaryStore() throws Exception {
EXISchema corpus = EXISchemaFactoryTestUtil.getEXISchema("/DataStore/DataStore.xsd", getClass(), m_compilerErrors);
Assert.assertEquals(0, m_compilerErrors.getTotalCount());
GrammarCache grammarCache = new GrammarCache(corpus, Gramma... | false |
899,483 | 10,539,421 | 17,058,342 | public static String sha1(String clearText, String seed) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update((seed + clearText).getBytes());
return convertToHex(md.digest());
} catch (Exception e) {
throw new RuntimeException(e.get... | public void executeUpdate(Native nativeResource) throws Exception {
Connection con = null;
boolean autoCommit = true;
PreparedStatement st = null;
try {
HrRecord hr = getRepository();
ManagedConnection mc = returnConnection();
con = mc.getJdbcConne... | false |
899,484 | 18,548,122 | 16,598,485 | private static String loadUrlToString(String a_url) throws IOException {
URL l_url1 = new URL(a_url);
BufferedReader br = new BufferedReader(new InputStreamReader(l_url1.openStream()));
String l_content = "";
String l_ligne = null;
l_content = br.readLine();
while ((l... | private void writeToUrl(byte[] data, String url) throws IOException, MalformedURLException {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
OutputStream out = connection.getOutputStream();
out.write(data);
out.flush();
out.close();
}
| false |
899,485 | 22,677,813 | 22,670,950 | @Override
public Class<?> loadClass(final String name) throws ClassNotFoundException {
final String baseName = StringUtils.substringBefore(name, "$");
if (baseName.startsWith("java") && !whitelist.contains(baseName) && !additionalWhitelist.contains(baseName)) {
th... | private void writeInputStreamToFile(InputStream stream, File file) {
try {
FileOutputStream fOut = new FileOutputStream(file);
IOUtils.copy(stream, fOut);
fOut.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOExcepti... | true |
899,486 | 21,125,856 | 10,005,674 | public File createWindow(String pdfUrl) {
URL url;
InputStream is;
try {
int fileLength = 0;
String str;
if (pdfUrl.startsWith("jar:/")) {
str = "file.pdf";
is = this.getClass().getResourceAsStream(pdfUrl.substring(4));
... | public String post() {
if (content == null || content.equals("")) return "Type something to publish!!";
OutputStreamWriter wr = null;
BufferedReader rd = null;
try {
String data = URLEncoder.encode("api", "UTF-8") + "=" + URLEncoder.encode(apiKey, "UTF-8");
da... | false |
899,487 | 12,727,792 | 4,562,924 | public static void copyFile(File source, File target) throws Exception {
if (source == null || target == null) {
throw new IllegalArgumentException("The arguments may not be null.");
}
try {
FileChannel srcChannel = new FileInputStream(source).getChannel();
... | public static void readTestData(String getDkpUrl) throws Exception {
final URL url = new URL(getDkpUrl);
final InputStream is = url.openStream();
try {
final LineNumberReader rd = new LineNumberReader(new BufferedReader(new InputStreamReader(is)));
String line = rd.re... | false |
899,488 | 21,293,476 | 15,571,541 | public void addGames(List<Game> games) throws StadiumException, SQLException {
Connection conn = ConnectionManager.getManager().getConnection();
conn.setAutoCommit(false);
PreparedStatement stm = null;
ResultSet rs = null;
try {
for (Game game : games) {
... | 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 |
899,489 | 22,221,713 | 854,262 | private void copyFile(String sourceFilename, String targetFilename) throws IOException {
File source = new File(sourceFilename);
File target = new File(targetFilename);
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(target);
byte[] buf =... | 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 |
899,490 | 293,542 | 14,847,921 | public stock(String ticker) {
try {
URL url = new URL("http://finance.yahoo.com/q?s=" + ticker + "&d=v1");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
StringBuffer page = new StringBuffer(8192);
... | protected static void copyFile(File from, File to) throws IOException {
if (!from.isFile() || !to.isFile()) {
throw new IOException("Both parameters must be files. from is " + from.isFile() + ", to is " + to.isFile());
}
FileChannel in = (new FileInputStream(from)).getChannel();
... | false |
899,491 | 6,371,612 | 17,166,549 | public void removeUserFromRealm(final List<NewUser> users) {
try {
connection.setAutoCommit(false);
final List<Integer> removeFromNullRealm = (List<Integer>) new ProcessEnvelope().executeObject(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
@O... | private static void userAuth(String challenge) throws IOException {
try {
MessageDigest md = MessageDigest.getInstance("BrokenMD4");
String passwd = null;
if (System.getProperty("jarsync.password.gui") != null) {
JPasswordField pass = new JPasswordField();... | false |
899,492 | 23,411,500 | 3,175,529 | public void playSIDFromHVSC(String name) {
player.reset();
player.setStatus("Loading song: " + name);
URL url;
try {
if (name.startsWith("/")) {
name = name.substring(1);
}
url = getResource(hvscBase + name);
if (player.... | private static String connect(String apiURL, boolean secure) throws IOException {
String baseUrl;
if (secure) baseUrl = "https://todoist.com/API/"; else baseUrl = "http://todoist.com/API/";
URL url = new URL(baseUrl + apiURL);
URLConnection c = url.openConnection();
BufferedR... | false |
899,493 | 7,823,489 | 9,924,413 | 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... | private void startOpening(final URL url) {
final WebAccessor wa = this;
openerThread = new Thread() {
public void run() {
iStream = null;
try {
tryProxy = false;
URLConnection connection = url.openConnection();
... | false |
899,494 | 11,592,707 | 488,614 | public static String getBiopaxId(Reaction reaction) {
String id = null;
if (reaction.getId() > Reaction.NO_ID_ASSIGNED) {
id = reaction.getId().toString();
} else {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(re... | 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 |
899,495 | 5,592,500 | 17,261,863 | public static synchronized String encrypt(String plaintext) throws SinaduraCoreException {
MessageDigest md = null;
String hash = null;
try {
md = MessageDigest.getInstance("SHA");
try {
md.update(plaintext.getBytes(CHARSET_UTF8));
} catch ... | @Override
public void parse() throws IOException {
URL url = new URL(getDataUrl());
URLConnection con = url.openConnection();
BufferedReader bStream = new BufferedReader(new InputStreamReader(con.getInputStream()));
String s = bStream.readLine();
String[] tokens = s.split... | false |
899,496 | 4,681,908 | 11,504,871 | private void callbackWS(String xmlControl, String ws_results, long docId) {
SimpleProvider config;
Service service;
Object ret;
Call call;
Object[] parameter;
String method;
String wsurl;
URL url;
NodeList delegateNodes;
Node actualNode... | public static String encrypt(String password) throws NoSuchAlgorithmException {
java.security.MessageDigest d = null;
d = java.security.MessageDigest.getInstance("MD5");
d.reset();
d.update(password.getBytes());
byte[] cr = d.digest();
return getString(cr).toLowerCase... | false |
899,497 | 18,349,315 | 2,687,278 | 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
protected void copy(InputStream inputs, OutputStream outputs) throws IOException {
if (outputs == null) {
throw new NullPointerException();
}
if (inputs == null) {
throw new NullPointerException();
}
ZipOutputStream zipoutputs = null;
... | true |
899,498 | 15,858,891 | 20,991,251 | @Override
public void send() {
BufferedReader in = null;
StringBuffer result = new StringBuffer();
try {
URL url = new URL(getUrl());
in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine())... | private void initialize() {
List providers = new ArrayList();
while (this.urls.hasMoreElements()) {
URL url = (URL) this.urls.nextElement();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8... | true |
899,499 | 20,080,077 | 19,045,087 | public Writer createWriter(File outfile, String encoding) throws UnsupportedEncodingException, IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outfile));
zos.setMethod(ZipO... | public static void copyfile(String src, String dst) throws IOException {
dst = new File(dst).getAbsolutePath();
new File(new File(dst).getParent()).mkdirs();
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel(... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.