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 |
|---|---|---|---|---|---|
4,500 | 7,713,594 | 17,217,414 | private static void copyFile(File source, File dest, boolean visibleFilesOnly) throws IOException {
if (visibleFilesOnly && isHiddenOrDotFile(source)) {
return;
}
if (dest.exists()) {
System.err.println("Destination File Already Exists: " + dest);
}
Fi... | 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 |
4,501 | 12,579 | 21,754,658 | @Override
public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException {
String url = request.getParameter(URL_PARAM_NAME);
if (StringUtils.isEmpty(url)) {
log.error("url parameter not provided.");
throw new DataSourceException(Re... | public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new ImageFilter());
fc.setAccessory(new ImagePreview(fc));
int returnVal = fc.showDialog(Administrac... | false |
4,502 | 6,961,579 | 1,896,089 | public void processAction(ActionMapping mapping, ActionForm form, PortletConfig config, ActionRequest req, ActionResponse res) throws Exception {
boolean editor = false;
req.setAttribute(ViewReportsAction.REPORT_EDITOR_OR_ADMIN, false);
User user = _getUser(req);
List<Role> roles = R... | public static void copyFileByNIO(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | true |
4,503 | 6,424,937 | 2,852,141 | public void writeTo(OutputStream out) throws IOException {
if (!closed) {
throw new IOException("Stream not closed");
}
if (isInMemory()) {
memoryOutputStream.writeTo(out);
} else {
FileInputStream fis = new FileInputStream(outputFile);
... | public static void copyFile(String input, String output) {
try {
File inputFile = new File(input);
File outputFile = new File(output);
FileReader in;
in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
... | true |
4,504 | 417,620 | 22,771,106 | 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... | private void triggerBuild(Properties props, String project, int rev) throws IOException {
boolean doBld = Boolean.parseBoolean(props.getProperty(project + ".bld"));
String url = props.getProperty(project + ".url");
if (!doBld || project == null || project.length() == 0) {
System.... | false |
4,505 | 3,253,205 | 15,774,654 | private String generateUniqueIdMD5(Run run, HttpServletRequest request, String groupIdString) {
String portalUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
String uniqueportalUrl = portalUrl + "run:" + run.getId().toString() + "group:" + groupIdString;
... | public static synchronized String getMD5_Base64(final String input) {
if (isInited == false) {
isInited = true;
try {
digest = MessageDigest.getInstance("MD5");
} catch (Exception ex) {
logger.error("Cannot get MessageDigest. Application ma... | true |
4,506 | 2,903,590 | 19,452,177 | public static void notify(String msg) throws Exception {
String url = "http://api.clickatell.com/http/sendmsg?";
url = add(url, "user", user);
url = add(url, "password", password);
url = add(url, "api_id", apiId);
url = add(url, "to", to);
url = add(url, "text", msg);... | public static File createTempFile(InputStream contentStream, String ext) throws IOException {
ExceptionUtils.throwIfNull(contentStream, "contentStream");
File file = File.createTempFile("test", ext);
FileOutputStream fos = new FileOutputStream(file);
try {
IOUtils.copy(co... | true |
4,507 | 2,446,253 | 7,088,306 | private int renumberOrderBy(long tableID) throws SnapInException {
int count = 0;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = getDataSource().getConnection();
con.setAutoCommit(false);
stmt = con.createSta... | private void modifyEntry(ModifyInterceptorChain chain, DistinguishedName dn, ArrayList<LDAPModification> mods, Connection con) throws LDAPException {
try {
con.setAutoCommit(false);
HashMap<String, String> ldap2db = (HashMap<String, String>) chain.getRequest().get(JdbcInsert.MYVD_DB_... | true |
4,508 | 6,641,464 | 15,353,022 | private void SaveLoginInfo() {
int iSize;
try {
if (m_bSavePwd) {
byte[] MD5PWD = new byte[80];
java.security.MessageDigest md = java.security.MessageDigest.getInstance("SHA-1");
String szPath = System.getProperty("user.home");
... | private String calculateHash(String s) {
if (s == null) {
return null;
}
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
logger.error("Could not find a message dige... | true |
4,509 | 4,577,358 | 22,019,481 | private static boolean isXmlApplicationFile(URL url) throws java.io.IOException {
if (DEBUG) {
System.out.println("Checking whether file is xml");
}
String firstLine;
BufferedReader fileReader = null;
try {
fileReader = new BomStrippingInputStreamReade... | private static boolean copyFile(File srcFile, File tagFile) throws IOException {
if (srcFile == null || tagFile == null) {
return false;
}
int length = 2097152;
FileInputStream in = new FileInputStream(srcFile);
FileOutputStream out = new FileOutputStream(tagFile)... | false |
4,510 | 10,252,057 | 10,337,386 | 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")... | protected void zipFile(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(to));
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = in.read(buffer)) != -1) ou... | false |
4,511 | 20,881,388 | 11,418,746 | public static String md5(String str) {
if (str == null) {
System.err.println("Stringx.md5 (String) : null string.");
return "";
}
String rt = "";
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(str.getBytes("gb231... | 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 |
4,512 | 17,585,729 | 16,499,420 | 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 void saveFile(InputStream in, String fullPath) {
try {
File sysfile = new File(fullPath);
if (!sysfile.exists()) {
sysfile.createNewFile();
}
java.io.OutputStream out = new FileOutputStream(sysfile);
org.apache.commons.io.IO... | false |
4,513 | 12,222,321 | 18,465,677 | public static long copyFile(File source, File target) throws IOException {
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = new FileInputStream(source);
fileOutputStream = new FileOutputStream(target);
... | public void download(RequestContext ctx) throws IOException {
if (ctx.isRobot()) {
ctx.forbidden();
return;
}
long id = ctx.id();
File bean = File.INSTANCE.Get(id);
if (bean == null) {
ctx.not_found();
return;
}
... | true |
4,514 | 17,477,951 | 8,680,491 | 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();
... | public static final boolean compressToZip(final String sSource, final String sDest, final boolean bDeleteSourceOnSuccess) {
ZipOutputStream os = null;
InputStream is = null;
try {
os = new ZipOutputStream(new FileOutputStream(sDest));
is = new FileInputStream(sSource)... | true |
4,515 | 10,848,568 | 8,122,281 | private static void main(String mp3Path) throws IOException {
String convPath = "http://android.adinterest.biz/wav2mp3.php?k=";
String uri = convPath + mp3Path;
URL rssurl = new URL(uri);
InputStream is = rssurl.openStream();
BufferedReader br = new BufferedReader(new InputSt... | public String get(String s, String encoding) throws Exception {
if (!s.startsWith("http")) return "";
StringBuilder sb = new StringBuilder();
try {
String result = null;
URL url = new URL(s);
URLConnection connection = url.openConnection();
con... | true |
4,516 | 13,713,980 | 7,507,773 | private String sendMessage(HttpURLConnection connection, String reqMessage) throws IOException, XMLStreamException {
if (msgLog.isTraceEnabled()) msgLog.trace("Outgoing SOAPMessage\n" + reqMessage);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
out.write(... | public boolean restore(File directory) {
log.debug("restore file from directory " + directory.getAbsolutePath());
try {
if (!directory.exists()) return false;
String[] operationFileNames = directory.list();
if (operationFileNames.length < 6) {
log.... | true |
4,517 | 204,078 | 8,677,886 | 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 Document getSdlDomResource(String aResourceName) throws SdlException {
InputStream in = null;
try {
URL url = getDeploymentContext().getResourceURL(aResourceName);
if (url == null) {
return null;
} else {
in = url.openStream(... | false |
4,518 | 8,678,081 | 9,857,411 | public static String encrypt(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.update(password.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(digest.digest());
} catch (NoSuchA... | @Override
public void checkConnection(byte[] options) throws Throwable {
Properties opts = PropertiesUtils.deserializeProperties(options);
String server = opts.getProperty(TRANSFER_OPTION_SERVER);
String username = opts.getProperty(TRANSFER_OPTION_USERNAME);
String password = opt... | false |
4,519 | 10,933,932 | 22,082,121 | public static String crypt(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("String to encript cannot be null or zero length");
}
StringBuffer hexString = new StringBuffer();
MessageDigest md = null;
try {
md = M... | public static String digestMd5(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("文字列がNull、または空です。");
}
MessageDigest md5;
byte[] enclyptedHash;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update... | true |
4,520 | 1,124,190 | 7,169,017 | private SystemProperties() {
Properties p = new Properties();
ClassLoader classLoader = getClass().getClassLoader();
try {
URL url = classLoader.getResource("system.properties");
if (url != null) {
InputStream is = url.openStream();
p.l... | 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 |
4,521 | 3,298,289 | 18,790,501 | public static String move_tags(String sessionid, String absolutePathForTheMovedTags, String absolutePathForTheDestinationTag) {
String resultJsonString = "some problem existed inside the create_new_tag() function if you see this string";
try {
Log.d("current running function name:", "mov... | public void init(String file) {
URL url = SoundFactory.class.getResource(file);
try {
JAXBContext context = JAXBContext.newInstance("elf.xml.sounds");
Unmarshaller unmarshaller = context.createUnmarshaller();
SoundsBaseType root = null;
Object tmpobj =... | false |
4,522 | 3,533,514 | 10,053,153 | public boolean saveVideoXMLOnWebserver() {
String text = "";
boolean erg = false;
try {
URL url = new URL("http://localhost:8080/virtPresenterVerwalter/videofile.jsp?id=" + this.getId());
HttpURLConnection http = (HttpURLConnection) url.openConnection();
B... | @Override
public void run() {
log.debug("Now running....");
log.debug("Current env. variables:");
try {
this.infoNotifiers("Environment parameters after modifications:");
this.logEnvironment();
this.infoNotifiers("Dump t... | false |
4,523 | 10,601,019 | 11,199,367 | public static 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();
... | private void copy(FileInfo inputFile, FileInfo outputFile) {
try {
FileReader in = new FileReader(inputFile.file);
FileWriter out = new FileWriter(outputFile.file);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.clos... | true |
4,524 | 6,288,460 | 9,552,428 | private static void createNonCompoundData(String dir, String type) {
try {
Set s = new HashSet();
File nouns = new File(dir + "index." + type);
FileInputStream fis = new FileInputStream(nouns);
InputStreamReader reader = new InputStreamReader(fis);
... | public static String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
System.out.println("test");
URL url = new URL(addr);
System.out.println("test2");
IOUtils.copy(url.openStream(), output);
return output.toStr... | true |
4,525 | 131,811 | 6,506,273 | 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[] 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 |
4,526 | 1,279,675 | 5,621,042 | public Mappings read() {
Mappings result = null;
InputStream stream = null;
try {
XMLParser parser = new XMLParser();
stream = url.openStream();
result = parser.parse(stream);
} catch (Throwable e) {
log.error("Error in loading dozer ma... | private void postObject(Object obj, String strURL) throws Exception {
print("entering post object");
URL url = new URL(strURL);
URLConnection urlConn = url.openConnection();
print("HttpNetworkMessageConnection.postObject:returned from url.openConnection()");
urlConn.setUseCac... | false |
4,527 | 14,050,307 | 1,296,795 | public int instantiate(int objectId, String description) throws FidoDatabaseException, ObjectNotFoundException, ClassLinkTypeNotFoundException {
try {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
String sql = "inser... | 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 |
4,528 | 1,089,238 | 12,394,789 | private Document saveFile(Document document, File file) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATEFORMAT_YYYYMMDD);
List<Preference> preferences = prefService.findAll();
if (preferences != null && !preferences.isEmpty()) {
Preference preference ... | public static void copyFile(File in, File out, long maxCount) throws IOException {
final FileChannel sourceChannel = new FileInputStream(in).getChannel();
final FileChannel destinationChannel = new FileOutputStream(out).getChannel();
if (maxCount == 0) maxCount = sourceChannel.size();
... | true |
4,529 | 3,024,990 | 16,337,161 | @Test
public void testCopy_readerToOutputStream_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
Reader reader = new InputStreamReader(in, "US-ASCII");
ByteArrayOutputStream baout = new ByteArra... | public String index(URL url) {
InputStream is = null;
try {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setInstanceFollowRedirects(true);
urlConnection.setAllowUserInteraction(false);
System.setProperty("su... | false |
4,530 | 16,239,141 | 10,222,828 | private void renameTo(File from, File to) {
if (!from.exists()) return;
if (to.exists()) to.delete();
boolean worked = false;
try {
worked = from.renameTo(to);
} catch (Exception e) {
database.logError(this, "" + e, null);
}
if (!worked... | public static String getMD5Hash(String data) {
MessageDigest digest;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(data.getBytes());
byte[] hash = digest.digest();
StringBuffer hexString = new StringBuffer();
... | false |
4,531 | 18,513,921 | 2,451,974 | public static void copy(File src, File dst) {
try {
InputStream is = null;
OutputStream os = null;
try {
is = new BufferedInputStream(new FileInputStream(src), BUFFER_SIZE);
os = new BufferedOutputStream(new FileOutputStream(dst), BUFFER_SI... | @Override
public void doHandler(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
if (request.getRequestURI().indexOf("png") != -1) {
response.setContentType("image/png");
} else if (request.getRequestURI().indexOf("gif") != -1) {
... | false |
4,532 | 19,026,786 | 18,820,148 | private 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 static String MD5ToString(String md5) {
String hashword = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(md5.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
hashword = hash.toString(16);
} catch... | true |
4,533 | 14,770,723 | 2,031,877 | public static boolean copyFile(File dest, File source) {
FileInputStream fis = null;
FileOutputStream fos = null;
boolean rv = false;
byte[] buf = new byte[1000000];
int bytesRead = 0;
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
try {
... | 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 |
4,534 | 23,677,138 | 22,900,234 | public static void BubbleSortDouble2(double[] num) {
int last_exchange;
int right_border = num.length - 1;
do {
last_exchange = 0;
for (int j = 0; j < num.length - 1; j++) {
if (num[j] > num[j + 1])
{
double temp = num[j];
num[j] = num[j + 1];
num[j + 1] = temp;
last_exchange = ... | public static String digestString(String data, String algorithm) {
String result = null;
if (data != null) {
try {
MessageDigest _md = MessageDigest.getInstance(algorithm);
_md.update(data.getBytes());
byte[] _digest = _md.digest();
... | false |
4,535 | 15,167,113 | 6,371,601 | public static void doHttpPost(String urlName, byte[] data, String contentType, String cookieData) throws InteropException {
URL url = getAccessURL(urlName);
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
... | public void removeForwardAddress(final List<NewUser> forwardAddresses) {
try {
final List<Integer> usersToRemoveFromCache = new ArrayList<Integer>();
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false... | false |
4,536 | 23,087,894 | 15,202,805 | public static String digest(String str) {
StringBuffer sb = new StringBuffer();
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
md5.update(str.getBytes("ISO8859-1"));
byte[] array = md5.digest();
for (int x = 0; x < 16; x++) {
... | public static String getDigest(String user, String realm, String password, String method, String uri, String nonce, String nc, String cnonce, String qop) {
String digest1 = user + ":" + realm + ":" + password;
String digest2 = method + ":" + uri;
try {
MessageDigest digestOne = M... | true |
4,537 | 15,599,613 | 15,506,300 | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | @SuppressWarnings("static-access")
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter(... | true |
4,538 | 2,168,607 | 10,589,735 | public int create(BusinessObject o) throws DAOException {
int insert = 0;
int id = 0;
Contact contact = (Contact) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("INSERT_CONTACT"));
pst.setString(1, contact.getName());
... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
}
try {
long time = System.currentTi... | false |
4,539 | 553,082 | 562,437 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | public static 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 |
4,540 | 5,138,483 | 18,681,935 | public static List<String> extract(String zipFilePath, String destDirPath) throws IOException {
List<String> list = null;
ZipFile zip = new ZipFile(zipFilePath);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
... | public static void copyFromOffset(long offset, File exe, File cab) throws IOException {
DataInputStream in = new DataInputStream(new FileInputStream(exe));
FileOutputStream out = new FileOutputStream(cab);
byte[] buffer = new byte[4096];
int bytes_read;
in.skipBytes((int) off... | true |
4,541 | 19,392,393 | 14,157,964 | private void addIngredients(Recipe recipe, int id) throws Exception {
PreparedStatement pst = null;
try {
conn = getConnection();
pst = conn.prepareStatement("INSERT INTO ingredients (recipe_id, name, amount, measure_id, shop_flag) VALUES (?,?,?,?,?)");
Ingredient... | private static String readGeoJSON(String feature) {
StringBuffer content = new StringBuffer();
try {
URL url = new URL(feature);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader rd = new BufferedReader(n... | false |
4,542 | 938,889 | 16,353,456 | public 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);
FileO... | private void fileCopy(File filename) throws IOException {
if (this.stdOut) {
this.fileDump(filename);
return;
}
File source_file = new File(spoolPath + "/" + filename);
File destination_file = new File(copyPath + "/" + filename);
FileInputStream source... | true |
4,543 | 19,950,034 | 23,618,963 | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | public static void copyFile(File src, File dst) {
try {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dst);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = fis.read(buf... | true |
4,544 | 10,943,077 | 14,510,383 | private void copy(File fromFile, File toFile) throws IOException {
String fromFileName = fromFile.getName();
File tmpFile = new File(fromFileName);
String toFileName = toFile.getName();
if (!tmpFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName... | @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... | true |
4,545 | 3,636,960 | 3,753,583 | public void display(WebPage page, HttpServletRequest req, HttpServletResponse resp) throws DisplayException {
page.getDisplayInitialiser().initDisplay(new HttpRequestDisplayContext(req), req);
StreamProvider is = (StreamProvider) req.getAttribute(INPUTSTREAM_KEY);
if (is == null) {
... | public static void generateCode(File flowFile, String packagePath, File destDir, File scriptRootFolder) throws IOException {
InputStream javaSrcIn = generateCode(flowFile, packagePath, scriptRootFolder);
File outputFolder = new File(destDir, packagePath.replace('.', File.separatorChar));
Str... | true |
4,546 | 93,208 | 19,145,296 | 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 double[][] getCurrency() throws IOException {
URL url = new URL("http://hk.finance.yahoo.com/currency");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "big5"));
double currency[][] = new double[11][11];
while (true) {
String ... | false |
4,547 | 7,237,618 | 4,726,770 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public void execute() throws MojoExecutionException, MojoFailureException {
try {
this.getLog().info("copy source web.xml - " + this.getWebXml() + " to build dir (source web.xml required if mergewebxml execution is enabled)");
File destination = new File(this.getBuildDir(), "web.xml"... | true |
4,548 | 7,926,874 | 22,510,494 | public static void main(String arg[]) {
try {
String readFile = arg[0];
String writeFile = arg[1];
java.io.FileInputStream ss = new java.io.FileInputStream(readFile);
ManagedMemoryDataSource ms = new ManagedMemoryDataSource(ss, 1024 * 1024, "foo/data", true);
... | public static void getResponseAsStream(String _url, Object _stringOrStream, OutputStream _stream, Map<String, String> _headers, Map<String, String> _params, String _contentType, int _timeout) throws IOException {
if (_url == null || _url.length() <= 0) throw new IllegalArgumentException("Url can not be null... | true |
4,549 | 647,710 | 19,710,610 | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | public void copyImage(String from, String to) {
File inputFile = new File(from);
File outputFile = new File(to);
try {
if (inputFile.canRead()) {
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outpu... | true |
4,550 | 1,854,052 | 4,518,933 | @Before
public void setUp() throws Exception {
configureSslSocketConnector();
SecurityHandler securityHandler = createBasicAuthenticationSecurityHandler();
HandlerList handlerList = new HandlerList();
handlerList.addHandler(securityHandler);
handlerList.addHandler(new Abs... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
4,551 | 20,310,074 | 14,432,775 | public static String encryptPassword(String originalPassword) {
if (!StringUtils.hasText(originalPassword)) {
originalPassword = randomPassword();
}
try {
MessageDigest md5 = MessageDigest.getInstance(PASSWORD_ENCRYPTION_TYPE);
md5.update(originalPassword.... | static void copyFile(File in, File outDir, String outFileName) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
outDir.mkdirs();
File outFile = new File(outDir, outFileName);
FileChannel outChannel = new FileOutputStream(outFile).getChannel();
... | false |
4,552 | 15,890,129 | 7,631,406 | public File getAppHome() {
if (appHome == null) {
if (System.getProperty("app.home") != null) {
appHome = new File(System.getProperty("app.home"));
}
if (appHome == null) {
URL url = Main.class.getClassLoader().getResource("com/hs/mail/cont... | public static InputStream getResourceAsStream(final String fileName) {
if ((fileName.indexOf("file:") >= 0) || (fileName.indexOf(":/") > 0)) {
try {
URL url = new URL(fileName);
return new BufferedInputStream(url.openStream());
} catch (Exception e) {
... | false |
4,553 | 20,559,733 | 17,553,387 | public Long addPortletName(PortletNameBean portletNameBean) {
PreparedStatement ps = null;
DatabaseAdapter dbDyn = null;
try {
dbDyn = DatabaseAdapter.getInstance();
CustomSequenceType seq = new CustomSequenceType();
seq.setSequenceName("seq_WM_PORTAL_PORT... | @Override
public boolean putDescription(String uuid, String description) throws DatabaseException {
if (uuid == null) throw new NullPointerException("uuid");
if (description == null) throw new NullPointerException("description");
try {
getConnection().setAutoCommit(false);
... | true |
4,554 | 17,058,342 | 2,021,565 | public void executeUpdate(Native nativeResource) throws Exception {
Connection con = null;
boolean autoCommit = true;
PreparedStatement st = null;
try {
HrRecord hr = getRepository();
ManagedConnection mc = returnConnection();
con = mc.getJdbcConne... | public void mkdirs(String path) throws IOException {
GridFTP ftp = new GridFTP();
ftp.setDefaultPort(port);
System.out.println(this + ".mkdirs " + path);
try {
ftp.connect(host);
ftp.login(username, password);
int reply = ftp.getReplyCode();
... | false |
4,555 | 4,961,130 | 9,113,394 | @Override
public void delCategoria(Integer codigo) throws Exception {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = C3P0Pool.getConnection();
String sql = "delete from categoria where id_categoria = ?";
ps = conn.prepareStatement(sq... | public static void saveChangeLink(URL url, OutputStream os) {
try {
BufferedInputStream is = new BufferedInputStream(url.openStream());
int i;
while ((i = is.read()) != -1) if ((char) i == '<') {
String s = readTag(is);
String s1 = convertT... | false |
4,556 | 10,957,655 | 15,385,606 | public static String SHA1(String string) throws XLWrapException {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
throw new XLWrapException("SHA-1 message digest is not available.");
}
byte[] data... | public List<BoardObject> favBoard() throws NetworkException, ContentException {
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(HttpConfig.bbsURL() + HttpConfig.BBS_FAV);
try {
HttpResponse response = client.execute(get);
HttpEntity entity = re... | false |
4,557 | 3,153,908 | 2,033,320 | public boolean connentServer() {
boolean result = false;
try {
ftpClient = new FTPClient();
ftpClient.setDefaultPort(port);
ftpClient.setControlEncoding("GBK");
strOut = strOut + "Connecting to host " + host + "\r\n";
ftpClient.connect(host... | public static void gunzip(File gzippedFile, File destinationFile) throws IOException {
int buffer = 2048;
FileInputStream in = new FileInputStream(gzippedFile);
GZIPInputStream zipin = new GZIPInputStream(in);
byte[] data = new byte[buffer];
FileOutputStream out = new FileOut... | false |
4,558 | 11,758,299 | 2,240,926 | void readData() {
String[] nextLine;
int line;
double value;
URL url = null;
String FileToRead;
try {
for (int i = 0; i < names.length; i++) {
FileToRead = "data/" + names[i] + ".csv";
url = new URL(ja.getCodeBase(), FileToR... | public boolean getFiles(String pRemoteDirectory, String pLocalDirectory) throws IOException {
final String methodSignature = "boolean getFiles(String,String): ";
FTPClient fc = new FTPClient();
fc.connect(getRemoteHost());
fc.login(getUserName(), getPassword());
fc.changeWork... | false |
4,559 | 11,481,709 | 14,899,566 | 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... | public void createZip(File zipFileName, Vector<File> selected) {
try {
byte[] buffer = new byte[4096];
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFileName), 8096));
out.setLevel(Deflater.BEST_COMPRESSION);
out.se... | true |
4,560 | 2,481,505 | 7,395,775 | @Override
public void run() {
try {
File[] inputFiles = new File[this.previousFiles != null ? this.previousFiles.length + 1 : 1];
File copiedInput = new File(this.randomFolder, this.inputFile.getName());
IOUtils.copyFile(this.inputFile, copiedInput);
input... | private void copyReportFile(ServletRequest req, String reportName, Report report) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, FileNotFoundException, IOException {
String reportFileName = (String) Class.forName("org.eclipse.birt.report.utility.Para... | true |
4,561 | 3,236,017 | 647,710 | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | true |
4,562 | 17,597,668 | 21,161,481 | private boolean copyFiles(File sourceDir, File destinationDir) {
boolean result = false;
try {
if (sourceDir != null && destinationDir != null && sourceDir.exists() && destinationDir.exists() && sourceDir.isDirectory() && destinationDir.isDirectory()) {
File sourceFiles[]... | public static void toZip(File zippedFile, File[] filesToZip, String zipComment, boolean savePath, int compressionLevel) throws IOException, FileNotFoundException, ZipException {
if (zippedFile != null && filesToZip != null) {
new File(zippedFile.getParent()).mkdirs();
ZipOutputStream... | true |
4,563 | 22,998,998 | 8,990,219 | public static void copyFile(File sourceFile, File destFile) throws IOException {
FileChannel inputFileChannel = new FileInputStream(sourceFile).getChannel();
FileChannel outputFileChannel = new FileOutputStream(destFile).getChannel();
long offset = 0L;
long length = inputFileChannel.... | private boolean getCached(Get g) throws IOException {
boolean ret = false;
File f = getCachedFile(g);
if (f.exists()) {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(f);
os = new FileOutputStr... | true |
4,564 | 15,912,858 | 9,383,862 | public static String Md5By32(String plainText) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; of... | public static String md5It(String data) {
MessageDigest digest;
String output = "";
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(data.getBytes());
byte[] hash = digest.digest();
for (byte b : hash) {
... | true |
4,565 | 1,322,369 | 2,439,668 | private void unpackBundle() throws IOException {
File useJarPath = null;
if (DownloadManager.isWindowsVista()) {
useJarPath = lowJarPath;
File jarDir = useJarPath.getParentFile();
if (jarDir != null) {
jarDir.mkdirs();
}
} else ... | public void run() {
try {
textUpdater.start();
int cnt;
byte[] buf = new byte[4096];
File file = null;
ZipInputStream zis = new ZipInputStream(new FileInputStream(new File(filename)));
ZipEntry ze = zis.getNextEntry();
FileO... | true |
4,566 | 21,931,071 | 5,724,216 | public static void writeToPetrify(TransitionSystem ts, Writer bw) throws IOException {
File temp = new File("_temp");
BufferedWriter tw = new BufferedWriter(new FileWriter(temp));
BufferedReader tr = new BufferedReader(new FileReader(temp));
HashSet<ModelGraphVertex> sources = new Ha... | protected static void copyOrMove(File sourceLocation, File targetLocation, boolean move) throws IOException {
String[] children;
int i;
InputStream in;
OutputStream out;
byte[] buf;
int len;
if (sourceLocation.isDirectory()) {
if (!targetLocation.e... | true |
4,567 | 4,948,580 | 11,333,342 | public InputStream getResourceAsStream(String path) {
try {
URL url = getResource(path);
if (url != null) {
return url.openStream();
} else {
return null;
}
} catch (IOException ioe) {... | public AssessmentItemType getAssessmentItemType(String filename) {
if (filename.contains(" ") && (System.getProperty("os.name").contains("Windows"))) {
File source = new File(filename);
String tempDir = System.getenv("TEMP");
File dest = new File(tempDir + "/temp.xml");
... | false |
4,568 | 19,178,250 | 22,019,481 | public static String createMD5(String str) {
String sig = null;
String strSalt = str + sSalt;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(strSalt.getBytes(), 0, strSalt.length());
byte byteData[] = md5.digest();
Strin... | private static boolean copyFile(File srcFile, File tagFile) throws IOException {
if (srcFile == null || tagFile == null) {
return false;
}
int length = 2097152;
FileInputStream in = new FileInputStream(srcFile);
FileOutputStream out = new FileOutputStream(tagFile)... | false |
4,569 | 8,708,601 | 316,912 | public void testReadNormal() throws Exception {
archiveFileManager.executeWith(new TemporaryFileExecutor() {
public void execute(File temporaryFile) throws Exception {
ZipArchive archive = new ZipArchive(temporaryFile.getPath());
InputStream input = archive.getIn... | 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);
... | true |
4,570 | 20,110,295 | 8,966,082 | public static String getMD5(final String data) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(data.getBytes());
BigInteger bigInt = new BigInteger(1, m.digest());
String hashtext = bigInt.toString(16);
w... | public void testOptionalSections() throws Exception {
final File implementationDirectory = this.getTestSourcesDirectory();
final File specificationDirectory = this.getTestSourcesDirectory();
IOUtils.copy(this.getClass().getResourceAsStream("ImplementationWithoutConstructorsSection.java.txt")... | false |
4,571 | 6,644,757 | 14,310,068 | public void excluir(Cliente cliente) throws Exception {
Connection connection = criaConexao(false);
String sql = "delete from cliente where cod_cliente = ?";
PreparedStatement stmt = null;
try {
stmt = connection.prepareStatement(sql);
stmt.setLong(1, cliente.... | protected Boolean lancerincident(long idbloc, String Etatbloc, java.util.GregorianCalendar datebloc, long idServeur, String niveau, String message) {
String codeerr;
Boolean retour = false;
Boolean SauvegardeEtatAutocommit;
int etat;
acgtools_core.AcgIO.SortieLog(new Date() +... | true |
4,572 | 9,526,428 | 6,374,427 | public static String hashPassword(String password) {
String passwordHash = "";
try {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
sha1.reset();
sha1.update(password.getBytes());
Base64 encoder = new Base64();
passwordHash = new ... | public String getTags(URL url) {
StringBuffer xml = new StringBuffer();
OutputStreamWriter osw = null;
BufferedReader br = null;
try {
String reqData = URLEncoder.encode(paramName, "UTF-8") + "=" + URLEncoder.encode(url.toString(), "UTF-8");
URL service = new ... | false |
4,573 | 9,104,988 | 6,535,232 | public String getHashedPhoneId(Context aContext) {
if (hashedPhoneId == null) {
final String androidId = BuildInfo.getAndroidID(aContext);
if (androidId == null) {
hashedPhoneId = "EMULATOR";
} else {
try {
final Message... | public String encodePassword(String password, byte[] salt) throws Exception {
if (salt == null) {
salt = new byte[12];
secureRandom.nextBytes(salt);
}
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(salt);
md.update(password.getBytes("UT... | true |
4,574 | 5,751,314 | 1,001,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.... | private void doOp(String urlString) {
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
e.printStackTrace();
return;
}
URLConnection conn = null;
try {
conn = url.openConnection();
... | false |
4,575 | 23,531,897 | 4,794,470 | public void doUpdateByIP() throws Exception {
if (!isValidate()) {
throw new CesSystemException("User_session.doUpdateByIP(): Illegal data values for update");
}
Connection con = null;
PreparedStatement ps = null;
String strQuery = "UPDATE " + Common.USER_SESSION_... | private void load() throws SQLException {
Connection conn = null;
Statement stmt = null;
try {
conn = FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
ClearData.clearTables(stmt);
stmt.execut... | true |
4,576 | 13,337,915 | 14,928,023 | private static String calculateMD5(String s) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(s.getBytes());
return new BigInteger(1, m.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
throw new ... | public 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... | true |
4,577 | 3,325,456 | 16,287,151 | public static void copy(String a, String b) throws IOException {
File inputFile = new File(a);
File outputFile = new File(b);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
... | public void run() {
try {
Socket socket = getSocket();
System.out.println("opening socket to " + address + " on " + port);
InputStream in = socket.getInputStream();
for (; ; ) {
FileTransferHeader header = FileTransferHeader.readHeader(in);
... | true |
4,578 | 8,361,376 | 16,343,568 | protected String encrypt(final String data, final String key) throws CryptographicFailureException {
Validate.notNull(data, "Provided data cannot be null.");
Validate.notNull(key, "Provided key name cannot be null.");
final PublicKey pk = getPublicKey(key);
if (pk == null) {
... | public static void doGet(HttpServletRequest request, HttpServletResponse response, CollOPort colloport, PrintStream out) throws ServletException, IOException {
response.addDateHeader("Expires", System.currentTimeMillis() - 86400);
String id = request.getParameter("id");
String url_index = re... | false |
4,579 | 18,973,292 | 4,725,344 | protected static File UrlToFile(String urlSt) throws CaughtException {
try {
logger.info("copy from url: " + urlSt);
URL url = new URL(urlSt);
InputStream input = url.openStream();
File dir = tempDir;
File tempFile = new File(tempDir + File.separat... | public static String[] findClassesInPackage(String packageName, List<String> included, List<String> excluded) throws IOException {
String packageOnly = packageName;
boolean recursive = false;
if (packageName.endsWith(".*")) {
packageOnly = packageName.substring(0, packageName.las... | false |
4,580 | 1,001,152 | 22,031,237 | private void doOp(String urlString) {
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
e.printStackTrace();
return;
}
URLConnection conn = null;
try {
conn = url.openConnection();
... | @Override
public ReturnValue do_run() {
int bufLen = 500 * 1024;
ReturnValue ret = new ReturnValue();
ret.setExitStatus(ReturnValue.SUCCESS);
File output = null;
if (((String) options.valueOf("input-file")).startsWith("s3://")) {
Pattern p = Pattern.compile("s... | false |
4,581 | 13,825,969 | 22,704,165 | @Override
protected void doFetch(HttpServletRequest request, HttpServletResponse response) throws IOException, GadgetException {
if (request.getHeader("If-Modified-Since") != null) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
String host = ... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel.size(), destinationChanne... | true |
4,582 | 16,902,397 | 4,470,706 | private void convertClasses(File source, File destination) throws PostProcessingException, CodeCheckException, IOException {
Stack sourceStack = new Stack();
Stack destinationStack = new Stack();
sourceStack.push(source);
destinationStack.push(destination);
while (!sourceStac... | @Override
public boolean validatePublisher(Object object, String... dbSettingParams) {
DBConnectionListener listener = (DBConnectionListener) object;
String host = dbSettingParams[0];
String port = dbSettingParams[1];
String driver = dbSettingParams[2];
String type = dbSe... | false |
4,583 | 11,656,036 | 14,047,630 | @SuppressWarnings("unchecked")
public static void createInstance(ExternProtoDeclare externProtoDeclare) {
ExternProtoDeclareImport epdi = new ExternProtoDeclareImport();
HashMap<String, ProtoDeclareImport> protoMap = X3DImport.getTheImport().getCurrentParser().getProtoMap();
boolean load... | @Override
public void run() {
try {
IOUtils.copy(getSource(), processStdIn);
System.err.println("Copy done.");
close();
} catch (IOException e) {
e.printStackTrace();
... | false |
4,584 | 15,520,770 | 4,761,833 | public void writeConfigurationFile() throws IOException, ComponentException {
SystemConfig config = parent.getParentSystem().getConfiguration();
File original = config.getLocation();
File backup = new File(original.getParentFile(), original.getName() + "." + System.currentTimeMillis());
... | private void copyFileToDir(MyFile file, MyFile to, wlPanel panel) throws IOException {
Utilities.print("started copying " + file.getAbsolutePath() + "\n");
FileOutputStream fos = new FileOutputStream(new File(to.getAbsolutePath()));
FileChannel foc = fos.getChannel();
FileInputStream... | true |
4,585 | 2,767,689 | 76,427 | @Override
public void loadData() {
try {
String url = "http://ichart.finance.yahoo.com/table.csv?s=" + symbol + "&a=00&b=2&c=1962&d=11&e=11&f=2099&g=d&ignore=.csv";
URLConnection conn = (new URL(url)).openConnection();
conn.connect();
BufferedReader in = n... | 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 |
4,586 | 11,664,406 | 2,265,495 | public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String version = req.getParameter("version");
String cdn = req.getParameter("cdn");
String dependencies = req.getParameter("dependencies");
String optimize = req.getParameter("op... | public final String encrypt(String input) throws Exception {
try {
MessageDigest messageDigest = (MessageDigest) MessageDigest.getInstance(algorithm).clone();
messageDigest.reset();
messageDigest.update(input.getBytes());
String output = convert(messageDigest.... | true |
4,587 | 15,831,694 | 17,965,575 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
OutputStream output = getOutputStream();
if (cachedContent != null) {
output.write(cachedContent);
} else {
FileInputStream input = new FileInput... | true |
4,588 | 20,661,433 | 3,734,993 | 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);
... | private void fetchAlignment() throws IOException {
String urlString = BASE_URL + ALN_URL + DATASET_URL + "&family=" + mFamily;
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
processAlignment(in);
}
| false |
4,589 | 11,268,952 | 10,118,785 | 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: " + ... | @Override
public void download(String remoteFilePath, String localFilePath) {
InputStream remoteStream = null;
try {
remoteStream = client.get(remoteFilePath);
} catch (IOException e) {
e.printStackTrace();
}
OutputStream localStream = null;
... | true |
4,590 | 18,042,543 | 12,247,514 | public void writeTo(OutputStream out) throws IOException, MessagingException {
InputStream in = getInputStream();
Base64OutputStream base64Out = new Base64OutputStream(out);
IOUtils.copy(in, base64Out);
base64Out.close();
mFile.delete();
}
| public static void main(String[] args) throws Exception {
if (args.length != 2) {
PrintUtil.prt("arguments: sourcefile, destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | true |
4,591 | 150,478 | 5,271,797 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private void loadMap() {
final String wordList = "vietwordlist.txt";
try {
File dataFile = new File(supportDir, wordList);
if (!dataFile.exists()) {
final ReadableByteChannel input = Channels.newChannel(ClassLoader.getSystemResourceAsStream("dict/" + dataFile.... | true |
4,592 | 2,273,819 | 12,626,918 | String digest(final UserAccountEntity account) {
try {
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(account.getUserId().getBytes("UTF-8"));
digest.update(account.getLastLogin().toString(... | public void xtestURL2() throws Exception {
URL url = new URL(IOTest.URL);
InputStream inputStream = url.openStream();
OutputStream outputStream = new FileOutputStream("C:/Temp/testURL2.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.c... | false |
4,593 | 7,199,174 | 18,464,490 | public static BufferedInputStream getEventAttacchment(final String url) throws IOException {
int slashIndex = url.lastIndexOf("/");
String encodedUrl = url.substring(0, slashIndex + 1) + URLEncoder.encode(url.substring(slashIndex + 1), "UTF-8");
String urlwithtoken = encodedUrl + "?ticket=" ... | @Override
public void actionPerformed(ActionEvent e) {
if (copiedFiles_ != null) {
File[] tmpFiles = new File[copiedFiles_.length];
File tmpDir = new File(Settings.getPropertyString(ConstantKeys.project_dir), "tmp/");
tmpDir.mkdirs();
... | false |
4,594 | 15,659,812 | 9,563 | private static void generateTIFF(Connection con, String category, String area_code, String topic_code, String timeseries, String diff_timeseries, Calendar time, String area_label, String raster_label, String image_label, String note, Rectangle2D bounds, Rectangle2D raster_bounds, String source_filename, String diff... | 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... | false |
4,595 | 11,130,567 | 14,975,464 | public static boolean copyFile(File sourceFile, File destFile) throws IOException {
long flag = 0;
if (!destFile.exists()) destFile.createNewFile();
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChanne... | public String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance(SHA1);
md.update(text.getBytes(CHAR_SET), 0, text.length());
byte[] mdbytes = md.digest();
return byteToHex(mdbytes);
}
| false |
4,596 | 20,296,791 | 6,436,400 | public void retrieveChallenge() throws MalformedURLException, IOException, FBConnectionException, FBErrorException {
URL url = new URL(getHost() + getPath());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-FB-User", getUser());
conn.setR... | @Override
protected HttpResponse<HttpURLConnection> execute(HttpRequest<HttpURLConnection> con) throws HttpRequestException {
HttpURLConnection unwrap = con.unwrap();
try {
unwrap.connect();
} catch (IOException e) {
throw new HttpRequestException(e);
}
... | false |
4,597 | 22,246,374 | 7,005,223 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public void checkFilesAndCopyValid(String filename) {
downloadResults();
loadResults();
File tmpFolderF = new File(tmpFolder);
deleteFileFromTMPFolder(tmpFolderF);
ZipReader zr = new ZipReader();
zr.UnzipFile(filename);
try {
LogManager.getInstance... | true |
4,598 | 3,493,991 | 16,388,707 | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
4,599 | 860,848 | 11,711,888 | 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 synchronized void readConfiguration() throws IOException, SecurityException {
String path;
InputStream inputStream;
path = System.getProperty("java.util.logging.config.file");
if ((path == null) || (path.length() == 0)) {
String url = (System.getProperty("gnu.class... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.