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 |
|---|---|---|---|---|---|
897,500 | 1,197,703 | 8,452,132 | public static String digest(String algorithm, String text) {
MessageDigest mDigest = null;
try {
mDigest = MessageDigest.getInstance(algorithm);
mDigest.update(text.getBytes(ENCODING));
} catch (NoSuchAlgorithmException nsae) {
_log.error(nsae, nsae);
... | public void get(String path, File fileToGet) throws IOException {
FTPClient ftp = new FTPClient();
try {
int reply = 0;
ftp.connect(this.endpointURL, this.endpointPort);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
... | false |
897,501 | 23,677,116 | 16,328,840 | 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(... | protected InputStream transform(URL url) throws IOException {
TransformerFactory tf = TransformerFactory.newInstance();
InputStream xsl_is = null;
InputStream url_is = null;
ByteArrayOutputStream os = null;
byte[] output;
try {
xsl_is = Classes.getThreadCl... | false |
897,502 | 6,109,982 | 15,017,482 | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | private static String getSuitableWCSVersion(String host, String _version) throws ConnectException, IOException {
String request = WCSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version);
String version = new String();
StringReader reader = null;
DataInputStream dis... | false |
897,503 | 22,924,615 | 10,816,494 | @Override
public void run() {
try {
bitmapDrawable = new BitmapDrawable(new URL(url).openStream());
imageCache.put(id, new SoftReference<Drawable>(bitmapDrawable));
log("image::: put: id = " + id + " ");
... | @Override
public void sendData(String serverUrl, String fileName, String type, InputStream is) throws IOException {
ClientSession clientSession = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + serverUrl);
}
clientSes... | false |
897,504 | 4,937,926 | 7,038,631 | @Override
public RServiceResponse execute(final NexusServiceRequest inData) throws NexusServiceException {
final RServiceRequest data = (RServiceRequest) inData;
final RServiceResponse retval = new RServiceResponse();
final StringBuilder result = new StringBuilder("R service call results... | private FileLog(LOG_LEVEL displayLogLevel, LOG_LEVEL logLevel, String logPath) {
this.logLevel = logLevel;
this.displayLogLevel = displayLogLevel;
if (null != logPath) {
logFile = new File(logPath, "current.log");
log(LOG_LEVEL.DEBUG, "FileLog", "Initialising logfile ... | true |
897,505 | 19,731,419 | 19,883,483 | public void transport(File file) throws TransportException {
if (file.exists()) {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
transport(file);
}
} else if (file... | public static void copy(String file1, String file2) throws IOException {
File inputFile = new File(file1);
File outputFile = new File(file2);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
System.out.println("Copy file from: " + file1 ... | true |
897,506 | 18,269,744 | 22,948,959 | 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.... | private static void copyFile(File sourceFile, File targetFile) throws FileSaveException {
try {
FileInputStream inputStream = new FileInputStream(sourceFile);
FileOutputStream outputStream = new FileOutputStream(targetFile);
FileChannel readableChannel = inputStream.getCh... | true |
897,507 | 21,496,578 | 21,996,772 | public Object construct() {
String fullName = lRegatta.getSaveDirectory() + lRegatta.getSaveName();
System.out.println(MessageFormat.format(res.getString("MainMessageBackingUp"), new Object[] { fullName + BAK }));
try {
FileInputStream fis ... | public static void copy(final File src, File dst, final boolean overwrite) throws IOException, IllegalArgumentException {
if (!src.isFile() || !src.exists()) {
throw new IllegalArgumentException("Source file '" + src.getAbsolutePath() + "' not found!");
}
if (dst.exists()) {
... | true |
897,508 | 9,838,495 | 15,639,580 | public void go() throws FBConnectionException, FBErrorException, IOException {
clearError();
results = new LoginResults();
URL url = new URL(getHost() + getPath());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-FB-User", getUser... | public ScoreModel(URL url) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
list = new ArrayList<ScoreModelItem>();
map = new HashMap<String, ScoreModelItem>();
line = in.readLine();
int n = 1;
... | false |
897,509 | 21,487,639 | 217,484 | private void addJarToPackages(URL jarurl, File jarfile, boolean cache) {
try {
boolean caching = this.jarfiles != null;
URLConnection jarconn = null;
boolean localfile = true;
if (jarfile == null) {
jarconn = jarurl.openConnection();
... | 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 |
897,510 | 8,138,998 | 1,415,765 | private void handleSSI(HttpData data) throws HttpError, IOException {
File tempFile = TempFileHandler.getTempFile();
FileOutputStream out = new FileOutputStream(tempFile);
BufferedReader in = new BufferedReader(new FileReader(data.realPath));
String[] env = getEnvironmentVariables(da... | public static String getMD5(String _pwd) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(_pwd.getBytes());
return toHexadecimal(new String(md.digest()).getBytes());
} catch (NoSuchAlgorithmException x) {
x.printStackTrace();
... | false |
897,511 | 9,568,958 | 20,861,925 | 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);
}
... | public static boolean isMatchingAsPassword(final String password, final String amd5Password) {
boolean response = false;
try {
final MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(password.getBytes());
f... | true |
897,512 | 12,994,590 | 477,320 | @HttpAction(name = "map.saveOrUpdate", method = { HttpAction.Method.post }, responseType = "text/plain")
@HttpAuthentication(method = { HttpAuthentication.Method.WSSE })
public String saveOrUpdate(FileItem file, User user, MapOriginal map) throws HttpRpcException {
File tmpFile;
GenericDAO<M... | private final void reOrderFriendsListByOnlineStatus() {
boolean flag = true;
while (flag) {
flag = false;
for (int i = 0; i < friendsCount - 1; i++) if (friendsListOnlineStatus[i] < friendsListOnlineStatus[i + 1]) {
int j = friendsListOnlineStatus[i];
... | false |
897,513 | 22,242,021 | 20,861,926 | public void testSavepoint4() throws Exception {
Statement stmt = con.createStatement();
stmt.execute("CREATE TABLE #savepoint4 (data int)");
stmt.close();
con.setAutoCommit(false);
for (int i = 0; i < 3; i++) {
System.out.println("iteration: " + i);
Pr... | public static String getMd5Password(final String password) {
String response = null;
try {
final MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(password.getBytes());
final byte[] md5Byte = algorithm.dige... | false |
897,514 | 19,392,665 | 15,710,690 | @Override
protected AuthenticationHandlerResponse authenticateInternal(final Connection c, final AuthenticationCriteria criteria) throws LdapException {
byte[] hash = new byte[DIGEST_SIZE];
try {
final MessageDigest md = MessageDigest.getInstance(passwordScheme);
md.updat... | @SuppressWarnings("unused")
private String getMD5(String value) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return "";
}
md5.reset();
md5.update(value.getBytes());
byte[]... | true |
897,515 | 14,093,043 | 11,245,902 | @Override
public boolean update(String consulta, boolean autocommit, int transactionIsolation, Connection cx) throws SQLException {
filasUpdate = 0;
if (!consulta.contains(";")) {
this.tipoConsulta = new Scanner(consulta);
if (this.tipoConsulta.hasNext()) {
... | public static void uploadFile(File in, String out, String host, int port, String path, String login, String password, boolean renameIfExist) throws IOException {
FTPClient ftp = null;
try {
m_logCat.info("Uploading " + in + " to " + host + ":" + port + " at " + path);
ftp = n... | false |
897,516 | 17,467,385 | 597,799 | private void moveFile(File orig, File target) throws IOException {
byte buffer[] = new byte[1000];
int bread = 0;
FileInputStream fis = new FileInputStream(orig);
FileOutputStream fos = new FileOutputStream(target);
while (bread != -1) {
bread = fis.read(buffer);
... | static void conditionalCopyFile(File dst, File src) throws IOException {
if (dst.equals(src)) return;
if (!dst.isFile() || dst.lastModified() < src.lastModified()) {
System.out.println("Copying " + src);
InputStream is = new FileInputStream(src);
OutputStream os =... | true |
897,517 | 14,924,022 | 19,886,621 | private boolean saveDocumentXml(String repository, String tempRepo) {
boolean result = true;
try {
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "documents/document";
InputSource insource = new InputSource(new FileInputStream(tempRepo + ... | private void doPOST(HttpURLConnection connection, InputStream inputXML) throws MessageServiceException {
try {
OutputStream requestStream = new BufferedOutputStream(connection.getOutputStream());
IOUtils.copyAndClose(inputXML, requestStream);
connection.connect();
... | true |
897,518 | 23,595,064 | 2,459,317 | 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);
... | @Test
public void testStandardTee() throws Exception {
final byte[] test = "test".getBytes();
final InputStream source = new ByteArrayInputStream(test);
final ByteArrayOutputStream destination1 = new ByteArrayOutputStream();
final ByteArrayOutputStream destination2 = new ByteArra... | true |
897,519 | 12,243,391 | 19,935,037 | private byte[] getMD5(String string) throws IMException {
byte[] buffer = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(string.getBytes("utf-8"));
buffer = md.digest();
buffer = getHexString(buffer);
} catch (NoSuch... | public byte[] getByteCode() throws IOException {
InputStream in = null;
ByteArrayOutputStream buf = new ByteArrayOutputStream(2048);
try {
in = url.openStream();
int b = in.read();
while (b != -1) {
buf.write(b);
b = in.read... | false |
897,520 | 14,900,320 | 19,296,521 | @Override
public User updateUser(User bean) throws SitoolsException {
checkUser();
Connection cx = null;
try {
cx = ds.getConnection();
cx.setAutoCommit(false);
PreparedStatement st;
int i = 1;
if (bean.getSecret() != null && !"... | private InputStream get(String url, long startOffset, long expectedLength) throws ClientProtocolException, IOException {
url = normalizeUrl(url);
Log.i(LOG_TAG, "Get " + url);
mHttpGet = new HttpGet(url);
int expectedStatusCode = HttpStatus.SC_OK;
if (... | false |
897,521 | 9,860,858 | 17,426,486 | @Override
public boolean register(String username, String password) {
this.getLogger().info(DbUserServiceImpl.class, ">>>rigister " + username + "<<<");
try {
if (this.getDbServ().queryFeelerUser(username) != null) {
return false;
}
MessageDige... | public String encrypt(String pwd) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
System.out.println("Error");
}
try {
md5.update(pwd.getBytes... | true |
897,522 | 1,042,184 | 7,663,603 | public static String scramble(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
for (byte b : md.digest()) sb.append(Integer.toString(b & 0xFF, 16));
... | public synchronized String encrypt(String plaintext) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new MyException(e.getMessage());
}
try {
md.update(pl... | true |
897,523 | 156,369 | 21,382,198 | 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... | private void initializeTree() {
InputStreamReader reader = null;
BufferedReader buffReader = null;
try {
for (int i = 0; i < ORDER.length; i++) {
int index = ORDER[i];
String indexName = index < 10 ? "0" + index : (index > 20 ? "big" : "" + index);... | true |
897,524 | 9,746,855 | 15,940,692 | public static boolean copy(InputStream is, File file) {
try {
FileOutputStream fos = new FileOutputStream(file);
IOUtils.copy(is, fos);
is.close();
fos.close();
return true;
} catch (Exception e) {
System.err.println(e.getMessag... | @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String fileName = request.getParameter("tegsoftFileName");
if (fileName.startsWith("Tegsoft_BACKUP_")) {
fileName = fileName.sub... | true |
897,525 | 3,520,277 | 22,900,234 | private void downloadFile(String directory, String fileName) {
URL url = null;
String urlstr = updateURL + directory + fileName;
int position = 0;
try {
Logger.msg(threadName + "Download new file from " + urlstr);
url = new URL(urlstr);
URLConnecti... | 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 |
897,526 | 18,488,106 | 2,329,054 | public static Document validateXml(File messageFile, URL inputUrl, String[] catalogs) throws IOException, ParserConfigurationException, Exception, SAXException, FileNotFoundException {
InputSource source = new InputSource(inputUrl.openStream());
Document logDoc = DomUtil.getNewDom();
XMLRead... | public static String MD5(String str) {
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
md5.update(str.getBytes(), 0, str.length());
String sig = new BigInteger(1, md5.digest()).toString();
return sig;
} catch (NoSuchAlgorithmException e) {
... | false |
897,527 | 15,537,156 | 5,883,596 | private void copy(String inputPath, String outputPath, String name) {
try {
FileReader in = new FileReader(inputPath + name);
FileWriter out = new FileWriter(outputPath + name);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | public void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inChannel.siz... | true |
897,528 | 2,760,895 | 22,271,847 | private void uploadFileToWebSite(String siteDir, String channelAsciiName, Map synFileList) throws Exception {
if (siteDir == null) {
siteDir = "";
}
log.debug("uploadFileToWebSite begin! siteDir:= " + siteDir + " currDate:= " + new Date().toString());
siteDir = new File(... | public static String encryptPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
byte[] hash = md.digest();
int hashLength = hash.length;
StringBuffer hashStringBuf = new StringBuffe... | false |
897,529 | 557,734 | 3,992,343 | public void constructAssociationView() {
String className;
String methodName;
String field;
boolean foundRead = false;
boolean foundWrite = false;
boolean classWritten = false;
try {
AssocView = new BufferedWriter(new FileWriter("InfoFiles/Associat... | public File createTemporaryFile() throws IOException {
URL url = clazz.getResource(resource);
if (url == null) {
throw new IOException("No resource available from '" + clazz.getName() + "' for '" + resource + "'");
}
String extension = getExtension(resource);
Stri... | true |
897,530 | 17,994,731 | 17,543,732 | 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;
}
| private String getCoded(String pass) {
String passSecret = "";
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(pass.getBytes("UTF8"));
byte s[] = m.digest();
for (int i = 0; i < s.length; i++) {
passSecret += Integer.... | true |
897,531 | 1,322,369 | 13,131,643 | 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 init(File file) {
InputStream is = null;
ByteArrayOutputStream os = null;
try {
is = new FileInputStream(file);
os = new ByteArrayOutputStream();
IOUtils.copy(is, os);
} catch (Throwable e) {
throw new VisualizerEngineExcept... | true |
897,532 | 19,912,847 | 9,135,964 | 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.... | private BufferedReader getReader(final String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
} catch (FileNotFoundException e) {
URL url = new URL(fileUrl);
reader = new InputStreamReader(url.openStream());
... | false |
897,533 | 11,199,367 | 5,305,335 | 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... | public void testRenderRules() {
try {
MappingManager manager = new MappingManager();
OWLOntologyManager omanager = OWLManager.createOWLOntologyManager();
OWLOntology srcOntology;
OWLOntology targetOntology;
manager.loadMapping(rulesDoc.toURL());
... | true |
897,534 | 12,413,227 | 20,805,884 | public void testClickToCallOutDirection() throws Exception {
init();
SipCall[] receiverCalls = new SipCall[receiversCount];
receiverCalls[0] = sipPhoneReceivers[0].createSipCall();
receiverCalls[1] = sipPhoneReceivers[1].createSipCall();
receiverCalls[0].listenForIncomingCall... | public String preProcessHTML(String uri) {
final StringBuffer buf = new StringBuffer();
try {
HTMLDocument doc = new HTMLDocument() {
public HTMLEditorKit.ParserCallback getReader(int pos) {
return new HTMLEditorKit.ParserCallback() {
... | false |
897,535 | 5,753,321 | 16,987,999 | public String selectFROM() throws Exception {
BufferedReader in = null;
String data = null;
try {
HttpClient httpclient = new DefaultHttpClient();
URI uri = new URI("http://**.**.**.**/OctopusManager/index2.php");
HttpGet request = new HttpGet();
... | private void copyFile(File sourceFile, File destFile) throws IOException {
if (!sourceFile.exists()) {
return;
}
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
source = n... | false |
897,536 | 8,909,675 | 4,424,457 | public static boolean copyFileToDir(File inputFile, File outputDir) {
try {
String outputFileName = inputFile.getName();
int index = 1;
while (existFileInDir(outputFileName, outputDir)) {
outputFileName = index + inputFile.getName();
index+... | public static void main(String[] args) throws IOException {
long start = System.currentTimeMillis();
FileResourceManager frm = CommonsTransactionContext.configure(new File("C:/tmp"));
try {
frm.start();
} catch (ResourceManagerSystemException e) {
throw new Ru... | true |
897,537 | 4,843,969 | 628,819 | public void buildCache() {
CacheManager.resetCache();
XMLCacheBuilder cacheBuilder = CompositePageUtil.getCacheBuilder();
if (cacheBuilder == null) return;
String pathStr = cacheBuilder.getPath();
if (pathStr == null) return;
String[] paths = pathStr.split("\n");
... | 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 |
897,538 | 15,376,869 | 19,074,021 | public static void writeToFile(final File file, final InputStream in) throws IOException {
IOUtils.createFile(file);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
IOUtils.copyStream(in, fos);
} finally {
IOUtils.closeIO(fos);... | public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
long time = System.currentTimeMillis();
String text = request.getParameter("text");
String parsedQueryString = request.getQueryString();
if (text == null) {
... | true |
897,539 | 22,625,096 | 709,510 | public void run() {
long starttime = (new Date()).getTime();
Matcher m = Pattern.compile("(\\S+);(\\d+)").matcher(Destination);
boolean completed = false;
if (OutFile.length() > IncommingProcessor.MaxPayload) {
logger.warn("Payload is too large!");
close();
... | static void sort(int[] a) {
int i = 0;
while (i < a.length - 1) {
int j = 0;
while (j < (a.length - i) - 1) {
if (a[j] > a[j + 1]) {
int aux = a[j];
a[j] = a[j + 1];
a[j + 1] = aux;
}
... | false |
897,540 | 12,013,963 | 23,029,916 | private void findRxnFileByUrl() throws MalformedURLException, IOException {
URL url = new URL(MessageFormat.format(rxnUrl, reactionId.toString()));
LOGGER.debug("Retrieving RXN file by URL " + url);
URLConnection con = url.openConnection(java.net.Proxy.NO_PROXY);
con.connect();
... | 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);... | false |
897,541 | 19,779,101 | 18,099,260 | protected void initGame() {
try {
for (File fonte : files) {
String absolutePath = outputDir.getAbsolutePath();
String separator = System.getProperty("file.separator");
String name = fonte.getName();
String destName = name.substring... | public String[][] getProjectTreeData() {
String[][] treeData = null;
String filename = dms_home + FS + "temp" + FS + username + "projects.xml";
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetProjects";
try {
String urldata = urlString + "?username... | true |
897,542 | 12,927,596 | 4,575,554 | public static void get_PK_data() {
try {
FileWriter file_writer = new FileWriter("xml_data/PK_data_dump.xml");
BufferedWriter file_buffered_writer = new BufferedWriter(file_writer);
URL fdt = new URL("http://opendata.5t.torino.it/get_pk");
URLConnection url_co... | private String readWebpage() {
BufferedReader in = null;
StringBuffer sb = new StringBuffer();
try {
URI uri = new URI("file:///www.vogella.de");
IProxyService proxyService = getProxyService();
IProxyData[] proxyDataForHost = proxyService.select(uri);
... | false |
897,543 | 7,408,304 | 432,090 | public static void main(String[] args) {
String u = "http://portal.acm.org/results.cfm?query=%28Author%3A%22" + "Boehm%2C+Barry" + "%22%29&srt=score%20dsc&short=0&source_disp=&since_month=&since_year=&before_month=&before_year=&coll=ACM&dl=ACM&termshow=matchboolean&range_query=&CFID=22704101&CFTOKEN=3782714... | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | false |
897,544 | 2,426,161 | 8,735,988 | public void readURL(URL url) throws IOException, ParserConfigurationException, SAXException {
URLConnection connection;
if (proxy == null) {
connection = url.openConnection();
} else {
connection = url.openConnection(proxy);
}
connection.setConnectTime... | public synchronized void readProject(URL url, boolean addMembers) throws IOException {
_url = url;
try {
readProject(url.openStream(), addMembers);
} catch (IOException e) {
Argo.log.info("Couldn't open InputStream in ArgoParser.load(" + url + ") " + e);
e... | false |
897,545 | 8,024,082 | 7,468,318 | public static void main(String[] args) throws Exception {
FileChannel fc = new FileOutputStream("data.txt").getChannel();
fc.write(ByteBuffer.wrap("Some text ".getBytes()));
fc.close();
fc = new RandomAccessFile("data.txt", "rw").getChannel();
fc.position(fc.size());
... | private List<Intrebare> citesteIntrebari() throws IOException {
ArrayList<Intrebare> intrebari = new ArrayList<Intrebare>();
try {
URL url = new URL(getCodeBase(), "../intrebari.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader((url.openStream())));
... | false |
897,546 | 18,519,248 | 22,221,713 | 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(... | private void copyFile(String sourceFilename, String targetFilename) throws IOException {
File source = new File(sourceFilename);
File target = new File(targetFilename);
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(target);
byte[] buf =... | false |
897,547 | 13,039,812 | 19,199,682 | public String getImageURL(String text) {
String imgURL = "";
try {
URL url = new URL("http://images.search.yahoo.com/search/images?p=" + URLEncoder.encode(text));
URLConnection connection = url.openConnection();
DataInputStream in = new DataInputStream(connection.... | public SimplePropertiesMessageRepository() {
properties = new Properties();
try {
URL url = SimplePropertiesIconRepository.class.getResource(PROPERTIES_FILE_NAME);
properties.load(url.openStream());
} catch (Exception e) {
throw new Error("Messages file no... | false |
897,548 | 19,147,301 | 10,387,508 | public boolean actualizarIdPartida(int idJugadorDiv, int idRonda, int idPartida) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET idPartida = " + idPartida + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRonda;
try {
... | public static void main(String[] args) {
final MavenDeployerGui gui = new MavenDeployerGui();
final Chooser repositoryChooser = new Chooser(gui.formPanel, JFileChooser.DIRECTORIES_ONLY);
final Chooser artifactChooser = new Chooser(gui.formPanel, JFileChooser.FILES_ONLY);
final Choose... | false |
897,549 | 266,990 | 16,378,626 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | public static void copy(String pstrFileFrom, String pstrFileTo) {
try {
FileChannel srcChannel = new FileInputStream(pstrFileFrom).getChannel();
FileChannel dstChannel = new FileOutputStream(pstrFileTo).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size(... | true |
897,550 | 15,971,793 | 10,682,592 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1.setEnabled(false);
for (int i = 0; i < max; i++) {
Card crd = WLP.getSelectedCard(WLP.jTable1.getSelectedRows()[i]);
String s, s2;
s = "";
s2 = "";
try {
... | private InputStream open(String url) throws IOException {
debug(url);
if (!useCache) {
return new URL(url).openStream();
}
File f = new File(System.getProperty("java.io.tmpdir", "."), Digest.SHA1.encrypt(url) + ".xml");
debug("Cache : " + f);
if (f.exists(... | false |
897,551 | 21,905,202 | 2,867,246 | private boolean hasPackageInfo(URL url) {
if (url == null) return false;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
if (line.starts... | public static void copyFile(File inputFile, File outputFile) throws IOException {
BufferedInputStream fr = new BufferedInputStream(new FileInputStream(inputFile));
BufferedOutputStream fw = new BufferedOutputStream(new FileOutputStream(outputFile));
byte[] buf = new byte[8192];
int n... | false |
897,552 | 550,697 | 2,199,598 | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | public static void copyFile(File file, String pathExport) throws IOException {
File out = new File(pathExport);
FileChannel sourceChannel = new FileInputStream(file).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sou... | true |
897,553 | 10,264,652 | 10,586,916 | protected void truncate(File file) {
LogLog.debug("Compression of file: " + file.getAbsolutePath() + " started.");
if (FileUtils.isFileOlder(file, ManagementFactory.getRuntimeMXBean().getStartTime())) {
File backupRoot = new File(getBackupDir());
if (!backupRoot.exists() && !... | public static void CreateBackupOfDataFile(String _src, String _dest) {
try {
File src = new File(_src);
File dest = new File(_dest);
if (new File(_src).exists()) {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
... | true |
897,554 | 11,319,480 | 9,530,015 | 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 main(String[] args) throws Throwable {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("cas", "cas file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("o", "output directory").longName("outputDir").isRequired(tru... | true |
897,555 | 8,384,813 | 345,995 | public void testExplicitHeaders() throws Exception {
String headerString = "X-Foo=bar&X-Bar=baz%20foo";
HttpRequest expected = new HttpRequest(REQUEST_URL).addHeader("X-Foo", "bar").addHeader("X-Bar", "baz foo");
expect(pipeline.execute(expected)).andReturn(new HttpResponse(RESPONSE_BODY));
... | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | false |
897,556 | 11,012,490 | 831,649 | private void execute(String file, String[] ebms, String[] eems, String[] ims, String[] efms) throws BuildException {
if (verbose) {
System.out.println("Preprocessing file " + file + " (type: " + type + ")");
}
try {
File targetFile = new File(file);
FileRe... | 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 |
897,557 | 743,718 | 19,861,528 | void loadPlaylist() {
if (running_as_applet) {
String s = null;
for (int i = 0; i < 10; i++) {
s = getParameter("jorbis.player.play." + i);
if (s == null) break;
playlist.addElement(s);
}
}
if (playlistfile =... | public static void getGroupsImage(String username) {
try {
URL url = new URL("http://www.lastfm.de/user/" + username + "/groups/");
URLConnection con = url.openConnection();
HashMap hm = new HashMap();
Parser parser = new Parser(con);
NodeList imag... | false |
897,558 | 13,680,335 | 12,821,749 | private String fetchCompareContent() throws IOException {
URL url = new URL(compareTo);
StringWriter sw = new StringWriter();
IOUtils.copy(url.openStream(), sw);
return sw.getBuffer().toString();
}
| public static void fastBackup(File file) {
FileChannel in = null;
FileChannel out = null;
FileInputStream fin = null;
FileOutputStream fout = null;
try {
in = (fin = new FileInputStream(file)).getChannel();
out = (fout = new FileOutputStream(file.getAb... | true |
897,559 | 11,904,056 | 9,096,317 | public static void convertEncoding(File infile, File outfile, String from, String to) throws IOException, UnsupportedEncodingException {
InputStream in;
if (infile != null) in = new FileInputStream(infile); else in = System.in;
OutputStream out;
outfile.createNewFile();
if (o... | private void handleNodeUp(long eventID, long nodeID, String eventTime) {
Category log = ThreadCategory.getInstance(OutageWriter.class);
if (eventID == -1 || nodeID == -1) {
log.warn(EventConstants.NODE_UP_EVENT_UEI + " ignored - info incomplete - eventid/nodeid: " + eventID + "/" + nodeI... | false |
897,560 | 15,260,218 | 519,787 | public static String md5Encode16(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes("utf-8"));
byte b[] = md.digest();
int i;
StringBuilder buf = new StringBuilder("");
for (int offset = 0; offse... | public InputStream unZip(URL url) throws Exception {
ZipInputStream zipped = new ZipInputStream(url.openStream());
System.out.println("unzipping: " + url.getFile());
ZipEntry zip = zipped.getNextEntry();
byte[] b = new byte[4096];
ByteArrayOutputStream bOut = new ByteArrayOut... | false |
897,561 | 6,226,270 | 9,353,181 | public static void copyFile(File in, File out) {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
... | JSONResponse execute() throws ServerException, RtmApiException, IOException {
HttpClient httpclient = new DefaultHttpClient();
URI uri;
try {
uri = new URI(this.request.getUrl());
HttpPost httppost = new HttpPost(uri);
HttpResponse response = httpclient.ex... | false |
897,562 | 20,644,476 | 13,498,121 | private static AtomContainer askForMovieSettings() throws IOException, QTException {
final InputStream inputStream = QuickTimeFormatGenerator.class.getResourceAsStream(REFERENCE_MOVIE_RESOURCE);
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream(1024 * 100);
IOUtils.copy(input... | public boolean validateLogin(String username, String password) {
boolean user_exists = false;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
String passwor... | false |
897,563 | 2,440,033 | 8,351,729 | public Blowfish(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA1");
digest.update(password.getBytes());
} catch (Exception e) {
System.out.println(e);
}
m_bfish = new BlowfishCBC(digest.digest()... | public void submitReport() {
String subject = m_Subject.getText();
String description = m_Description.getText();
String email = m_Email.getText();
if (subject.length() == 0) {
Util.flashComponent(m_Subject, Color.RED);
return;
}
if (description... | false |
897,564 | 9,806,167 | 12,524,506 | private ArrayList<IdLocation> doGet(String identifier) throws IdLocatorException {
String openurl = baseurl.toString() + "?url_ver=Z39.88-2004&rft_id=" + identifier;
URL url;
SRUSearchRetrieveResponse sru;
try {
url = new URL(openurl);
HttpURLConnection huc = ... | public static void copyFile(File in, File outDir) throws IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
File out = new File(outDir, in.getName());
destinati... | false |
897,565 | 20,651,942 | 5,697,523 | public synchronized void receive(MessageEvent e) {
switch(e.message.getType()) {
case MessageTypes.QUIT:
activeSessions--;
break;
case MessageTypes.SHUTDOWN_SERVER:
activeSessions--;
if (Options.password.trim().equals(""... | private static void fileUpload() throws Exception {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(postURL);
file = new File("h:\\Fantastic face.jpg");
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
... | false |
897,566 | 18,413,512 | 22,742,292 | public boolean save(String trxName) {
if (m_value == null || (!(m_value instanceof String || m_value instanceof byte[])) || (m_value instanceof String && m_value.toString().length() == 0) || (m_value instanceof byte[] && ((byte[]) m_value).length == 0)) {
StringBuffer sql = new StringBuffer("UPD... | private static void initMagicRules() {
InputStream in = null;
try {
String fname = System.getProperty("magic-mime");
if (fname != null && fname.length() != 0) {
in = new FileInputStream(fname);
if (in != null) {
parse("-Dmag... | false |
897,567 | 9,106,128 | 6,371,599 | protected long getUrlSize(String location) {
long returnValue = 0L;
try {
URL url = new URL(location);
java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection();
conn.setRequestMethod("HEAD");
returnValue = conn.getContentLeng... | public void addForwardAddress(final List<NewUser> forwardAddresses) {
try {
final List<Integer> usersToRemoveFromCache = new ArrayList<Integer>();
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, t... | false |
897,568 | 7,409,728 | 12,232,011 | protected void innerProcess(CrawlURI curi) throws InterruptedException {
if (!curi.isHttpTransaction()) {
return;
}
if (!TextUtils.matches("^text.*$", curi.getContentType())) {
return;
}
long maxsize = DEFAULT_MAX_SIZE_BYTES.longValue();
try {
... | 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... | false |
897,569 | 12,048,547 | 3,352,340 | public static void importDB(String input, String output) {
try {
Class.forName("org.sqlite.JDBC");
String fileName = output + File.separator + G.databaseName;
File dataBase = new File(fileName);
if (!dataBase.exists()) {
G.conn = DriverManager.... | public Long processAddCompany(Company companyBean, String userLogin, Long holdingId, AuthSession authSession) {
if (authSession == null) {
return null;
}
PreparedStatement ps = null;
DatabaseAdapter dbDyn = null;
try {
dbDyn = DatabaseAdapter.getInstan... | false |
897,570 | 23,398,709 | 20,432,135 | public ArrayList<Tweet> getTimeLine() {
try {
HttpGet get = new HttpGet("http://api.linkedin.com/v1/people/~/network/updates?scope=self");
consumer.sign(get);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
... | public void copyNIO(File in, File out) throws IOException {
FileInputStream inStream = null;
FileOutputStream outStream = null;
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
inStream = new FileInputStream(in);
outStream... | false |
897,571 | 3,850,809 | 17,662,157 | private void buildBundle() {
if (targetProject == null) {
MessageDialog.openError(getShell(), "Error", "No target SPAB project selected!");
return;
}
if (projectProcessDirSelector.getText().trim().length() == 0) {
MessageDialog.openError(getShell(), "Error... | public static void main(String[] argz) {
int X, Y, Z;
X = 256;
Y = 256;
Z = 256;
try {
String work_folder = "C:\\Documents and Settings\\Entheogen\\My Documents\\school\\jung\\vol_data\\CT_HEAD3";
FileOutputStream out_stream = new FileOutputStream(new ... | true |
897,572 | 8,990,219 | 13,812,091 | 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... | public static void copyFile(IPath fromFileName, IPath toFileName) throws IOException {
File fromFile = fromFileName.toFile();
File toFile = toFileName.toFile();
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | true |
897,573 | 11,275,834 | 6,634,379 | private void createHomeTab() {
Tabpanel homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, Msg.getMsg(EnvWeb.getCtx(), "Home").replaceAll("&", ""), false);
Portallayout portalLayout = new Portallayout();
portalLayout.setWidth("100%");
portalLayout.setHeight("100%");... | @Deprecated
public static void getAndProcessContents(String videoPageURL, int bufsize, String charset, Closure<String> process) throws IOException {
URL url = null;
HttpURLConnection connection = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader br... | true |
897,574 | 21,224,972 | 7,998,444 | public boolean update(int idJugador, jugador jugadorModificado) {
int intResult = 0;
String sql = "UPDATE jugador " + "SET apellidoPaterno = ?, apellidoMaterno = ?, nombres = ?, fechaNacimiento = ?, " + " pais = ?, rating = ?, sexo = ? " + " WHERE idJugador = " + idJugador;
try {
... | public static boolean isDicom(URL url) {
assert url != null;
boolean isDicom = false;
BufferedInputStream is = null;
try {
is = new BufferedInputStream(url.openStream());
is.skip(DICOM_PREAMBLE_SIZE);
byte[] buf = new byte[DICM.length];
... | false |
897,575 | 810,884 | 19,643,373 | 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 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 |
897,576 | 12,523,607 | 13,064,742 | public void render(ServiceContext serviceContext) throws Exception {
if (serviceContext.getTemplateName() == null) throw new Exception("no Template defined for service: " + serviceContext.getServiceInfo().getRefName());
File f = new File(serviceContext.getTemplateName());
serviceContext.getR... | public DataRecord addRecord(InputStream input) throws DataStoreException {
File temporary = null;
try {
temporary = newTemporaryFile();
DataIdentifier tempId = new DataIdentifier(temporary.getName());
usesIdentifier(tempId);
long length = 0;
... | true |
897,577 | 9,525,318 | 11,467,950 | private void copyFile(File in, File out) {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | public String getMediaURL(String strLink) {
try {
String res = de.nomule.mediaproviders.KeepVid.getAnswer(strLink, "aa");
if (NoMuleRuntime.DEBUG) System.out.println(res);
String regexp = "http:\\/\\/[^\"]+\\/get_video[^\"]+";
Pattern p = Pattern.compile(regex... | false |
897,578 | 12,909,291 | 7,507,773 | public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType(s_contentType);
response.setHeader("Cache-control", "no-cache");
InputStream graphStream = getGraphStream(request);
OutputStream out = getOutputStream(re... | 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 |
897,579 | 15,471,169 | 11,113,074 | public static String getMD5(String value) {
if (StringUtils.isBlank(value)) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes("UTF-8"));
return toHexString(md.digest());
} catch (Throwable e) {
ret... | public void backupXML() {
try {
TimeStamp timeStamp = new TimeStamp();
String fnameIn = this.fnameXML();
String pathBackup = this.pathXML + "\\Backup\\";
String fnameOut = fnameIn.substring(fnameIn.indexOf(this.fname), fnameIn.length());
fnameOut =... | false |
897,580 | 16,520,895 | 21,803,552 | public static String encodeFromFile(String filename) throws java.io.IOException, URISyntaxException {
String encodedData = null;
Base641.InputStream bis = null;
File file;
try {
URL url = new URL(filename);
URLConnection conn = url.openConnection();
... | public void doRender() throws IOException {
File file = new File(fileName);
if (!file.exists()) {
logger.error("Static resource not found: " + fileName);
isNotFound = true;
return;
}
if (fileName.endsWith("xml") || fileName.endsWith("asp")) servlet... | true |
897,581 | 13,955,716 | 1,907,167 | public static void copier(final File pFichierSource, final File pFichierDest) {
FileChannel vIn = null;
FileChannel vOut = null;
try {
vIn = new FileInputStream(pFichierSource).getChannel();
vOut = new FileOutputStream(pFichierDest).getChannel();
vIn.trans... | private void sendData(HttpServletResponse response, MediaBean mediaBean) throws IOException {
if (logger.isInfoEnabled()) logger.info("sendData[" + mediaBean + "]");
response.setContentLength(mediaBean.getContentLength());
response.setContentType(mediaBean.getContentType());
response... | true |
897,582 | 22,131,351 | 8,939,074 | private IMolecule readMolecule() throws Exception {
String xpath = "";
if (index.equals("ichi")) {
xpath = URLEncoder.encode("//molecule[./identifier/basic='" + query + "']", UTF8);
} else if (index.equals("kegg")) {
xpath = URLEncoder.encode("//molecule[./@name='" + ... | public RawTableData(int selectedId) {
selectedProjectId = selectedId;
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetProjectDocuments";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "documents.xml";
try {
S... | false |
897,583 | 20,885,480 | 2,105,651 | private void anneal(final float maxGamma, final float gammaAccel, final float objectiveTolerance, final float objectiveAccel, final float scoreTolerance, final float paramTolerance, final float distanceLimit, final float randomLimit, final long randomSeed, final BufferedDocuments<Phrase> references, final int n, fi... | public void process(String src, String dest) {
try {
KanjiDAO kanjiDAO = KanjiDAOFactory.getDAO();
MorphologicalAnalyzer mecab = MorphologicalAnalyzer.getInstance();
if (mecab.isActive()) {
BufferedReader br = new BufferedReader(new InputStreamReader(new F... | true |
897,584 | 8,859,873 | 14,289,588 | private void mergeOne(String level, char strand, String filename, Path outPath, FileSystem srcFS, FileSystem dstFS, Timer to) throws IOException {
to.start();
final OutputStream outs = dstFS.create(new Path(outPath, filename));
final FileStatus[] parts = srcFS.globStatus(new Path(sorted ? ge... | @Override
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException {
if ((baseName == null) || (locale == null) || (format == null) || (loader == null)) {
throw new Nu... | false |
897,585 | 17,831,556 | 17,426,486 | public static String generateHash(String msg) throws NoSuchAlgorithmException {
if (msg == null) {
throw new IllegalArgumentException("Input string can not be null");
}
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(msg.getBytes());
... | public String encrypt(String pwd) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
System.out.println("Error");
}
try {
md5.update(pwd.getBytes... | true |
897,586 | 20,692,111 | 16,851,953 | public void gzip(File from, File to) {
OutputStream out_zip = null;
ArchiveOutputStream os = null;
try {
try {
out_zip = new FileOutputStream(to);
os = new ArchiveStreamFactory().createArchiveOutputStream("zip", out_zip);
os.putArch... | @Test
public void testTrainingDefault() throws IOException {
File temp = File.createTempFile("fannj_", ".tmp");
temp.deleteOnExit();
IOUtils.copy(this.getClass().getResourceAsStream("xor.data"), new FileOutputStream(temp));
List<Layer> layers = new ArrayList<Layer>();
lay... | true |
897,587 | 10,177,034 | 12,980,227 | public static synchronized BaseFont getL2BaseFont() {
if (l2baseFont == null) {
final ConfigProvider conf = ConfigProvider.getInstance();
try {
final ByteArrayOutputStream tmpBaos = new ByteArrayOutputStream();
String fontPath = conf.getNotEmptyPropert... | public void copy(File src, File dest) throws FileNotFoundException, IOException {
FileInputStream srcStream = new FileInputStream(src);
FileOutputStream destStream = new FileOutputStream(dest);
FileChannel srcChannel = srcStream.getChannel();
FileChannel destChannel = destStream.getC... | true |
897,588 | 14,638,788 | 5,634,854 | public static InputStream openURL(String url, ConnectData data) {
try {
URLConnection con = new URL(url).openConnection();
con.setConnectTimeout(TIMEOUT);
con.setReadTimeout(TIMEOUT);
con.setUseCaches(false);
con.setRequestProperty("Accept-Charset"... | private static void checkClients() {
try {
sendMultiListEntry('l');
} catch (Exception e) {
if (Util.getDebugLevel() > 90) e.printStackTrace();
}
try {
if (CANT_CHECK_CLIENTS != null) KeyboardHero.removeStatus(CANT_CHECK_CLIENTS);
URL u... | false |
897,589 | 10,473,584 | 8,544,627 | public ValidationReport validate(OriginalDeployUnitDescription unit) throws UnitValidationException {
ValidationReport vr = new DefaultValidationReport();
errorHandler = new SimpleErrorHandler(vr);
vr.setFileUri(unit.getAbsolutePath());
SAXParser parser;
SAXReader reader = nu... | @Override
protected void copyContent(String filename) throws IOException {
InputStream in = null;
try {
in = LOADER.getResourceAsStream(RES_PKG + filename);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, o... | true |
897,590 | 5,036,265 | 5,567,860 | public void save() throws IOException {
CodeTimer saveTimer;
if (!dirty) {
return;
}
saveTimer = new CodeTimer("PackedFile.save");
saveTimer.setEnabled(log.isDebugEnabled());
File newFile = new File(tmpDir.getAbsolutePath() + "/" + new GUID() + ".pak");
... | public String getClass(EmeraldjbBean eb) throws EmeraldjbException {
Entity entity = (Entity) eb;
StringBuffer sb = new StringBuffer();
String myPackage = getPackageName(eb);
sb.append("package " + myPackage + ";\n");
sb.append("\n");
DaoValuesGenerator valgen = new D... | true |
897,591 | 5,439,181 | 11,358,360 | private String hash(String text) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);
}
| private boolean readRemoteFile() {
InputStream inputstream;
Concept concept = new Concept();
try {
inputstream = url.openStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(... | false |
897,592 | 13,026,685 | 10,912,336 | 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 void verRecordatorio() {
try {
cantidadArchivos = obtenerCantidad() + 1;
boolean existe = false;
String filenametxt = "";
String filenamezip = "";
String hora = "";
String lugar = "";
String actividad = "";
... | true |
897,593 | 4,928,349 | 16,083,957 | private static String getHashString(String text, String algorithm) throws NoSuchAlgorithmException, UnsupportedEncodingException {
AssertUtility.notNull(text);
AssertUtility.notNullAndNotSpace(algorithm);
MessageDigest md;
md = MessageDigest.getInstance(algorithm);
md.update(... | protected void createValueListAnnotation(IProgressMonitor monitor, IPackageFragment pack, Map model) throws CoreException {
IProject pj = pack.getJavaProject().getProject();
QualifiedName qn = new QualifiedName(JstActivator.PLUGIN_ID, JstActivator.PACKAGE_INFO_LOCATION);
String location = pj... | false |
897,594 | 22,135,201 | 9,510,692 | public void testCodingFromFileSmaller() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);... | public static void main(String[] args) {
try {
boolean readExp = Utils.getFlag('l', args);
final boolean writeExp = Utils.getFlag('s', args);
final String expFile = Utils.getOption('f', args);
if ((readExp || writeExp) && (expFile.length() == 0)) {
... | true |
897,595 | 9,295,754 | 21,264,253 | public static String encryptPassword(String password) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("SHA1");
digest.update(password.getBytes("UTF-8"));
byte[] hash = digest.digest();
StringBuffer buf = new StringBuffer();
f... | public static String calculate(String str) {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(str.getBytes());
byte byteData[] = md.digest();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < byteData.l... | true |
897,596 | 20,953,665 | 21,361,961 | private void packageDestZip(File tmpFile) throws FileNotFoundException, IOException {
log("Creating launch profile package " + destfile);
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destfile)));
ZipEntry e = new ZipEntry(RESOURCE_JAR_FILENAME);
... | private void transform(CommandLine commandLine) throws IOException {
Reader reader;
if (commandLine.hasOption('i')) {
reader = createFileReader(commandLine.getOptionValue('i'));
} else {
reader = createStandardInputReader();
}
Writer writer;
if... | true |
897,597 | 2,386,120 | 9,186,576 | @Override
public void setContentAsStream(InputStream input) throws IOException {
BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(htmlFile));
try {
IOUtils.copy(input, output);
} finally {
output.close();
}
if (this.getLa... | public static void copyFile(File file, String pathExport) throws IOException {
File out = new File(pathExport);
FileChannel sourceChannel = new FileInputStream(file).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sou... | true |
897,598 | 14,167,175 | 10,656,323 | public static void readAsFile(String fileName, String url) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
URLConnection conn = null;
try {
conn = new URL(url).openConnection();
conn.setDoInput(true);
in = new BufferedInputStream(... | public void copy(File s, File t) throws IOException {
FileChannel in = (new FileInputStream(s)).getChannel();
FileChannel out = (new FileOutputStream(t)).getChannel();
in.transferTo(0, s.length(), out);
in.close();
out.close();
}
| false |
897,599 | 19,340,058 | 17,682,090 | public String fetchStockCompanyName(Stock stock) {
String companyName = "";
String symbol = StockUtil.getStock(stock);
if (isStockCached(symbol)) {
return getStockFromCache(symbol);
}
String url = NbBundle.getMessage(MrSwingDataFeed.class, "MrSwingDataFeed.stockIn... | public Reader transform(Reader reader, Map<String, Object> parameterMap) {
try {
File file = File.createTempFile("srx2", ".srx");
file.deleteOnExit();
Writer writer = getWriter(getFileOutputStream(file.getAbsolutePath()));
transform(reader, writer, parameterMa... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.