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 |
|---|---|---|---|---|---|
898,500 | 20,149,832 | 20,275,058 | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
try {
URL url = new URL("http://placekitten.com/g/500/250");
HttpURLConnectio... | protected void doGetPost(HttpServletRequest req, HttpServletResponse resp, boolean post) throws ServletException, IOException {
if (responseBufferSize > 0) resp.setBufferSize(responseBufferSize);
String pathinfo = req.getPathInfo();
if (pathinfo == null) {
String urlstring = req.... | false |
898,501 | 1,951,103 | 325,062 | private List<File> ungzipFile(File directory, File compressedFile) throws IOException {
List<File> files = new ArrayList<File>();
TarArchiveInputStream in = new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(compressedFile)));
try {
TarArchiveEntry entry = in.getNe... | public void readMESHDescriptorFileIntoFiles(String outfiledir) {
String inputLine, ins;
String filename = getMESHdescriptorfilename();
String uid = "";
String name = "";
String description = "";
String element_of = "";
Vector treenr = new Vector();
Vec... | true |
898,502 | 12,764,163 | 11,514,180 | public Out(Article article) throws Exception {
String body = article.meta(ARTICLE_BODY).getString();
String url = find("a", "href", body);
while (url.length() > 0 && url.startsWith("http://")) {
System.out.println(url);
conn = (HttpURLConnectio... | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | false |
898,503 | 13,929,879 | 18,396,375 | public void contextInitialized(ServletContextEvent event) {
try {
String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) {
URL url = new URL("http://localhost/");
URLConnection urlConn = url.openC... | public static String hash(String plaintext) {
if (plaintext == null) {
return "";
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
md.update(plaintext.getBytes("UTF-8"));
} catch (Exception e) {
}
ret... | false |
898,504 | 19,579,830 | 18,956,180 | public static void copy(File toCopy, File dest) throws IOException {
FileInputStream src = new FileInputStream(toCopy);
FileOutputStream out = new FileOutputStream(dest);
try {
while (src.available() > 0) {
out.write(src.read());
}
} finally {
... | private void copyMerge(Path[] sources, OutputStream out) throws IOException {
Configuration conf = getConf();
for (int i = 0; i < sources.length; ++i) {
FileSystem fs = sources[i].getFileSystem(conf);
InputStream in = fs.open(sources[i]);
try {
IOU... | true |
898,505 | 18,192,940 | 23,574,721 | public static void nuovoAcquisto(int quantita, Date d, double price, int id) throws SQLException {
MyDBConnection c = new MyDBConnection();
c.init();
Connection conn = c.getMyConnection();
PreparedStatement ps = conn.prepareStatement(insertAcquisto);
ps.setInt(1, quantita);
... | public void updateProfile() throws ClassNotFoundException, SQLException {
Connection connection = null;
PreparedStatement ps1 = null;
PreparedStatement ps2 = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(this.url)... | true |
898,506 | 20,826,357 | 23,032,732 | public boolean verify(String digest, String password) throws NoSuchAlgorithmException {
String alg = null;
int size = 0;
if (digest.regionMatches(true, 0, "{CRYPT}", 0, 7)) {
digest = digest.substring(7);
return UnixCrypt.matches(digest, password);
} else if (... | private static String getDigestPassword(String streamId, String password) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw (RuntimeException) new IllegalStateException().initCause(e);
}
... | true |
898,507 | 7,174,662 | 19,780,094 | private void loadInitialDbState() throws IOException {
InputStream in = SchemaAndDataPopulator.class.getClassLoader().getResourceAsStream(resourceName);
StringWriter writer = new StringWriter();
IOUtils.copy(in, writer);
for (String statement : writer.toString().split(SQL_STATEMENT_D... | protected PTask commit_result(Result r, SyrupConnection con) throws Exception {
try {
int logAction = LogEntry.ENDED;
String kk = r.context().task().key();
if (r.in_1_consumed() && r.context().in_1_link() != null) {
sqlImpl().updateFunctions().updateInLink... | false |
898,508 | 12,577,738 | 21,204,167 | public boolean check(Object credentials) {
try {
byte[] digest = null;
if (credentials instanceof Password || credentials instanceof String) {
synchronized (__TYPE) {
if (__md == null) __md = MessageDigest.getInstance("MD5")... | private String getEncryptedPassword() {
String encrypted;
char[] pwd = password.getPassword();
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(new String(pwd).getBytes("UTF-8"));
byte[] digested = md.digest();
encrypted =... | true |
898,509 | 860,578 | 4,981,909 | 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 File enregistrerFichier(String fileName, File file, String path, String fileMime) throws Exception {
if (file != null) {
try {
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
... | true |
898,510 | 10,398,987 | 8,330,064 | 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 + ".");
... | @Test
public void testWriteAndReadBigger() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | false |
898,511 | 401,685 | 9,096,316 | public void elimina(Pedido pe) throws errorSQL, errorConexionBD {
System.out.println("GestorPedido.elimina()");
int id = pe.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM pedido WHERE id=" + id;
System.out.... | private void handleNodeDown(long eventID, long nodeID, String eventTime) {
Category log = ThreadCategory.getInstance(OutageWriter.class);
if (eventID == -1 || nodeID == -1) {
log.warn(EventConstants.NODE_DOWN_EVENT_UEI + " ignored - info incomplete - eventid/nodeid: " + eventID + "/" + n... | true |
898,512 | 1,888,878 | 4,149,290 | protected void copyFile(File source, File destination) throws ApplicationException {
try {
OutputStream out = new FileOutputStream(destination);
DataInputStream in = new DataInputStream(new FileInputStream(source));
byte[] buf = new byte[8192];
for (int nread ... | private String getSearchResults(String id) {
try {
final URL url = new URL("http://www.jaap.nl/api/jaapAPI.do?clientId=iPhone&limit=5&request=details&id=" + id + "&format=JSON&field=street_nr&field=zip&field=city&field=price&field=thumb&field=since&field=houseType&field=area&field=rooms&field=id... | false |
898,513 | 18,047,482 | 19,299,263 | @Transactional(readOnly = false)
public void saveOrUpdateProduct(Product product, File[] doc, String[] docFileName, String[] docContentType) throws IOException {
logger.info("addOrUpdateProduct()");
List<Images> imgList = new ArrayList<Images>();
InputStream in = null;
OutputStre... | 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 ==... | true |
898,514 | 10,251,387 | 1,015,744 | @Override
public void close() throws IOException {
super.close();
byte[] signatureData = toByteArray();
ZipOutputStream zipOutputStream = new ZipOutputStream(this.targetOutputStream);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(this.originalZipFile));
... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
try {
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel... | true |
898,515 | 17,585,729 | 15,734,479 | private File sendQuery(String query) throws MusicBrainzException {
File xmlServerResponse = null;
try {
xmlServerResponse = new File(SERVER_RESPONSE_FILE);
long start = Calendar.getInstance().getTimeInMillis();
System.out.println("\n\n+++++++++++++++++++++++++++++... | private List<String[]> retrieveData(String query) {
List<String[]> data = new Vector<String[]>();
query = query.replaceAll("\\s", "+");
String q = "http://www.uniprot.org/uniprot/?query=" + query + "&format=tab&columns=id,protein%20names,organism";
try {
URL url = new URL... | true |
898,516 | 21,262,909 | 20,926,398 | public static void find(String pckgname, Class<?> tosubclass) {
String name = new String(pckgname);
if (!name.startsWith("/")) {
name = "/" + name;
}
name = name.replace('.', '/');
URL url = tosubclass.getResource(name);
System.out.println(name + "->" + ur... | public static Cursor load(URL url, String descriptor) {
if (url == null) {
log.log(Level.WARNING, "Trying to load a cursor with a null url.");
return null;
}
String cursorFile = url.getFile();
BufferedReader reader = null;
int lineNumber = 0;
t... | false |
898,517 | 5,435,234 | 8,250,731 | public static String getURLContent(String urlStr) throws MalformedURLException, IOException {
URL url = new URL(urlStr);
log.info("url: " + url);
URLConnection conn = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
S... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String uuid = req.getParameterValues(Constants.PARAM_UUID)[0];
String datastream = null;
if (req.getRequestURI().contains(Constants.SERVLET_DOWNLOAD_FOXML_PREFIX)) {
... | false |
898,518 | 22,538,273 | 19,643,373 | public void format(File source, File target) {
if (!source.exists()) {
throw new IllegalArgumentException("Source '" + source + " doesn't exist");
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source '" + source + " is not a file");
}
t... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
898,519 | 11,481,709 | 23,047,157 | public boolean copy(File fromFile) throws IOException {
FileUtility toFile = this;
if (!fromFile.exists()) {
abort("FileUtility: no such source file: " + fromFile.getAbsolutePath());
return false;
}
if (!fromFile.isFile()) {
abort("FileUtility: can... | @Override
public void run() {
long timeout = 10 * 1000L;
long start = (new Date()).getTime();
try {
InputStream is = socket.getInputStream();
boolean available = false;
while (!available && !socket.isClosed()) {
... | true |
898,520 | 19,926,790 | 20,071,852 | public void generateReport(AllTestsResult atr, AllConvsResult acr, File nwbConvGraph) {
ConvResult[] convs = acr.getConvResults();
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new FileReader(nwbConvGraph));
writ... | void write() throws IOException {
if (!allowUnlimitedArgs && args != null && args.length > 1) throw new IllegalArgumentException("Only one argument allowed unless allowUnlimitedArgs is enabled");
String shebang = "#!" + interpretter;
for (int i = 0; i < args.length; i++) {
sheban... | true |
898,521 | 20,453,777 | 15,958,994 | private static List retrieveQuotes(Report report, Symbol symbol, TradingDate startDate, TradingDate endDate) throws ImportExportException {
List quotes = new ArrayList();
String URLString = constructURL(symbol, startDate, endDate);
EODQuoteFilter filter = new YahooEODQuoteFilter(symbol);
... | public String loadURLString(java.net.URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String s = "";
while (br.ready() && s != null) {
s = br.readLine();
... | true |
898,522 | 9,856,200 | 16,579,945 | public static void copyFile(File srcFile, File destFolder) {
try {
File destFile = new File(destFolder, srcFile.getName());
if (destFile.exists()) {
throw new BuildException("Could not copy " + srcFile + " to " + destFolder + " as " + destFile + " already exists");
... | public he3Decode(String in_file) {
try {
File out = new File(in_file + extension);
File in = new File(in_file);
int file_size = (int) in.length();
FileInputStream in_stream = new FileInputStream(in_file);
out.createNewFile();
FileOutput... | true |
898,523 | 6,951,110 | 8,335,944 | public ValidEPoint[] split(EPoint o, EPoint e1, long v1, EPoint e2) throws MalformedURLException, IOException, NoSuchAlgorithmException, InvalidEPointCertificateException, InvalidKeyException, SignatureException {
URLConnection u = new URL(url, "action").openConnection();
OutputStream os;
In... | public static byte[] sendRequestV1(String url, Map<String, Object> params, String secretCode, String method, Map<String, String> files, String encoding, String signMethod, Map<String, String> headers, String contentType) {
HttpClient client = new HttpClient();
byte[] result = null;
if (metho... | false |
898,524 | 16,981,230 | 11,418,746 | public static String encrypt(final String password, final String algorithm, final byte[] salt) {
final StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented"... | private String buildShaHashOf(String source) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(source.getBytes());
return new BigInteger(1, md.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
... | true |
898,525 | 210,587 | 6,506,273 | 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... | public static byte[] hash(String plainTextValue) {
MessageDigest msgDigest;
try {
msgDigest = MessageDigest.getInstance("MD5");
msgDigest.update(plainTextValue.getBytes("UTF-8"));
byte[] digest = msgDigest.digest();
return digest;
} catch (Exce... | false |
898,526 | 7,460,369 | 16,948,800 | 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.B64InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base... | 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 |
898,527 | 3,803,023 | 19,480,308 | public static String callApi(String api, String paramname, String paramvalue) {
String loginapp = SSOFilter.getLoginapp();
String u = SSOUtil.addParameter(loginapp + "/api/" + api, paramname, paramvalue);
u = SSOUtil.addParameter(u, "servicekey", SSOFilter.getServicekey());
String re... | @Override
@SuppressWarnings("empty-statement")
public void run() {
String server = System.getProperty("server.downsampler");
if (server == null) server = FALLBACK;
String url = server + "cgi-bin/downsample.cgi?" + this._uri.toString();
url = url.re... | false |
898,528 | 4,886,971 | 17,682,090 | private static void copyFile(String srFile, String dtFile) {
try {
File f1 = new File(srFile);
File f2 = new File(dtFile);
InputStream in = new FileInputStream(f1);
OutputStream out = new FileOutputStream(f2);
byte[] buf = new byte[1024];
... | public Reader transform(Reader reader, Map<String, Object> parameterMap) {
try {
File file = File.createTempFile("srx2", ".srx");
file.deleteOnExit();
Writer writer = getWriter(getFileOutputStream(file.getAbsolutePath()));
transform(reader, writer, parameterMa... | true |
898,529 | 15,889,430 | 16,098,010 | public Parameters getParameters(HttpExchange http) throws IOException {
ParametersImpl params = new ParametersImpl();
String query = null;
if (http.getRequestMethod().equalsIgnoreCase("GET")) {
query = http.getRequestURI().getRawQuery();
} else if (http.getRequestMethod()... | public static void copyFile(String src, String target) throws IOException {
FileChannel ic = new FileInputStream(src).getChannel();
FileChannel oc = new FileOutputStream(target).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
}
| true |
898,530 | 21,288,637 | 9,714,373 | @org.junit.Test
public void simpleRead() throws Exception {
final InputStream istream = StatsInputStreamTest.class.getResourceAsStream("/testFile.txt");
final StatsInputStream ris = new StatsInputStream(istream);
assertEquals("read size", 0, ris.getSize());
IOUtils.copy(ris, new ... | private void loadOverrideProperties(String uri) {
try {
File f = new File(uri);
Properties temp = new Properties();
if (f.exists()) {
info("Found config override file " + f.getAbsolutePath());
try {
InputStream readStrea... | false |
898,531 | 18,065,572 | 15,372,362 | public static String executePost(String urlStr, String content) {
StringBuffer result = new StringBuffer();
try {
Authentication.doIt();
URL url = new URL(urlStr);
System.out.println("Host: " + url.getHost());
HttpURLConnection connection = (HttpURLCon... | public List<String> loadList(String name) {
List<String> ret = new ArrayList<String>();
try {
URL url = getClass().getClassLoader().getResource("lists/" + name + ".utf-8");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
... | false |
898,532 | 16,116,225 | 10,249,398 | public void process(String t) {
try {
MessageDigest md5 = MessageDigest.getInstance(MD5_DIGEST);
md5.reset();
md5.update(t.getBytes());
callback.display(null, digestToHexString(md5.digest()));
} catch (Exception ex) {
callback.display(null,... | public String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | true |
898,533 | 11,070,888 | 253,661 | public static void copyFile(File file, File dest_file) throws FileNotFoundException, IOException {
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dest_file)));
... | 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 |
898,534 | 14,193,056 | 12,345,227 | public static String readFromURL(String url_) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(url_);
System.setProperty("http.agent", "");
URLConnection connection = url.openConnection();
connection.setRequestProperty("User-Agent", ... | 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... | false |
898,535 | 19,947,818 | 497,400 | public boolean update(int idPartida, partida partidaModificada) {
int intResult = 0;
String sql = "UPDATE partida " + "SET torneo_idTorneo = ?, " + " jugador_idJugadorNegras = ?, jugador_idJugadorBlancas = ?, " + " fecha = ?, " + " resultado = ?, " + " nombreBlancas = ?, nombreNegras = ?, eloBlancas... | public TVRageShowInfo(String xmlShowName) {
String[] tmp, tmp2;
String line = "";
this.usrShowName = xmlShowName;
try {
URL url = new URL("http://www.tvrage.com/quickinfo.php?show=" + xmlShowName.replaceAll(" ", "%20"));
BufferedReader in = new BufferedReader(... | false |
898,536 | 17,273,098 | 23,677,111 | private void copyJdbcDriverToWL(final WLPropertyPage page) {
final File url = new File(page.getDomainDirectory());
final File lib = new File(url, "lib");
final File mysqlLibrary = new File(lib, NexOpenUIActivator.getDefault().getMySQLDriver());
if (!mysqlLibrary.exists()) {
... | public static String downloadWebpage1(String address) throws MalformedURLException, IOException {
URL url = new URL(address);
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
String page = "";
while((line = br.readLine()) != null) {
page += line + "\n";
}
b... | false |
898,537 | 11,683,526 | 17,217,414 | private static boolean moveFiles(String sourceDir, String targetDir) {
boolean isFinished = false;
boolean fileMoved = false;
File stagingDir = new File(sourceDir);
if (!stagingDir.exists()) {
System.out.println(getTimeStamp() + "ERROR - source directory does not exist.")... | public void addEntry(InputStream jis, JarEntry entry) throws IOException, URISyntaxException {
File target = new File(this.target.getPath() + entry.getName()).getAbsoluteFile();
if (!target.exists()) {
target.createNewFile();
}
if ((new File(this.source.toURI())).isDirect... | true |
898,538 | 20,979,133 | 19,035,955 | public String report() {
if (true) return "-";
StringBuffer parameter = new StringBuffer("?");
if (getRecord_ID() == 0) return "ID=0";
if (getRecord_ID() == 1) {
parameter.append("ISSUE=");
HashMap htOut = get_HashMap();
try {
ByteA... | public static void main(String[] args) throws Exception {
TripleDES tdes = new TripleDES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\testTDESENC.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\testTDESDEC.txt"));
Sin... | false |
898,539 | 8,539,546 | 2,031,877 | private static void unpackEntry(File destinationFile, ZipInputStream zin, ZipEntry entry) throws Exception {
if (!entry.isDirectory()) {
createFolders(destinationFile.getParentFile());
FileOutputStream fis = new FileOutputStream(destinationFile);
try {
IOU... | public byte[] getResponseContent() throws IOException {
if (responseContent == null) {
InputStream is = getResponseStream();
if (is == null) {
responseContent = new byte[0];
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream(40... | true |
898,540 | 956,075 | 1,429,497 | public void loginSendSpace() throws Exception {
loginsuccessful = false;
HttpParams params = new BasicHttpParams();
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
DefaultHttpClient httpclient = new Defaul... | private Scanner getUrlScanner(String strUrl) {
URL urlParticipants = null;
Scanner scannerParticipants;
try {
urlParticipants = new URL(strUrl);
URLConnection connParticipants;
if (StringUtils.isBlank(this.configProxyIp)) {
connParticipants... | false |
898,541 | 21,498,342 | 6,871,526 | private void fetchTree() throws IOException {
String urlString = BASE_URL + TREE_URL + DATASET_URL + "&family=" + mFamily;
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String toParse = in.readLine();
while (in.... | private boolean cacheUrlFile(String filePath, String realUrl, boolean isOnline) {
try {
URL url = new URL(realUrl);
String encoding = "gbk";
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), encoding));
StringBuilder sb = new Strin... | false |
898,542 | 15,031,489 | 7,103,222 | public Point getCoordinates(String address, String city, String state, String country) {
StringBuilder queryString = new StringBuilder();
StringBuilder urlString = new StringBuilder();
StringBuilder response = new StringBuilder();
if (address != null) {
queryString.append... | public void testGet() throws Exception {
HttpGet request = new HttpGet(baseUri + "/test");
HttpResponse response = client.execute(request);
assertEquals(200, response.getStatusLine().getStatusCode());
assertEquals("test", TestUtil.getResponseAsString(response));
}
| false |
898,543 | 330,930 | 9,793,280 | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | public SqlScript(URL url, IDbDialect platform, boolean failOnError, String delimiter, Map<String, String> replacementTokens) {
try {
fileName = url.getFile();
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
log.log(LogLevel.INFO, "Loading sql from script %s"... | false |
898,544 | 3,220,986 | 10,353,862 | public static String calculateHash(String password) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
md.reset();
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
md.update(password.getBytes());
... | public boolean copyTo(String targetFilePath) {
try {
FileInputStream srcFile = new FileInputStream(filePath);
FileOutputStream target = new FileOutputStream(targetFilePath);
byte[] buff = new byte[1024];
int readed = -1;
while ((readed = srcFile.re... | false |
898,545 | 7,999,926 | 5,832,949 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
Object msg = e.getMessage();
if (!(msg instanceof HttpMessage) && !(msg instanceof HttpChunk)) {
ctx.sendUpstream(e);
return;
}
HttpMessage currentMessage =... | private void getImage(String filename) throws MalformedURLException, IOException, SAXException, FileNotFoundException {
String url = Constants.STRATEGICDOMINATION_URL + "/images/gameimages/" + filename;
WebRequest req = new GetMethodWebRequest(url);
WebResponse response = wc.getResponse(req)... | true |
898,546 | 11,219,274 | 19,886,621 | private static void addFolderToZip(File folder, ZipOutputStream zip, String baseName) throws IOException {
File[] files = folder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
String name = file.getAbsolutePath().substring(baseName.length());
... | private void doPOST(HttpURLConnection connection, InputStream inputXML) throws MessageServiceException {
try {
OutputStream requestStream = new BufferedOutputStream(connection.getOutputStream());
IOUtils.copyAndClose(inputXML, requestStream);
connection.connect();
... | true |
898,547 | 13,207,438 | 21,756,553 | public String sendRequestHTTPTunelling(java.lang.String servletName, java.lang.String request) {
String reqxml = "";
org.jdom.Document retdoc = null;
String myurl = java.util.prefs.Preferences.systemRoot().get("serverurl", "");
String myport = java.util.prefs.Preferences.systemRoot()... | public static List<String> list() throws IOException {
List<String> providers = new ArrayList<String>();
Enumeration<URL> urls = ClassLoader.getSystemResources("sentrick.classifiers");
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
String provider = nu... | true |
898,548 | 150,478 | 9,918,989 | 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 byte[] hash(String data, HashAlg alg) {
try {
MessageDigest digest = MessageDigest.getInstance(alg.toString());
digest.update(data.getBytes());
byte[] hash = digest.digest();
return hash;
} catch (NoSuchAlgorithmException e) {
}
... | false |
898,549 | 19,747,820 | 17,750,515 | public String parse(String term) throws OntologyAdaptorException {
try {
String sUrl = getUrl(term);
if (sUrl.length() > 0) {
URL url = new URL(sUrl);
InputStream in = url.openStream();
StringBuilder sb = new StringBuilder();
... | public SukuData updatePerson(String usertext, SukuData req) {
String insPers;
String userid = Utils.toUsAscii(usertext);
if (userid != null && userid.length() > 16) {
userid = userid.substring(0, 16);
}
StringBuilder sb = new StringBuilder();
sb.append("in... | false |
898,550 | 5,656,506 | 441,377 | private void copyFile(File source, File target) throws IOException {
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(target).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
... | 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 |
898,551 | 17,831,556 | 3,803,024 | 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());
... | public static String validateAuthTicketAndGetSessionId(ServletRequest request, String servicekey) {
String loginapp = SSOFilter.getLoginapp();
String authticket = request.getParameter("authticket");
String u = SSOUtil.addParameter(loginapp + "/api/validateauthticket", "authticket", authticke... | false |
898,552 | 2,232,619 | 13,199,957 | public void testStorageStringWriter() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
{
Writer w = r.getWriter();
w.write("This is an example");
w.write(" and another one.");
w.flush();
ass... | private File copyFile(String fileInClassPath, String systemPath) throws Exception {
InputStream is = getClass().getResourceAsStream(fileInClassPath);
OutputStream os = new FileOutputStream(systemPath);
IOUtils.copy(is, os);
is.close();
os.close();
return new File(syst... | true |
898,553 | 13,292,288 | 6,214,331 | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | public static void copyFile(File src, File dest) {
try {
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
... | true |
898,554 | 19,826,765 | 22,363,264 | 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 static String md5Crypt(final byte[] key, final byte[] salt) throws NoSuchAlgorithmException {
if (key == null || key.length == 0) {
throw new IllegalArgumentException("Argument 'key' cannot be null or an empty array.");
}
if (salt == null || salt.length == 0) {
... | true |
898,555 | 21,929,693 | 10,330,323 | private void importUrl(String str) throws Exception {
URL url = new URL(str);
InputStream xmlStream = url.openStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
MessageHolder messages = MessageHolder.getInstance();
DocumentBuilder builder = facto... | public void getFile(String url, String filepath) throws BggException {
System.out.println(url);
int retry = retryCount + 1;
lastURL = url;
for (retriedCount = 0; retriedCount < retry; retriedCount++) {
int responseCode = -1;
try {
HttpURLConnec... | false |
898,556 | 17,553,389 | 21,561,833 | @Override
public boolean putUserDescription(String openID, String uuid, String description) throws DatabaseException {
if (uuid == null) throw new NullPointerException("uuid");
if (description == null) throw new NullPointerException("description");
try {
getConnection().setAu... | private static void copyFile(String src, String dest) throws IOException {
File destFile = new File(dest);
if (destFile.exists()) {
destFile.delete();
}
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(d... | false |
898,557 | 6,189,963 | 22,095,678 | public String jsFunction_send(String postData) {
URL url = null;
try {
if (_uri.startsWith("http")) {
url = new URL(_uri);
} else {
url = new URL("file://./" + _uri);
}
} catch (MalformedURLException e) {
IdeLog.... | public static String deleteTag(String tag_id) {
String so = OctopusErrorMessages.UNKNOWN_ERROR;
if (tag_id == null || tag_id.trim().equals("")) {
return OctopusErrorMessages.TAG_ID_CANT_BE_EMPTY;
}
DBConnection theConnection = null;
try {
theConnection... | false |
898,558 | 3,298,287 | 22,998,999 | public static String remove_tag(String sessionid, String absolutePathForTheSpesificTag) {
String resultJsonString = "some problem existed inside the create_new_tag() function if you see this string";
try {
Log.d("current running function name:", "remove_tag");
HttpClient http... | public static void concatFiles(List<File> sourceFiles, File destFile) throws IOException {
FileOutputStream outFile = new FileOutputStream(destFile);
FileChannel outChannel = outFile.getChannel();
for (File f : sourceFiles) {
FileInputStream fis = new FileInputStream(f);
... | false |
898,559 | 7,760,990 | 9,593,609 | public DatabaseDefinitionFactory(final DBIf db, final String adapter) throws IOException {
_db = db;
LOG.debug("Loading adapter: " + adapter);
final URL url = getClass().getClassLoader().getResource("adapter/" + adapter + ".properties");
_props = new Properties();
_props.load... | public static void main(String[] args) throws Exception {
File rootDir = new File("C:\\dev\\workspace_fgd\\gouvqc_crggid\\WebContent\\WEB-INF\\upload");
File storeDir = new File(rootDir, "storeDir");
File workDir = new File(rootDir, "workDir");
LoggerFacade loggerFacade = new Commons... | false |
898,560 | 17,366,812 | 1,613,935 | public String tranportRemoteUnitToLocalTempFile(String urlStr) throws UnitTransportException {
InputStream input = null;
BufferedOutputStream bos = null;
File tempUnit = null;
try {
URL url = null;
int total = 0;
try {
url = new URL... | public static boolean copyFile(File sourceFile, File destinationFile) {
boolean copySuccessfull = false;
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(... | true |
898,561 | 5,053,350 | 16,208,627 | @Test
public void testGrantLicense() throws Exception {
context.turnOffAuthorisationSystem();
Item item = Item.create(context);
String defaultLicense = ConfigurationManager.getDefaultSubmissionLicense();
LicenseUtils.grantLicense(context, item, defaultLicense);
StringWrit... | @Override
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
final String url = req.getParameter("url");
if (!isAllowed(url)) {
resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
... | true |
898,562 | 9,869,150 | 9,219,797 | private String unJar(String jarPath, String jarEntry) {
String path;
if (jarPath.lastIndexOf("lib/") >= 0) path = jarPath.substring(0, jarPath.lastIndexOf("lib/")); else path = jarPath.substring(0, jarPath.lastIndexOf("/"));
String relPath = jarEntry.substring(0, jarEntry.lastIndexOf("/"));
... | 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 |
898,563 | 11,319,480 | 3,621,718 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public void initURL(URL url, boolean cache) throws IOException {
this.url = url;
if (cache) {
System.out.println(getClass().getName() + ": caching '" + url + "'");
InputStream urlIS = new BufferedInputStream(url.openStream(), 1024 * 30);
file = File.createTempFile... | false |
898,564 | 10,288,424 | 14,782,656 | public static String encrypt(String x) throws Exception {
MessageDigest mdEnc = MessageDigest.getInstance("SHA-1");
mdEnc.update(x.getBytes(), 0, x.length());
String md5 = new BigInteger(1, mdEnc.digest()).toString(16);
return md5;
}
| private static Long statusSWGCraftTime() {
long current = System.currentTimeMillis() / 1000L;
if (current < (previousStatusCheck + SWGCraft.STATUS_CHECK_DELAY)) return previousStatusTime;
URL url = null;
try {
synchronized (previousStatusTime) {
if (curren... | false |
898,565 | 16,903,092 | 21,750,583 | public String sendSMS(String destinationNumber, String txt, String id) throws IOException {
String out = "";
String smsdata = "";
smsdata += URLEncoder.encode("id", enc) + "=" + URLEncoder.encode(id, enc);
smsdata += "&" + URLEncoder.encode("phoneNumber", enc) + "=" + URLEncoder.enco... | protected void doProxyInternally(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpRequestBase proxyReq = buildProxyRequest(req);
URI reqUri = proxyReq.getURI();
String cookieDomain = reqUri.getHost();
DefaultHttpClient httpClient = new Defau... | false |
898,566 | 3,743,400 | 1,349,815 | private static byte[] calcMd5(String pass) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(pass.getBytes(), 0, pass.length());
byte[] hash = digest.digest();
return hash;
} catch (NoSuchAlgorithmException e)... | public String getClass(EmeraldjbBean eb) throws EmeraldjbException {
Entity entity = (Entity) eb;
StringBuffer sb = new StringBuffer();
String myPackage = getPackageName(eb);
sb.append("package " + myPackage + ";\n");
sb.append("\n");
DaoValuesGenerator valgen = new D... | false |
898,567 | 597,799 | 17,253,878 | static void conditionalCopyFile(File dst, File src) throws IOException {
if (dst.equals(src)) return;
if (!dst.isFile() || dst.lastModified() < src.lastModified()) {
System.out.println("Copying " + src);
InputStream is = new FileInputStream(src);
OutputStream os =... | public void onUpload$btnFileUpload(UploadEvent ue) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
if (ue == null) {
System.out.println("unable to upload file");
return;
} else {
System.out.println("fileUploaded()");
}
... | true |
898,568 | 18,170,211 | 18,034,376 | static List<String> readZipFilesOftypeToFolder(String zipFileLocation, String outputDir, String fileType) {
List<String> list = new ArrayList<String>();
ZipFile zipFile = readZipFile(zipFileLocation);
FileOutputStream output = null;
InputStream inputStream = null;
Enumeration... | public static File gzipLog() throws IOException {
RunnerClass.nfh.flush();
File log = new File(RunnerClass.homedir + "pj.log");
GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(new File(log.getCanonicalPath() + ".pjl")));
FileInputStream in = new FileInputStream(log);... | true |
898,569 | 20,239,268 | 8,766,831 | public static File[] splitFile(FileValidator validator, File source, long target_length, File todir, String prefix) {
if (target_length == 0) return null;
if (todir == null) {
todir = new File(System.getProperty("java.io.tmpdir"));
}
if (prefix == null || prefix.equals(""... | public static byte[] loadFile(File file) throws IOException {
BufferedInputStream in = null;
ByteArrayOutputStream sink = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
sink = new ByteArrayOutputStream();
IOUtils.copy(in, sink);
... | true |
898,570 | 11,034,629 | 20,407,275 | private List _getWeathersFromYahoo(String city) {
System.out.println("== get weather information of " + city + " from yahoo ==");
try {
URL url = new URL(URL + cities.get(city).toString());
InputStream input = url.openStream();
SAXParserFactory factory = SAXParser... | @NotNull
private Properties loadProperties() {
File file = new File(homeLocator.getHomeDir(), configFilename);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
throw new RuntimeException("IOException while creatin... | false |
898,571 | 5,652,649 | 202,102 | public static InputStream getInputStream(URL url) throws IOException {
if (url.getProtocol().equals("file")) {
String path = decode(url.getPath(), "UTF-8");
return new BufferedInputStream(new FileInputStream(path));
} else {
return new BufferedInputStream(url.open... | 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 |
898,572 | 11,929,030 | 5,946,267 | public T_Result unmarshall(URL url) throws SAXException, ParserConfigurationException, IOException {
XMLReader parser = getParserFactory().newSAXParser().getXMLReader();
parser.setContentHandler(getContentHandler());
parser.setDTDHandler(getContentHandler());
parser.setEntityResolver... | private static ISimpleChemObjectReader createReader(URL url, String urlString, String type) throws CDKException {
if (type == null) {
type = "mol";
}
ISimpleChemObjectReader cor = null;
cor = new MDLV2000Reader(getReader(url), Mode.RELAXED);
try {
Read... | false |
898,573 | 7,839,811 | 9,405,784 | public static String md5(String input) {
byte[] temp;
try {
MessageDigest messageDigest;
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(input.getBytes());
temp = messageDigest.digest();
} catch (Exception e) {
... | public void startImport(ActionEvent evt) {
final PsiExchange psiExchange = PsiExchangeFactory.createPsiExchange(IntactContext.getCurrentInstance().getSpringContext());
for (final URL url : urlsToImport) {
try {
if (log.isInfoEnabled()) log.info("Importing: " + url);
... | false |
898,574 | 23,247,146 | 21,529,921 | @Override
public synchronized HttpURLConnection getTileUrlConnection(int zoom, int tilex, int tiley) throws IOException {
HttpURLConnection conn = null;
try {
String url = getTileUrl(zoom, tilex, tiley);
conn = (HttpURLConnection) new URL(url).openConnection();
} ... | private void _scanForMetaData(URL _url) throws java.io.IOException {
if (DEBUG.Enabled) System.out.println(this + " _scanForMetaData: xml props " + mXMLpropertyList);
if (DEBUG.Enabled) System.out.println("*** Opening connection to " + _url);
markAccessAttempt();
Properties metaData ... | false |
898,575 | 7,682,647 | 7,015,918 | public static void copyFile(String oldPathFile, String newPathFile) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPathFile);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPathFile);
... | 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 |
898,576 | 3,667,136 | 2,807,114 | public void fileCopy2(File inFile, File outFile) throws Exception {
try {
FileChannel srcChannel = new FileInputStream(inFile).getChannel();
FileChannel dstChannel = new FileOutputStream(outFile).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
... | public Controller(String m_hostname, String team, boolean m_shouldexit) throws InternalException {
m_received_messages = new ConcurrentLinkedQueue<ReceivedMessage>();
m_fragmsgs = new ArrayList<String>();
m_customizedtaunts = new HashMap<Integer, String>();
m_nethandler = new Caching... | true |
898,577 | 9,552,054 | 4,643,706 | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | private static void zip(ZipOutputStream aOutputStream, final File[] aFiles, final String sArchive, final URI aRootURI, final String sFilter) throws FileError {
boolean closeStream = false;
if (aOutputStream == null) try {
aOutputStream = new ZipOutputStream(new FileOutputStream(sArchive)... | true |
898,578 | 7,606,314 | 4,591,684 | public synchronized void deleteDocument(final String file) throws IOException {
SQLException ex = null;
try {
PreparedStatement findFileStmt = con.prepareStatement("SELECT ID AS \"ID\" FROM File_ WHERE Name = ?");
findFileStmt.setString(1, file);
ResultSet rs = fi... | public static void copyDirs(File sourceDir, File destDir) throws IOException {
if (!destDir.exists()) destDir.mkdirs();
for (File file : sourceDir.listFiles()) {
if (file.isDirectory()) {
copyDirs(file, new File(destDir, file.getName()));
} else {
... | false |
898,579 | 4,579,205 | 814,473 | public static void copyFile(String source, String destination) throws IOException {
File srcDir = new File(source);
File[] files = srcDir.listFiles();
FileChannel in = null;
FileChannel out = null;
for (File file : files) {
try {
in = new FileInput... | 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 |
898,580 | 5,435,234 | 23,099,329 | public static String getURLContent(String urlStr) throws MalformedURLException, IOException {
URL url = new URL(urlStr);
log.info("url: " + url);
URLConnection conn = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
S... | @Override
public void close() throws IOException {
super.close();
byte[] signatureData = toByteArray();
ZipOutputStream zipOutputStream = new ZipOutputStream(this.targetOutputStream);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(this.originalZipFile));
... | false |
898,581 | 615,357 | 14,032,835 | public static void compressFile(File orig) throws IOException {
File file = new File(INPUT + orig.toString());
File target = new File(OUTPUT + orig.toString().replaceAll(".xml", ".xml.gz"));
System.out.println(" Compressing \"" + file.getName() + "\" into \"" + target + "\"");
lon... | private byte[] szyfrujKlucz(byte[] kluczSesyjny) {
byte[] zaszyfrowanyKlucz = null;
byte[] klucz = null;
try {
MessageDigest skrot = MessageDigest.getInstance("SHA-1");
skrot.update(haslo.getBytes());
byte[] skrotHasla = skrot.digest();
Object ... | false |
898,582 | 288,978 | 13,221,212 | 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... | public static void generate(final InputStream input, String format, Point dimension, IPath outputLocation) throws CoreException {
MultiStatus status = new MultiStatus(GraphVizActivator.ID, 0, "Errors occurred while running Graphviz", null);
File dotInput = null, dotOutput = outputLocation.toFile();
... | true |
898,583 | 22,538,273 | 22,821,011 | public void format(File source, File target) {
if (!source.exists()) {
throw new IllegalArgumentException("Source '" + source + " doesn't exist");
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source '" + source + " is not a file");
}
t... | 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 |
898,584 | 10,826,994 | 13,207,436 | public static void copyFile(File in, File out) throws EnhancedException {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), des... | public Object sendObjectRequestToSpecifiedServer(java.lang.String serverName, java.lang.String servletName, java.lang.Object request) {
Object reqxml = null;
org.jdom.Document retdoc = null;
String myurl = java.util.prefs.Preferences.systemRoot().get("serverurl", "");
String myport =... | false |
898,585 | 16,199,085 | 21,575,639 | @Override
public byte[] read(String path) throws PersistenceException {
path = fmtPath(path);
try {
S3Object fileObj = s3Service.getObject(bucketObj, path);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(fileObj.getDataInputStream(), out... | protected byte[] readGZippedBytes(TupleInput in) {
final boolean is_compressed = in.readBoolean();
byte array[] = readBytes(in);
if (array == null) return null;
if (!is_compressed) {
return array;
}
try {
ByteArrayInputStream bais = new ByteArr... | true |
898,586 | 11,358,360 | 16,602,362 | private boolean readRemoteFile() {
InputStream inputstream;
Concept concept = new Concept();
try {
inputstream = url.openStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(... | public static LinkedList Import(String url) throws Exception {
LinkedList data = new LinkedList();
BufferedReader in = new BufferedReader(new InputStreamReader((new URL(url)).openStream()));
String csvLine;
while ((csvLine = in.readLine()) != null) {
StringTokenizer st = ... | true |
898,587 | 6,908,540 | 16,870,490 | public void create_list() {
try {
String data = URLEncoder.encode("PHPSESSID", "UTF-8") + "=" + URLEncoder.encode(this.get_session(), "UTF-8");
URL url = new URL(URL_LOLA + FILE_CREATE_LIST);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
... | private List parseUrlGetUids(String url) throws FetchError {
List hids = new ArrayList();
try {
InputStream is = (new URL(url)).openStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
StringBuffer buffer = new StringBuffer();
S... | true |
898,588 | 21,277,519 | 22,568,530 | public static String getMD5(String s) throws Exception {
MessageDigest complete = MessageDigest.getInstance("MD5");
complete.update(s.getBytes());
byte[] b = complete.digest();
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[... | private InputStream callService(String text) {
InputStream in = null;
try {
URL url = new URL(SERVLET_URL);
URLConnection conn = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setRequestMethod("POST");
... | false |
898,589 | 566,820 | 8,344,458 | @Override
public void run() {
File file = new File(LogHandler.path);
FileFilter filter = new FileFilter() {
@Override
public boolean accept(File file) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(new Date());
... | public static void extractZipPackage(String fileName, String destinationFolder) throws Exception {
if (NullStatus.isNull(destinationFolder)) {
destinationFolder = "";
}
new File(destinationFolder).mkdirs();
File inputFile = new File(fileName);
ZipFile zipFile = ne... | true |
898,590 | 14,510,383 | 10,715,600 | @Override
public void copyFile2File(final File src, final File dest, final boolean force) throws C4JException {
if (dest.exists()) if (force && !dest.delete()) throw new C4JException(format("Copying ‘%s’ to ‘%s’ failed; cannot overwrite existing file.", src.getPath(), dest.getPath()));
FileChann... | public static synchronized String toMD5(String str) {
Nulls.failIfNull(str, "Cannot create an MD5 encryption form a NULL string");
String hashword = null;
try {
MessageDigest md5 = MessageDigest.getInstance(MD5);
md5.update(str.getBytes());
BigInteger hash... | false |
898,591 | 4,798,331 | 1,526,593 | public static String SHA256(String source) {
logger.info(source);
String result = null;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.update(source.getBytes());
byte[] bytes = digest.digest();
result = EncodeUtils.he... | protected Control createContents(Composite parent) {
this.getShell().setText("Chisio");
this.getShell().setSize(800, 600);
this.getShell().setImage(ImageDescriptor.createFromFile(ChisioMain.class, "icon/chisio-icon.png").createImage());
Composite composite = new Composite(parent, SWT... | false |
898,592 | 21,515,430 | 16,338,011 | protected synchronized void doLogin(long timeout, String eventMask) throws IOException, AuthenticationFailedException, TimeoutException {
ChallengeAction challengeAction;
ManagerResponse challengeResponse;
String challenge;
String key;
LoginAction loginAction;
Manager... | protected byte[] getHashedID(String ID) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(ID.getBytes());
byte[] digest = md5.digest();
byte[] bytes = new byte[WLDB_ID_SIZE];
for (int i = 0; i < bytes... | true |
898,593 | 18,070,589 | 19,478,367 | @Test
public void testWriteAndReadSecondLevel() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | public void init(String[] arguments) {
if (arguments.length < 1) {
printHelp();
return;
}
String[] valid_args = new String[] { "device*", "d*", "help", "h", "speed#", "s#", "file*", "f*", "gpsd*", "nmea", "n", "garmin", "g", "sirf", "i", "rawdata", "downloadtracks", "... | true |
898,594 | 19,794,025 | 254,725 | public static int numberofLines(JApplet ja, String filename) {
int count = 0;
URL url = null;
String FileToRead;
FileToRead = "data/" + filename + ".csv";
try {
url = new URL(ja.getCodeBase(), FileToRead);
} catch (MalformedURLException e) {
Sy... | 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 |
898,595 | 23,611,768 | 9,304,937 | private static void reconfigureDebug() {
useFile = false;
logValue = 0;
String methodString = NodeUtil.walkNodeTree(Server.getConfig(), "//configuration/object[@type='engine.debug']/property[@type='engine.method']/@value");
String levelString = NodeUtil.walkNodeTree(Server.getConfig(... | public static String encrypt(String passPhrase, String password) {
String algorithm = "PBEWithMD5AndDES";
byte[] salt = new byte[8];
int iterations = 20;
byte[] output = new byte[128];
if (passPhrase == null || "".equals(passPhrase) || password == null || "".equals(password))... | false |
898,596 | 1,138,276 | 15,376,881 | private void login() throws LoginException {
log.info("# iモード.netにログイン");
try {
this.httpClient.getCookieStore().clear();
HttpPost post = new HttpPost(LoginUrl);
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicN... | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream inStream = null;
FileOutputStream outStream = null;
FileChannel source = null;
FileChannel de... | false |
898,597 | 1,477,955 | 6,190,163 | 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(... | public void xtest7() throws Exception {
System.out.println("Lowagie");
FileInputStream inputStream = new FileInputStream("C:/Temp/arquivo.pdf");
PDFBoxManager manager = new PDFBoxManager();
InputStream[] images = manager.toImage(inputStream, "jpeg");
int count = 0;
fo... | true |
898,598 | 18,488,106 | 19,582,152 | public static Document validateXml(File messageFile, URL inputUrl, String[] catalogs) throws IOException, ParserConfigurationException, Exception, SAXException, FileNotFoundException {
InputSource source = new InputSource(inputUrl.openStream());
Document logDoc = DomUtil.getNewDom();
XMLRead... | private void copyFile(File source, File target) throws IOException {
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(target).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
... | true |
898,599 | 5,869,954 | 6,128,274 | public static void copyFile(File sourceFile, File targetFile) throws IOException {
FileInputStream iStream = new FileInputStream(sourceFile);
FileOutputStream oStream = new FileOutputStream(targetFile);
FileChannel inChannel = iStream.getChannel();
FileChannel outChannel = oStream.ge... | private void compress(File target, Set<File> files) throws CacheOperationException, ConfigurationException {
ZipOutputStream zipOutput = null;
try {
zipOutput = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(target)));
for (File file : files) {
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.