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 |
|---|---|---|---|---|---|
200 | 8,988,204 | 11,738,613 | @Override
public void onLoadingEnded() {
if (m_frame != null) {
try {
String urltext = getDocument().getDocumentURI();
URL url = new URL(urltext);
InputStreamReader isr = new InputStreamReader(url.openStream());
BufferedReader i... | public String move(Integer param) {
LOG.debug("move " + param);
StringBuffer ret = new StringBuffer();
try {
URL url = new URL("http://" + host + "/decoder_control.cgi?command=" + param + "&user=" + user + "&pwd=" + password);
URLConnection con = url.openConnection();... | false |
201 | 11,550,398 | 3,945,916 | private void loadDefaultDrivers() {
final URL url = _app.getResources().getDefaultDriversUrl();
try {
InputStreamReader isr = new InputStreamReader(url.openStream());
try {
_cache.load(isr);
} finally {
isr.close();
}
... | public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash;
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return conve... | false |
202 | 10,252,057 | 18,862,611 | public void deletePortletName(PortletName portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (portletNameBean.getPortletId() == null) throw new IllegalArgumentException("portletNameId is null")... | public TestReport runImpl() throws Exception {
DocumentFactory df = new SAXDocumentFactory(GenericDOMImplementation.getDOMImplementation(), parserClassName);
File f = (new File(testFileName));
URL url = f.toURL();
Document doc = df.createDocument(null, rootTag, url.toString(), url.op... | false |
203 | 553,082 | 11,622,990 | 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 ContourGenerator(URL url, float modelMean, float modelStddev) throws IOException {
this.modelMean = modelMean;
this.modelStddev = modelStddev;
List termsList = new ArrayList();
String line;
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream... | true |
204 | 7,823,489 | 7,169,017 | 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 download(String fileName, HttpServletResponse response) throws IOException {
TelnetInputStream ftpIn = ftpClient_sun.get(fileName);
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
OutputStream out = null;
try {
... | false |
205 | 2,965,996 | 22,434,268 | public static void main(String[] args) {
if (args.length != 2) {
System.out.println("Usage: HashCalculator <Algorithm> <Input>");
System.out.println("The preferred algorithm is SHA.");
} else {
MessageDigest md;
try {
md = MessageDigest... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
sour... | false |
206 | 7,062,953 | 14,847,921 | public JarClassLoader(ClassLoader parent) {
super(parent);
initLogger();
hmClass = new HashMap<String, Class<?>>();
lstJarFile = new ArrayList<JarFileInfo>();
hsDeleteOnExit = new HashSet<File>();
String sUrlTopJar = null;
pd = getClass().getProtectionDomain()... | 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 |
207 | 146,579 | 14,409,851 | 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 test() throws Exception {
File temp = File.createTempFile("test", ".test");
temp.deleteOnExit();
StorageFile s = new StorageFile(temp, "UTF-8");
s.addText("Test");
s.getOutputStream().write("ing is important".getBytes("UTF-8"));
s.getWriter().write(" but o... | true |
208 | 18,293,811 | 2,057,786 | private static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("�������� ���� �� ���������" + from_file);
if (!from_file.isFile()) abort("���������� ����������� ���... | public static String sendGetRequest(String urlStr) {
String result = null;
try {
URL url = new URL(urlStr);
System.out.println(urlStr);
URLConnection conn = url.openConnection();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInpu... | false |
209 | 5,066,508 | 2,232,617 | public ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException {
if (key == null || fields == null) throw new VetoException("MD5Filter not configured");
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getKey());
int[] f ... | public void testStorageString() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
r.addText("This is an example");
r.addText(" and another one.");
assertEquals("This is an example and another one.", r.getText());
InputStream in... | false |
210 | 13,026,685 | 831,650 | public DoSearch(String searchType, String searchString) {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerDoSearch";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "search.xml";
try {
String urldata = urlString + "?user... | 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 |
211 | 21,898,978 | 23,338,807 | public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
if (text == null || text.length() < 1) {
return null;
}
MessageDigest md = MessageDigest.getInstance(TYPE_SHA);
md.update(text.getBytes(ENCODE), 0, text.length());
... | @TestTargetNew(level = TestLevel.COMPLETE, notes = "Test fails: IOException expected but IllegalStateException is thrown: ticket 128", method = "getInputStream", args = { })
public void test_getInputStream_DeleteJarFileUsingURLConnection() throws Exception {
String jarFileName = "";
String entr... | false |
212 | 880,670 | 19,262,311 | public static void main(String args[]) {
int i, j, l;
short NUMNUMBERS = 256;
short numbers[] = new short[NUMNUMBERS];
Darjeeling.print("START");
for (l = 0; l < 100; l++) {
for (i = 0; i < NUMNUMBERS; i++) numbers[i] = (short) (NUMNUMBERS - 1 - i);
fo... | public static String encrypt(String key) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md5.update(key.getBytes());
byte hash[] = md5.digest();
Str... | false |
213 | 12,776,677 | 17,477,951 | private void checkLogin(String email, String password) throws JspTagException {
String cryptedPassword;
try {
MessageDigest crypt = MessageDigest.getInstance("MD5");
crypt.update(password.getBytes());
byte digest[] = crypt.digest();
StringBuffer hexStr... | public static void copy(String inputFile, String outputFile) throws Exception {
try {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | false |
214 | 16,199,085 | 2,883,828 | @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... | 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... | true |
215 | 1,156,882 | 5,450,104 | @Override
public void onClick(View v) {
Log.d(Config.SS_TAG, "Sending POST request to server...");
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(Config.RPC_SERVLET_URL);
JSONObject requestJ... | private static void grab(String urlString) throws MalformedURLException, IOException {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = null;
StringBuffer sb = new StringBuffer();
in =... | true |
216 | 6,190,167 | 19,746,603 | public void xtest11() throws Exception {
PDFManager manager = new ITextManager();
InputStream pdf = new FileInputStream("/tmp/UML2.pdf");
InputStream page1 = manager.cut(pdf, 1, 1);
OutputStream outputStream = new FileOutputStream("/tmp/page.pdf");
IOUtils.copy(page1, outputS... | private synchronized Frame addFrame(INSERT_TYPE type, File source) throws IOException {
if (source == null) throw new NullPointerException("Parameter 'source' is null");
if (!source.exists()) throw new IOException("File does not exist: " + source.getAbsolutePath());
if (source.length() <= 0)... | true |
217 | 9,118,411 | 13,325,917 | public void postProcess() throws StopWriterVisitorException {
shpWriter.postProcess();
try {
FileChannel fcinShp = new FileInputStream(fTemp).getChannel();
FileChannel fcoutShp = new FileOutputStream(fileShp).getChannel();
DriverUtilities.copy(fcinShp, fcoutShp);
... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getCanonicalPath());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getCanonicalP... | true |
218 | 20,955,453 | 19,538,929 | @Override
public void alterar(QuestaoMultiplaEscolha q) throws Exception {
PreparedStatement stmt = null;
String sql = "UPDATE questao SET id_disciplina=?, enunciado=?, grau_dificuldade=? WHERE id_questao=?";
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt... | public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) {
File inputFile = new File(getInputFile());
File outputFile = new File(getOutputFile());
if (!getFileExtension(getInputFile()).equalsIgnoreCase(getFileExtension(getOutputFile())) || !getFileExtension(getInputFile())... | false |
219 | 3,357,695 | 20,661,433 | public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException, CatalogException {
URL url = null;
try {
url = new URL(fileUrl);
} catch (MalformedURLException e) {
url = new URL("file:///" + fileUrl);
}
debug = cata... | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | false |
220 | 7,760,801 | 3,585,152 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void copy(FileInputStream from, FileOutputStream to) throws IOException {
FileChannel fromChannel = from.getChannel();
FileChannel toChannel = to.getChannel();
copy(fromChannel, toChannel);
fromChannel.close();
toChannel.close();
}
| true |
221 | 22,538,273 | 420,619 | 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 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 |
222 | 12,706,520 | 14,249,320 | private FTPClient connect() throws IOException {
FTPClient client = null;
Configuration conf = getConf();
String host = conf.get("fs.ftp.host");
int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
String user = conf.get("fs.ftp.user." + host);
String passwor... | @SuppressWarnings("unchecked")
public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
String url;
boolean url_valid = true;
URI url_uri = getConfiguration().getUri();
url = url_uri.toString();
URLConnection urlConn_test;
try {
... | false |
223 | 13,075,309 | 12,469,139 | public static void loginBayFiles() throws Exception {
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 DefaultHttpClient(params);
... | public Program createNewProgram(int projectID, String name, String description) throws AdaptationException {
Program program = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
connection = DriverManager.getConnectio... | false |
224 | 20,180,801 | 14,702,119 | public static byte[] readUrl(URL url) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream is = url.openStream();
try {
IOUtils.copy(is, os);
return os.toByteArray();
} finally {
is.close();
}
}
| public static void copyFile(String fileName, String dstPath) throws IOException {
FileChannel sourceChannel = new FileInputStream(fileName).getChannel();
FileChannel destinationChannel = new FileOutputStream(dstPath).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destination... | true |
225 | 529,986 | 7,162,385 | void bsort(int a[], int lo, int hi) throws Exception {
for (int j = hi; j > lo; j--) {
for (int i = lo; i < j; i++) {
if (a[i] > a[i + 1]) {
int T = a[i];
a[i] = a[i + 1];
a[i + 1] = T;
pause();
... | @Override
public boolean postPage() {
MySpaceBlogExporterGuiApp.getApplication().getWizContainer().showStatus(myResourceMap.getString("CheckingBlogUrl.text"));
URL url;
try {
url = new URL(txtBlogUrl.getText());
URLConnection con = url.openConnection();
... | false |
226 | 21,456,509 | 7,990,229 | private HashMap<String, GCVote> getVotes(ArrayList<String> waypoints, boolean blnSleepBeforeDownload) {
if (blnSleepBeforeDownload) {
try {
Thread.sleep(PACKET_SLEEP_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
}... | public static InputStream gunzip(final InputStream inputStream) throws IOException {
Assert.notNull(inputStream, "inputStream");
GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
InputOutputStream inputOutputStream = new InputOutputStream();
IOUtils.copy(gzipInputSt... | false |
227 | 14,928,023 | 2,126,181 | public String hash(String text) {
try {
MessageDigest md = MessageDigest.getInstance(hashFunction);
md.update(text.getBytes(charset));
byte[] raw = md.digest();
return new String(encodeHex(raw));
} catch (Exception e) {
throw new RuntimeExc... | public void test_digest() throws UnsupportedEncodingException {
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA");
assertNotNull(sha);
} catch (NoSuchAlgorithmException e) {
fail("getInstance did not find algorithm");
}
... | true |
228 | 10,382,288 | 531,434 | public static void checkForUpdate(String version) {
try {
URL url = new URL(WiimoteWhiteboard.getProperty("updateURL"));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
final String current = in.readLine();
if (compare(version,... | private void setup() {
env = new EnvAdvanced();
try {
URL url = Sysutil.getURL("world.env");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
String[]... | false |
229 | 743,716 | 9,540,845 | String fetch_pls(String pls) {
InputStream pstream = null;
if (pls.startsWith("http://")) {
try {
URL url = null;
if (running_as_applet) url = new URL(getCodeBase(), pls); else url = new URL(pls);
URLConnection urlc = url.openConnection();
... | static void copy(String scr, String dest) throws IOException {
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(scr);
out = new FileOutputStream(dest);
byte[] buf = new byte[1024];
int n;
while ((n = in... | false |
230 | 413,620 | 3,672,328 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | public static void copy(String sourceFile, String targetFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel();
FileChannel targetChannel = new FileOutputStream(targetFile).getChannel();
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.s... | true |
231 | 23,564,275 | 20,870,396 | public static void main(String[] args) {
Option optHelp = new Option("h", "help", false, "print this message");
Option optCerts = new Option("c", "cert", true, "use external semicolon separated X.509 certificate files");
optCerts.setArgName("certificates");
Option optPasswd = new Opt... | private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExce... | true |
232 | 19,180,786 | 5,985,718 | public void testCopyFolderContents() throws IOException {
log.info("Running: testCopyFolderContents()");
IOUtils.copyFolderContents(srcFolderName, destFolderName);
Assert.assertTrue(destFile1.exists() && destFile1.isFile());
Assert.assertTrue(destFile2.exists() && destFile2.isFile())... | private String fetchLocalPage(String page) throws IOException {
final String fullUrl = HOST + page;
LOG.debug("Fetching local page: " + fullUrl);
URL url = new URL(fullUrl);
URLConnection connection = url.openConnection();
StringBuilder sb = new StringBuilder();
Buffe... | false |
233 | 3,962,795 | 3,259,164 | public static String Sha1(String s) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] hash = new byte[40];
md.update(s.getBytes("iso-8859-1"), 0, s.length());
hash = md.digest();
return toHex(hash);
} catch (Exception e)... | public static String getMd5(String str) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
final byte b[] = md.digest();
int i;
final StringBuffer buf = new StringBuffer("");
for (int offset = ... | true |
234 | 608,747 | 8,766,831 | 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 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 |
235 | 19,579,830 | 13,683,865 | 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 {
... | public URL getResource(String path) throws MalformedURLException {
if (!path.startsWith("/")) throw new MalformedURLException("Path '" + path + "' does not start with '/'");
URL url = new URL(myResourceBaseURL, path.substring(1));
InputStream is = null;
try {
is = url.ope... | false |
236 | 17,385,831 | 16,579,945 | 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 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 |
237 | 20,603,864 | 8,711,848 | public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | public boolean urlToSpeech(String urlPath) {
boolean ok = false;
try {
URL url = new URL(urlPath);
InputStream is = url.openStream();
ok = streamToSpeech(is);
} catch (IOException ioe) {
System.err.println("Can't read data from " + urlPath);
... | false |
238 | 22,942,858 | 23,647,361 | 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 static void main(String[] args) {
String url = "jdbc:mysql://localhost/test";
String user = "root";
String password = "password";
String imageLocation = "C:\\Documents and Settings\\EddyM\\Desktop\\Nick\\01100002.tif";
String imageLocation2 = "C:\\Documents and Setting... | false |
239 | 4,392,337 | 14,658,498 | @Override
public void execute(Client client, TaskProperties properties, TaskLog taskLog) throws SearchLibException {
String url = properties.getValue(propUrl);
URI uri;
try {
uri = new URI(url);
} catch (URISyntaxException e) {
throw new SearchLibException... | private Properties loadPropertiesFromURL(String propertiesURL, Properties defaultProperties) {
Properties properties = new Properties(defaultProperties);
URL url;
try {
url = new URL(propertiesURL);
URLConnection urlConnection = url.openConnection();
prope... | false |
240 | 15,364,153 | 12,853,333 | private void storeConfigurationPropertiesFile(java.net.URL url, String comp) {
java.util.Properties p;
try {
p = new java.util.Properties();
p.load(url.openStream());
} catch (java.io.IOException ie) {
System.err.println("error opening: " + url.getPath() +... | public static String getURLContent(String href) throws BuildException {
URL url = null;
String content;
try {
URL context = new URL("file:" + System.getProperty("user.dir") + "/");
url = new URL(context, href);
InputStream is = url.openStream();
... | false |
241 | 23,400,223 | 7,606,314 | public void update(Channel channel) throws Exception {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String exp = channel.getExtendParent();
String path = channel.getPath();
try {
... | 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... | true |
242 | 19,825,038 | 3,767,763 | public static byte[] post(String path, Map<String, String> params, String encode) throws Exception {
StringBuilder parambuilder = new StringBuilder("");
if (params != null && !params.isEmpty()) {
for (Map.Entry<String, String> entry : params.entrySet()) {
parambuilder.app... | @Override
public long insertStatement(String sql) {
Statement statement = null;
try {
statement = getConnection().createStatement();
long result = statement.executeUpdate(sql.toString());
if (result == 0) log.warn(sql + " result row count is 0");
g... | false |
243 | 21,825,462 | 13,222,049 | public static void convert(URL url, PrintWriter writer, String server) {
try {
XPathFactory xpf = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
XPath xpe = xpf.newXPath();
InputStream is = null;
try {
is = url.openStream();
... | public void testAutoCommit() throws Exception {
Connection con = getConnectionOverrideProperties(new Properties());
try {
Statement stmt = con.createStatement();
assertEquals(0, stmt.executeUpdate("create table #testAutoCommit (i int)"));
con.setAutoCommit(false);... | false |
244 | 5,553,144 | 1,118,153 | private void initStreams() throws IOException {
if (audio != null) {
audio.close();
}
if (url != null) {
audio = new OggInputStream(url.openStream());
} else {
audio = new OggInputStream(ResourceLoader.getResourceAsStream(ref));
}
}
| public final synchronized boolean isValidLicenseFile() throws LicenseNotSetupException {
if (!isSetup()) {
throw new LicenseNotSetupException();
}
boolean returnValue = false;
Properties properties = getLicenseFile();
logger.debug("isValidLicenseFile: License to v... | false |
245 | 2,232,618 | 18,563,163 | public void testStorageByteArray() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
{
OutputStream output = r.getOutputStream();
output.write("This is an example".getBytes("UTF-8"));
output.write(" and another one.... | private void dumpFile(File repository, File copy) {
try {
if (copy.exists() && !copy.delete()) {
throw new RuntimeException("can't delete copy: " + copy);
}
printFile("Real Archive File", repository);
new ZipArchive(repository.getPath());
... | true |
246 | 1,888,878 | 8,639,730 | 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 ... | public static String md5encrypt(String toEncrypt) {
if (toEncrypt == null) {
throw new IllegalArgumentException("null is not a valid password to encrypt");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(toEncrypt.getBytes());
... | false |
247 | 14,227,643 | 9,501,298 | public String hmacSHA256(String message, byte[] key) {
MessageDigest sha256 = null;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new java.lang.AssertionError(this.getClass().getName() + ".hmacSHA256(): SHA-256 algor... | public InputStream getDaoConfig(String connectionType) throws IOException {
URL url = null;
if (connectionType.equals(SQL.ORACLE)) {
url = DBCreateConfig.class.getResource("oracle.xml");
} else if (connectionType.equals(SQL.SQL2K)) {
url = DBCreateConfig.class.getReso... | false |
248 | 23,564,275 | 11,268,952 | public static void main(String[] args) {
Option optHelp = new Option("h", "help", false, "print this message");
Option optCerts = new Option("c", "cert", true, "use external semicolon separated X.509 certificate files");
optCerts.setArgName("certificates");
Option optPasswd = new Opt... | public Vector split() {
File nextFile = new File(filename);
long fileSize = nextFile.length();
long parts = fileSize / splitSize;
Vector vec = new Vector(new Long(parts).intValue());
if (debug) {
System.out.println("File: " + nextFile.getName() + "\nfileSize: " + ... | true |
249 | 13,435,154 | 13,438,576 | static byte[] getSystemEntropy() {
byte[] ba;
final MessageDigest md;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException nsae) {
throw new InternalError("internal error: SHA-1 not available.");
}
byte b = (byte) Syst... | public void onMessage(Message message) {
try {
ExchangeImpl ex = new ExchangeImpl();
ex.setInMessage(message);
Conduit backChannel = message.getDestination().getBackChannel(message, null, null);
MessageImpl res =... | false |
250 | 14,408,302 | 7,169,018 | public static void copyFile(File source, File destination) throws IOException {
if (!source.isFile()) {
throw new IOException(source + " is not a file.");
}
if (destination.exists()) {
throw new IOException("Destination file " + destination + " is already exist.");
... | 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 |
251 | 11,507,466 | 4,452,454 | public PollSetMessage(String username, String question, String title, String[] choices) {
this.username = username;
MessageDigest m = null;
try {
m = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
... | private InputStream getManifestAsResource() {
ClassLoader cl = getClass().getClassLoader();
try {
Enumeration manifests = cl != null ? cl.getResources(Constants.OSGI_BUNDLE_MANIFEST) : ClassLoader.getSystemResources(Constants.OSGI_BUNDLE_MANIFEST);
while (manifests.hasMoreEle... | false |
252 | 14,577,922 | 20,849,254 | public TwilioRestResponse request(String path, String method, Map<String, String> vars) throws TwilioRestException {
String encoded = "";
if (vars != null) {
for (String key : vars.keySet()) {
try {
encoded += "&" + key + "=" + URLEncoder.encode(vars.g... | public static AudioInputStream getWavFromURL(String urlstr) {
URL url;
AudioInputStream ais = null;
try {
url = new URL(urlstr);
URLConnection c = url.openConnection();
c.connect();
InputStream stream = c.getInputStream();
ais = new... | false |
253 | 638,963 | 23,066,956 | 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 final void copyFile(File source, File destination) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel targetChannel = new FileOutputStream(destination).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChan... | true |
254 | 8,250,358 | 8,121,403 | private static InputStream connect(String url) throws IOException {
int status = 0;
String currentlyActiveServer = getCurrentlyActiveServer();
try {
long begin = System.currentTimeMillis();
HttpURLConnection httpConnection = (HttpURLConnection) new URL(currentlyActive... | public static void copyAssetFile(Context ctx, String srcFileName, String targetFilePath) {
AssetManager assetManager = ctx.getAssets();
try {
InputStream is = assetManager.open(srcFileName);
File out = new File(targetFilePath);
if (!out.exists()) {
... | false |
255 | 21,322,699 | 1,045,723 | public void zipUp() throws PersistenceException {
ZipOutputStream out = null;
try {
if (!backup.exists()) backup.createNewFile();
out = new ZipOutputStream(new FileOutputStream(backup));
out.setLevel(Deflater.DEFAULT_COMPRESSION);
for (String file : ba... | @Override
public void handlePeerEvent(PeerEvent event) {
if (event.geteventInfo() instanceof EventServiceInfo) {
EventServiceInfo info = (EventServiceInfo) event.geteventInfo();
if (info.getServiceState() != ServiceState.Deployed) return;
long bid = info.getBundleId()... | false |
256 | 11,070,888 | 941,896 | 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 |
257 | 20,661,433 | 19,299,263 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | 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 |
258 | 6,983,973 | 19,875,183 | 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 void copy(File inputFile, File outputFile) {
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), "UTF-8"));
writer = new BufferedWriter(new OutputStreamWriter(new F... | false |
259 | 7,542,014 | 151,947 | public static String[] parsePLS(String strURL, Context c) {
URL url;
URLConnection urlConn = null;
String TAG = "parsePLS";
Vector<String> radio = new Vector<String>();
final String filetoken = "file";
final String SPLITTER = "=";
try {
url = new U... | public static void test(String args[]) {
int trace;
int bytes_read = 0;
int last_contentLenght = 0;
try {
BufferedReader reader;
URL url;
url = new URL(args[0]);
URLConnection istream = url.openConnection();
last_contentLeng... | true |
260 | 1,126,225 | 15,896,100 | @SuppressWarnings("null")
public static void copyFile(File src, File dst) throws IOException {
if (!dst.getParentFile().exists()) {
dst.getParentFile().mkdirs();
}
dst.createNewFile();
FileChannel srcC = null;
FileChannel dstC = null;
try {
... | 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... | false |
261 | 10,228,411 | 11,145,818 | public File createReadmeFile(File dir, MavenProject mavenProject) throws IOException {
InputStream is = getClass().getResourceAsStream("README.template");
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw);
String content = sw.getBuffer().toString();
content = StringU... | 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... | true |
262 | 775,447 | 14,729,262 | void copyFile(String src, String dest) throws IOException {
int amount;
byte[] buffer = new byte[4096];
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
while ((amount = in.read(buffer)) != -1) out.write(buffer, 0, amount);
... | private static void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException {
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
return;
}
File outputFile = new File(outputDir, entry.getName());
if (!outputFile.g... | true |
263 | 7,682,331 | 12,798,072 | @org.junit.Test
public void testReadWrite() throws Exception {
final String reference = "testString";
final Reader reader = new StringReader(reference);
final StringWriter osString = new StringWriter();
final Reader teeStream = new TeeReaderWriter(reader, osString);
IOUti... | public static String encrypt(String txt) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(txt.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
| false |
264 | 6,085,964 | 8,117,216 | private static String readStreamToString(InputStream is, boolean passInVelocity, String tplName, Map<String, Object> templateVarsMap) throws IOException {
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
if (passInVelocity) {
return tpl.formatStr(sw.toString()... | private void copyLocalFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel()... | true |
265 | 18,519,248 | 19,204,595 | public String fetchContent(PathObject file) throws NetworkException {
if (file.isFetched()) {
return file.getContent();
}
if (!"f".equals(file.getType())) {
return null;
}
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(... | protected InputStream callApiMethod(String apiUrl, int expected) {
try {
URL url = new URL(apiUrl);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
for (String headerName : requestHeaders.keySet()) {
request.setRequestProperty(headerN... | false |
266 | 11,238,287 | 19,943,671 | public static void main(final String[] args) throws RecognitionException, TokenStreamException, IOException, IllegalOptionValueException, UnknownOptionException {
try {
CmdLineParser cmdLineParser = new CmdLineParser();
Option formatOption = cmdLineParser.addStringOption('f', "format... | public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException {
try {
URL url = new URL(uri.toString());
final URLConnection urlConnection = url.openConnection();
InputStream result = urlConnection.getInputStream();
Map<Object, Object> re... | false |
267 | 21,246,898 | 19,392,395 | public static void main(String[] args) throws ParseException, FileNotFoundException, IOException {
InputStream input = new BufferedInputStream(UpdateLanguages.class.getResourceAsStream("definition_template"));
Translator t = new Translator(input, "UTF8");
Node template = Translator.Start();
... | private 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 |
268 | 12,618,322 | 3,046,108 | @NotNull
public Set<Class<?>> in(Package pack) {
String packageName = pack.getName();
String packageOnly = pack.getName();
final boolean recursive = true;
Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
String packageDirName = packageOnly.replace('.', '/');
... | public GGPhotoInfo getPhotoInfo(String photoId, String language) throws IllegalStateException, GGException, Exception {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("method", "gg.photos.getInfo"));
qparams.add(new BasicNameValuePair("key", ... | false |
269 | 23,614,264 | 12,512,647 | private static void copyFile(File sourceFile, File destFile) throws IOException {
System.out.println(sourceFile.getAbsolutePath());
System.out.println(destFile.getAbsolutePath());
FileChannel source = new FileInputStream(sourceFile).getChannel();
try {
FileChannel destina... | @Override
public void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
String userAgentGroup = processUserAgent(request);
final LiwenxRequest lRequest = new LiwenxRequestImpl(request, response, messageSource, userAgentGroup);
Locator loc = router.route... | true |
270 | 1,708,100 | 7,066,835 | private void sendFile(File file, HttpExchange response) throws IOException {
response.getResponseHeaders().add(FileUploadBase.CONTENT_LENGTH, Long.toString(file.length()));
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
IOUtils.copy(inp... | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
List<Datastream> tDatastreams = new ArrayList<Datastream>();
LOG.debug("copying file");
String tZipTempFileName = super.getTempDir() + "uploaded-file.tmp";
IOUtils.copy(pD... | true |
271 | 566,820 | 13,741,605 | @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 boolean copy(String source, String dest) {
int bytes;
byte array[] = new byte[BUFFER_LEN];
try {
InputStream is = new FileInputStream(source);
OutputStream os = new FileOutputStream(dest);
while ((bytes = is.read(array, 0, BUFFER_LEN)) > 0) o... | true |
272 | 9,219,798 | 8,258,909 | public static void decryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.DECRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | public static void copyFile(File sourceFile, File destFile) {
FileChannel source = null;
FileChannel destination = null;
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
source = new FileInputStream(sourceFile).getChannel();
... | true |
273 | 16,954,340 | 982,287 | 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);
... | private void writeFile(FileInputStream inFile, FileOutputStream outFile) throws IOException {
byte[] buf = new byte[2048];
int read;
while ((read = inFile.read(buf)) > 0 && !stopped) outFile.write(buf, 0, read);
inFile.close();
}
| true |
274 | 8,121,415 | 14,885,369 | public static File writeInternalFile(Context cx, URL url, String dir, String filename) {
FileOutputStream fos = null;
File fi = null;
try {
fi = newInternalFile(cx, dir, filename);
fos = FileUtils.openOutputStream(fi);
int length = IOUtils.copy(url.openStr... | public File copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
copyChannel(inChannel, outChannel);
return out;
}
| true |
275 | 18,544,887 | 6,245,929 | public boolean add(String url) {
try {
HttpURLConnection request = (HttpURLConnection) new URL(url).openConnection();
request.setRequestMethod("POST");
request.setRequestProperty(GameRecord.GAME_IP_HEADER, String.valueOf(ip));
request.setRequestProperty(GameRe... | public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
URL url = new URL("http://pubsubhubbub.appspot.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
OutputStre... | false |
276 | 17,050,025 | 1,421,558 | private static String retrieveVersion(InputStream is) throws RepositoryException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
IOUtils.copy(is, buffer);
} catch (IOException e) {
throw new RepositoryException(exceptionLocalizer.format("device-rep... | 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 |
277 | 17,470,307 | 22,289,763 | private void createSoundbank(String testSoundbankFileName) throws Exception {
System.out.println("Create soundbank");
File packageDir = new File("testsoundbank");
if (packageDir.exists()) {
for (File file : packageDir.listFiles()) assertTrue(file.delete());
assertTrue... | InputStream openReader(String s) {
System.err.println("Fetcher: trying url " + s);
try {
URL url = new URL(s);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
return url.openStream();
} catch (IOException e) {
}
return nul... | false |
278 | 18,477,921 | 10,880,872 | public void callUpdate() {
LOGGER.debug("Checking for Updates");
new Thread() {
@Override
public void run() {
String lastVersion = null;
try {
URL projectSite = new URL("http://code.google.com/p/g15lastfm/");
... | @Override
public final boolean delete() throws RecordException {
if (frozen) {
throw new RecordException("The object is frozen.");
}
Connection conn = ConnectionManager.getConnection();
LoggableStatement pStat = null;
Class<? extends Record> actualClass = this... | false |
279 | 17,586,130 | 10,384,705 | 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 void reset(int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? ");
psta.setInt(1, currentPilot);
psta.executeUpdate();
jdbc.commit();
} catch (SQLException e) {
... | true |
280 | 16,503,138 | 2,530,139 | private byte[] hash(String toHash) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5", "BC");
md5.update(toHash.getBytes("ISO-8859-1"));
return md5.digest();
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
... | public static String md5(String input) {
String res = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] md5 = algorithm.digest();
String tmp = "";
... | true |
281 | 922,716 | 13,279,978 | private static String getDocumentAt(String urlString) {
StringBuffer html_text = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream... | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("DOWNLOAD - Send content: " + realFile.getAbsolutePath());
LOGGER.debug("Output stream: " + out.toString());
if (ServerConfiguration.isDynami... | false |
282 | 10,851 | 10,760,907 | 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 void send(org.hibernate.Session hsession, Session session, String repositoryName, Vector files, int label, String charset) throws FilesException {
ByteArrayInputStream bais = null;
FileOutputStream fos = null;
try {
if ((files == null) || (files.size() <= 0)) {
... | true |
283 | 15,920,882 | 1,296,795 | private void populateAPI(API api) {
try {
if (api.isPopulated()) {
log.traceln("Skipping API " + api.getName() + " (already populated)");
return;
}
api.setPopulated(true);
String sql = "update API set populated=1 where name=?";
... | static InputStream getUrlStream(String url) throws IOException {
System.out.print("getting : " + url + " ... ");
long start = System.currentTimeMillis();
URLConnection c = new URL(url).openConnection();
InputStream is = c.getInputStream();
System.out.print((System.currentTime... | false |
284 | 8,701,067 | 5,837,430 | public void markAsCachedHelper(Item item, Date from, Date to, Map<String, Boolean> properties) {
if (properties.size() == 0) {
return;
}
Connection conn = null;
Iterable<Integer> props = representer.getInternalReps(properties.keySet());
Integer hostIndex = represe... | public Configuration load(URL url) throws ConfigurationException {
LOG.info("Configuring from url : " + url.toString());
try {
return load(url.openStream(), url.toString());
} catch (IOException ioe) {
throw new ConfigurationException("Could not configure from URL : "... | false |
285 | 11,552,288 | 21,436,838 | public void run() {
Thread.currentThread().setName("zhongwen.com watcher");
String url = getURL();
try {
while (m_shouldBeRunning) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "ISO8859_1"))... | protected void writeToResponse(InputStream stream, HttpServletResponse response) throws IOException {
OutputStream output = response.getOutputStream();
try {
IOUtils.copy(stream, output);
} finally {
try {
stream.close();
} finally {
... | false |
286 | 9,819,955 | 813,588 | @Override
public void write(OutputStream output) throws IOException, WebApplicationException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final GZIPOutputStream gzipOs = new GZIPOutputStream(baos);
IOUtils.copy(is, gzipOs);
baos.close();
gzipOs.close(... | 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 |
287 | 13,521,323 | 17,729,553 | public static void copyFile(final String inFile, final String outFile) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(inFile).getChannel();
out = new FileOutputStream(outFile).getChannel();
in.transferTo(0, in.size(), out);... | public boolean clonarFichero(String rutaFicheroOrigen, String rutaFicheroDestino) {
System.out.println("");
System.out.println("*********** DENTRO DE 'clonarFichero' ***********");
boolean estado = false;
try {
FileInputStream entrada = new FileInputStream(rutaFicheroOrig... | true |
288 | 15,742,104 | 3,533,516 | @Test
public void testWriteAndRead() throws Exception {
JCFS.configureLoopback(dir);
RFile file = new RFile("testreadwrite.txt");
RFileOutputStream out = new RFileOutputStream(file);
out.write("test".getBytes("utf-8"));
out.close();
RFileInputStream in = new RFile... | public boolean saveLecturerecordingsXMLOnWebserver() {
boolean error = false;
FTPClient ftp = new FTPClient();
String lecture = "";
try {
URL url = new URL("http://localhost:8080/virtPresenterVerwalter/lecturerecordings.jsp?seminarid=" + this.getSeminarID());
... | false |
289 | 679,959 | 10,392,922 | 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 void copyCompletely(InputStream input, OutputStream output) throws IOException {
if ((output instanceof FileOutputStream) && (input instanceof FileInputStream)) {
try {
FileChannel target = ((FileOutputStream) output).getChannel();
FileChannel source... | true |
290 | 18,779,982 | 18,976,771 | private HashSet<String> href(String urlstr) throws IOException {
HashSet<String> hrefs = new HashSet<String>();
URL url = new URL(urlstr);
URLConnection con = url.openConnection();
con.setRequestProperty("Cookie", "_session_id=" + _session_id);
InputStreamReader r = new Input... | public void compressImage(InputStream input, OutputStream output, DjatokaEncodeParam params) throws DjatokaException {
if (params == null) params = new DjatokaEncodeParam();
File inputFile = null;
try {
inputFile = File.createTempFile("tmp", ".tif");
IOUtils.copyStrea... | true |
291 | 3,726,610 | 6,276,687 | private static void processFile(StreamDriver driver, String sourceName) throws Exception {
String destName = sourceName + ".xml";
File dest = new File(destName);
if (dest.exists()) {
throw new IllegalArgumentException("File '" + destName + "' already exists!");
}
... | public static void postData(Reader data, URL endpoint, Writer output) throws Exception {
HttpURLConnection urlc = null;
try {
urlc = (HttpURLConnection) endpoint.openConnection();
try {
urlc.setRequestMethod("POST");
} catch (ProtocolException e) {... | false |
292 | 22,243,603 | 16,005,062 | @Override
protected PermissionCollection getPermissions(CodeSource _codeSource) {
PermissionCollection perms = super.getPermissions(_codeSource);
URL url = _codeSource.getLocation();
Permission perm = null;
URLConnection urlConnection = null;
try {
urlConnecti... | private void addAuditDatastream() throws ObjectIntegrityException, StreamIOException {
if (m_obj.getAuditRecords().size() == 0) {
return;
}
String dsId = m_pid.toURI() + "/AUDIT";
String dsvId = dsId + "/" + DateUtility.convertDateToString(m_obj.getCreateDate());
... | false |
293 | 11,572,565 | 952,242 | public static final boolean copy(File source, File target, boolean overwrite) {
if (!overwrite && target.exists()) {
LOGGER.error("Target file exist and it not permitted to overwrite it !");
return false;
}
FileChannel in = null;
FileChannel out = null;
... | 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 |
294 | 12,915,753 | 23,035,538 | private String readDataFromUrl(URL url) throws IOException {
InputStream inputStream = null;
InputStreamReader streamReader = null;
BufferedReader in = null;
StringBuffer data = new StringBuffer();
try {
inputStream = url.openStream();
streamReader = n... | public static void main(String[] args) {
try {
String user = "techbeherca";
String targetUrl = "http://api.fanfou.com/statuses/user_timeline.xml?id=" + user;
URL url = new URL(targetUrl);
InputStream in = url.openStream();
ArrayList<MessageObj> lis... | false |
295 | 3,672,328 | 11,103,539 | public static void copy(String sourceFile, String targetFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel();
FileChannel targetChannel = new FileOutputStream(targetFile).getChannel();
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.s... | public void compressFile(String filePath) {
String outPut = filePath + ".zip";
try {
FileInputStream in = new FileInputStream(filePath);
GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(outPut));
byte[] buffer = new byte[4096];
int byte... | true |
296 | 23,677,116 | 10,778,361 | public static void copyFile3(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
byte[] buf = new byte[1024];
int len;
while((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close(... | public void writeData(String name, int items, int mznum, int mzscale, long tstart, long tdelta, int[] peaks) {
PrintWriter file = getWriter(name + ".txt");
file.println("999 9999");
file.println("Doe, John");
file.println("TEST Lab");
if (mzscale == 1) file.println("PALMS Pos... | true |
297 | 301,804 | 357,304 | static String fetchURLComposeExternPackageList(String urlpath, String pkglisturlpath) {
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (Malforme... | public static String get(String strUrl) {
try {
URL url = new URL(strUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(true);
conn.setAllowUserInter... | false |
298 | 14,317,426 | 592,597 | 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.... | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnRegister) {
Error.log(6002, "Bot�o cadastrar pressionado por " + login + ".");
if (nameUser.getText().compareTo("") == 0) {
JOptionPane.showMessageDialog(null, "... | false |
299 | 2,517,852 | 2,691,855 | public String contentType() {
if (_contentType != null) {
return (String) _contentType;
}
String uti = null;
URL url = url();
System.out.println("OKIOSIDManagedObject.contentType(): url = " + url + "\n");
if (url != null) {
String contentType =... | public static void extract(final File destDir, final ZipInfo zipInfo, final IProgressMonitor monitor) throws IOException {
if (!destDir.exists()) destDir.mkdirs();
for (String key : zipInfo.getEntryKeys()) {
ZipEntry entry = zipInfo.getEntry(key);
InputStream in = zipInfo.get... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.