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 |
|---|---|---|---|---|---|
5,500 | 21,273,059 | 21,642,217 | public RobotList<Location> sort_incr_Location(RobotList<Location> list, String field) {
int length = list.size();
Index_value[] enemy_dist = new Index_value[length];
Location cur_loc = this.getLocation();
for (int i = 0; i < length; i++) {
enemy_dist[i] = new Index_value(... | private String searchMetabolite(String name) {
{
BufferedReader in = null;
try {
String urlName = name;
URL url = new URL(urlName);
in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
... | false |
5,501 | 19,842,959 | 14,629,480 | public boolean receiveFile(FileDescriptor fileDescriptor) {
try {
byte[] block = new byte[1024];
int sizeRead = 0;
int totalRead = 0;
File dir = new File(Constants.DOWNLOAD_DIR + fileDescriptor.getLocation());
if (!dir.exists()) {
d... | public static String getHashedStringMD5(String value) throws java.security.NoSuchAlgorithmException {
java.security.MessageDigest d = java.security.MessageDigest.getInstance("MD5");
d.reset();
d.update(value.getBytes());
byte[] buf = d.digest();
return new String(buf);
}
| false |
5,502 | 9,325,670 | 15,168,184 | public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in... | public void copyServer(int id) throws Exception {
File in = new File("servers" + File.separatorChar + "server_" + id);
File serversDir = new File("servers" + File.separatorChar);
int newNumber = serversDir.listFiles().length + 1;
System.out.println("New File Number: " + newNumber);
... | true |
5,503 | 16,116,703 | 11,961,013 | private void save() {
int[] selection = list.getSelectionIndices();
String dir = System.getProperty("user.dir");
for (int i = 0; i < selection.length; i++) {
File src = files[selection[i]];
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFil... | public static Builder fromURL(URL url) {
try {
InputStream in = null;
try {
in = url.openStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int read = -1;
byte[] buf = new byte[4096];
whi... | false |
5,504 | 10,520,135 | 20,183,892 | public RegionInfo(String name, int databaseID, int units, float xMin, float xMax, float yMin, float yMax, float zMin, float zMax, String imageURL) {
this.name = name;
this.databaseID = databaseID;
this.units = units;
this.xMin = xMin;
this.xMax = xMax;
this.yMin = yMi... | @Override
public String encryptString(String passphrase, String message) throws Exception {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(passphrase.getBytes("UTF-8"));
byte digest[] = md.digest();
String digestString = base64encode(digest);
S... | true |
5,505 | 11,142,914 | 22,913,402 | private boolean copyAvecProgressNIO(File sRC2, File dEST2, JProgressBar progressEnCours) throws IOException {
boolean resultat = false;
FileInputStream fis = new FileInputStream(sRC2);
FileOutputStream fos = new FileOutputStream(dEST2);
java.nio.channels.FileChannel channelSrc = fis.... | protected Properties load(URL url) {
try {
InputStream i = url.openStream();
Properties p = new Properties();
p.load(i);
i.close();
return p;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
| false |
5,506 | 21,144,775 | 21,518,266 | public static void main(String[] args) {
String logConfiguration = args[2];
DOMConfigurator.configure(logConfiguration);
String urlToRun = args[0];
String outputFile = args[1];
InputStream conInput = null;
BufferedReader reader = null;
BufferedWriter writer = ... | public void initGet() throws Exception {
cl = new DefaultHttpClient();
GetAuthPromter hp = new GetAuthPromter();
cl.setCredentialsProvider(hp);
get = new HttpGet(getURL());
get.setHeader("User-Agent", "test");
get.setHeader("Accept", "*/*");
get.setHeader("Ran... | false |
5,507 | 9,856,200 | 3,318,214 | public static void copyFile(File srcFile, File destFolder) {
try {
File destFile = new File(destFolder, srcFile.getName());
if (destFile.exists()) {
throw new BuildException("Could not copy " + srcFile + " to " + destFolder + " as " + destFile + " already exists");
... | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | true |
5,508 | 7,110,627 | 11,228,284 | void loadListFile(String listFileName, String majorType, String minorType, String languages, String annotationType) throws MalformedURLException, IOException {
Lookup defaultLookup = new Lookup(listFileName, majorType, minorType, languages, annotationType);
URL lurl = new URL(listsURL, listFileName)... | public static boolean copy(File src, File dest) {
boolean result = true;
String files[] = null;
if (src.isDirectory()) {
files = src.list();
result = dest.mkdir();
} else {
files = new String[1];
files[0] = "";
}
if (fil... | false |
5,509 | 20,544,327 | 12,222,321 | public static void copyFile(File fileIn, File fileOut) throws IOException {
FileChannel chIn = new FileInputStream(fileIn).getChannel();
FileChannel chOut = new FileOutputStream(fileOut).getChannel();
try {
chIn.transferTo(0, chIn.size(), chOut);
} catch (IOException e) {... | 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);
... | true |
5,510 | 22,560,734 | 20,753,922 | public void reademi(Vector<String> descriptions, Vector<String> links, String linkaddress, String idmap) {
InputStream is = null;
URL url;
ArrayList<String> keys = new ArrayList<String>();
ArrayList<String> names = new ArrayList<String>();
try {
url = new URL(idma... | public void doImport(File f, boolean checkHosp) throws Exception {
connector.getConnection().setAutoCommit(false);
File base = f.getParentFile();
ZipInputStream in = new ZipInputStream(new FileInputStream(f));
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
... | false |
5,511 | 16,053,989 | 15,311,522 | public static Collection providers(Class service, ClassLoader loader) {
List classList = new ArrayList();
List nameSet = new ArrayList();
String name = "META-INF/services/" + service.getName();
Enumeration services;
try {
services = (loader == null) ? ClassLoader.... | public String buscaCDE() {
URL url;
Properties prop = new CargaProperties().Carga();
BufferedReader in;
String inputLine;
String miLinea = null;
try {
url = new URL(prop.getProperty("CDE"));
in = new BufferedReader(new InputStreamReader(url.ope... | true |
5,512 | 15,904,654 | 17,025,298 | protected static DynamicJasperDesign generateJasperDesign(DynamicReport dr) throws CoreException {
DynamicJasperDesign jd = null;
try {
if (dr.getTemplateFileName() != null) {
log.info("loading template file: " + dr.getTemplateFileName());
log.info("Attemp... | public static String createMD5(String str) {
String sig = null;
String strSalt = str + StaticBox.getsSalt();
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(strSalt.getBytes(), 0, strSalt.length());
byte byteData[] = md5.digest();
... | false |
5,513 | 5,746,377 | 1,543,361 | @Override
public JSONObject runCommand(JSONObject payload, HttpSession session) throws DefinedException {
String sessionId = session.getId();
log.debug("Login -> runCommand SID: " + sessionId);
JSONObject toReturn = new JSONObject();
boolean isOK = true;
String username =... | public ProgramSymbol createNewProgramSymbol(int programID, String module, String symbol, int address, int size) throws AdaptationException {
ProgramSymbol programSymbol = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
... | false |
5,514 | 20,383,335 | 2,090,333 | @Override
public boolean checkConnection() {
int status = 0;
try {
URL url = new URL(TupeloProxy.endpoint);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
status = conn.getResponseCode();
} catch (Exception e) {
logger.s... | private static byte[] tryLoadFile(String path) throws IOException {
InputStream in = new FileInputStream(path);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, out);
in.close();
out.close();
return out.toByteArray();
}
| false |
5,515 | 22,082,121 | 8,143,636 | 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... | public boolean validatePassword(UserType nameMatch, String password) {
try {
MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM);
md.reset();
md.update(nameMatch.getSalt().getBytes("UTF-8"));
md.update(password.getBytes("UTF-8"));
String e... | true |
5,516 | 6,692,645 | 14,227,490 | public LOCKSSDaemonStatusTableTO getDataFromDaemonStatusTableByHttps() throws HttpResponseException {
LOCKSSDaemonStatusTableXmlStreamParser ldstxp = null;
LOCKSSDaemonStatusTableTO ldstTO = null;
HttpEntity entity = null;
HttpGet httpget = null;
xstream.setMode(XStream.NO_RE... | private HttpURLConnection getConnection(String url, int connTimeout, int readTimeout) throws IOException {
HttpURLConnection con = null;
con = (HttpURLConnection) new URL(url).openConnection();
if (connTimeout > 0) {
if (!isJDK14orEarlier) {
con.setConnectTimeout(... | false |
5,517 | 10,332,951 | 1,427,084 | public static void loginSkyDrive() throws Exception {
System.out.println("login ");
u = new URL(loginurl);
uc = (HttpURLConnection) u.openConnection();
uc.setRequestProperty("Cookie", msprcookie + ";" + mspokcookie);
uc.setDoOutput(true);
uc.setRequestMethod("POST");
... | public RecordIterator get(URL url) {
RecordIterator recordIter = null;
if (!SUPPORTED_PROTOCOLS.contains(url.getProtocol().toLowerCase())) {
return null;
}
try {
URL robotsUrl = new URL(url, ROBOTS_TXT);
recordIter = new RecordIterator(urlInputStre... | false |
5,518 | 18,880,062 | 23,677,117 | public static boolean compress(ArrayList sources, File target, Manifest manifest) {
try {
if (sources == null || sources.size() == 0) return false;
if (target.exists()) target.delete();
ZipOutputStream output = null;
boolean isJar = target.getName().toLowerCas... | public static void copyFile4(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
IOUtils.copy(in, out);
in.close();
out.close();
}
| true |
5,519 | 10,685,269 | 19,900,641 | public static void copy(FileInputStream source, FileOutputStream target) throws IOException {
FileChannel sourceChannel = source.getChannel();
FileChannel targetChannel = target.getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChannel);
sourceChannel.close();
... | public static boolean copyFile(String src, String dst) {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(new File(src)).getChannel();
outChannel = new FileOutputStream(new File(dst)).getChannel();
inChanne... | true |
5,520 | 18,695,230 | 15,143,217 | public static synchronized String encrypt(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
return new Base64(-1).encodeToString(raw);
}
| @Override
public String getMD5(String host) {
String res = "";
Double randNumber = Math.random() + System.currentTimeMillis();
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(randNumber.toString().g... | true |
5,521 | 10,287,986 | 725,986 | 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 writeToFtp(String login, String password, String address, String directory, String filename) {
String newline = System.getProperty("line.separator");
try {
URL url = new URL("ftp://" + login + ":" + password + "@ftp." + address + directory + filename + ".html" + ";type=i");
... | false |
5,522 | 22,677,813 | 9,265,781 | @Override
public Class<?> loadClass(final String name) throws ClassNotFoundException {
final String baseName = StringUtils.substringBefore(name, "$");
if (baseName.startsWith("java") && !whitelist.contains(baseName) && !additionalWhitelist.contains(baseName)) {
th... | public static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("FileCopy: no such source file: " + from_name);
if (!from_file.isFile()) abort("FileCopy: can't copy d... | true |
5,523 | 7,460,369 | 11,821,056 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.B64InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base... | private void constructDialogContent(Composite parent) {
SashForm splitter = new SashForm(parent, SWT.HORIZONTAL);
splitter.setLayoutData(new GridData(GridData.FILL_BOTH));
Group fragmentsGroup = new Group(splitter, SWT.NONE);
fragmentsGroup.setLayout(new GridLayout(1, false));
... | false |
5,524 | 15,328,073 | 6,641,463 | public static byte[] 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();
... | private void LoadLoginInfo() {
m_PwdList.removeAllElements();
String szTemp = null;
int iIndex = 0;
int iSize = m_UsrList.size();
for (int i = 0; i < iSize; i++) m_PwdList.add("");
try {
if ((m_UsrList.size() > 0) && m_bSavePwd) {
char[] MD... | true |
5,525 | 7,952,921 | 16,946,193 | public static OutputStream getOutputStream(String path) throws ResourceException {
URL url = getURL(path);
if (url != null) {
try {
return url.openConnection().getOutputStream();
} catch (IOException e) {
throw new ResourceException(e);
... | public void deploy(final File extension) {
log.info("Deploying new extension from {}", extension.getPath());
RequestContextHolder.setRequestContext(new RequestContext(SZoneConfig.getDefaultZoneName(), SZoneConfig.getAdminUserName(SZoneConfig.getDefaultZoneName()), new BaseSessionContext()));
... | false |
5,526 | 15,999,201 | 10,426,070 | @Override
public void downloadByUUID(final UUID uuid, final HttpServletRequest request, final HttpServletResponse response) throws IOException {
if (!exportsInProgress.containsKey(uuid)) {
throw new IllegalStateException("No download with UUID: " + uuid);
}
final File compres... | public static long copy(File src, long amount, File dst) {
final int BUFFER_SIZE = 1024;
long amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputS... | true |
5,527 | 1,931,704 | 17,726,029 | private EventSeries<PhotoEvent> loadIncomingEvents(long reportID) {
EventSeries<PhotoEvent> events = new EventSeries<PhotoEvent>();
try {
URL url = new URL(SERVER_URL + XML_PATH + "reports.csv");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(... | private String getRandomGUID(final boolean secure) {
MessageDigest md5 = null;
final StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
... | false |
5,528 | 18,845,280 | 21,870,537 | public static void readFile(FOUserAgent ua, String uri, OutputStream output) throws IOException {
InputStream in = getURLInputStream(ua, uri);
try {
IOUtils.copy(in, output);
} finally {
IOUtils.closeQuietly(in);
}
}
| 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 |
5,529 | 14,956,753 | 5,040,724 | public void execute(HttpResponse response) throws HttpException, IOException {
StringBuffer content = new StringBuffer();
NodeSet allNodes = membershipRegistry.listAllMembers();
for (Node node : allNodes) {
content.append(node.getId().toString());
content.append(Syste... | public Document parse(Document document) {
CSSCompilerBuilder compilerBuilder = new CSSCompilerBuilder();
StyleSheetCompilerFactory compilerFactory = getStyleSheetCompilerFactory();
compilerBuilder.setStyleSheetCompilerFactory(compilerFactory);
CSSCompiler cssCompiler = compilerBuild... | false |
5,530 | 505,090 | 4,959,517 | public static void main(String[] args) {
URL url = null;
EventHeap eh = new EventHeap("iw-room2");
Event newEvent;
float chan1 = -1, chan2 = -1;
try {
url = new URL("http://iw--bluetooth-ap/cgi-bin/sens.cgi");
} catch (MalformedURLException e) {
}
... | public static String openldapDigestMd5(final String password) {
String base64;
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(password.getBytes());
base64 = fr.cnes.sitools.util.Base64.encodeBytes(digest.digest());
} catch (No... | false |
5,531 | 22,900,234 | 9,481,276 | 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();
... | public void save(InputStream is) throws IOException {
File dest = Config.getDataFile(getInternalDate(), getPhysMessageID());
OutputStream os = null;
try {
os = new FileOutputStream(dest);
IOUtils.copyLarge(is, os);
} finally {
IOUtils.closeQuietly(... | false |
5,532 | 18,785,060 | 8,511,446 | public static NotaFiscal insert(NotaFiscal objNF) {
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
int result;
if (c == null) {
return null;
}
if (objNF == null) {
return null;
}
try {
... | protected static void download(FtpSiteConnector connector, File localFile, String remotePath, final IProgressMonitor monitor) throws FtpException {
if (!localFile.exists()) {
FTPClient ftp = new FTPClient();
try {
FTPClientConfig conf = new FTPClientConfig(FTPClientCo... | false |
5,533 | 14,263,421 | 18,748,953 | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | private static String appletLoad(String file, Output OUT) {
if (!urlpath.endsWith("/")) {
urlpath += '/';
}
if (!urlpath.startsWith("http://")) {
urlpath = "http://" + urlpath;
}
String url = "";
if (file.equals("languages.txt")) {
... | false |
5,534 | 1,158,841 | 1,856,912 | public static int gzipFile(File file_input, String file_output) {
File gzip_output = new File(file_output);
GZIPOutputStream gzip_out_stream;
try {
FileOutputStream out = new FileOutputStream(gzip_output);
gzip_out_stream = new GZIPOutputStream(new BufferedOutputStrea... | public static boolean predictDataSet(String completePath, String Type, String predictionOutputFileName, String CFDataFolderName) {
try {
if (Type.equalsIgnoreCase("Qualifying")) {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + "CompleteQualifyingDataInByteF... | true |
5,535 | 14,475,614 | 2,103,971 | @SuppressWarnings("unchecked")
public static <T extends Class> Collection<T> listServices(T serviceType, ClassLoader classLoader) throws IOException, ClassNotFoundException {
final Collection<T> result = new LinkedHashSet<T>();
final Enumeration<URL> resouces = classLoader.getResources("META-INF... | @Override
protected void writeFile() {
super.writeFile();
try {
String tagListFilePath = file.toURI().toASCIIString();
tagListFilePath = tagListFilePath.substring(0, tagListFilePath.lastIndexOf(FileManager.GLIPS_VIEW_EXTENSION)) + FileManager.TAG_LIST_FILE_EXTENSION;
... | false |
5,536 | 1,015,744 | 23,035,538 | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
try {
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel... | public static void main(String[] args) {
try {
String user = "techbeherca";
String targetUrl = "http://api.fanfou.com/statuses/user_timeline.xml?id=" + user;
URL url = new URL(targetUrl);
InputStream in = url.openStream();
ArrayList<MessageObj> lis... | false |
5,537 | 4,798,352 | 18,506,484 | public static void readProperties() throws IOException {
URL url1 = cl.getResource("conf/soapuddi.config");
Properties props = new Properties();
if (url1 == null) throw new IOException("soapuddi.config not found");
props.load(url1.openStream());
className = props.getProperty(... | private int addPollToDB(DataSource database) {
int pollid = -2;
Connection con = null;
try {
con = database.getConnection();
con.setAutoCommit(false);
String add = "insert into polls" + " values( ?, ?, ?, ?)";
PreparedStatement prepStatement = ... | false |
5,538 | 14,711,178 | 4,970,523 | private Response doLoad(URL url, URL referer, String postData) throws IOException {
URLConnection connection = PROXY == null ? url.openConnection() : url.openConnection(PROXY);
COOKIES.writeCookies(connection);
connection.setRequestProperty("User-Agent", USER_AGENT);
if (referer != n... | @Override
public void execute(JobExecutionContext context) throws JobExecutionException {
super.execute(context);
debug("Start execute job " + this.getClass().getName());
String dir = this.path_app_root + "/" + this.properties.get("dir") + "/";
try {
File dir_f = new ... | false |
5,539 | 19,033,605 | 8,204,995 | public static void copyFile(File src, File dest) throws IOException {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
FileChannel channelSrc = fis.getChannel();
FileChannel channelDest = fos.getChannel();
channelSrc.transferT... | public List<Template> getTemplates(boolean fromPrivate) {
String shared = fromPrivate ? "private" : "public";
List<Template> templates = new ArrayList<Template>();
String restURL = configuration.getBeehiveRESTRootUrl() + "account/" + userService.getAccount().getOid() + "/templates/" + shared... | false |
5,540 | 18,327,511 | 5,166,269 | public static void main(String[] args) throws Exception {
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(new AuthScope("localhost", 80), new UsernamePasswordCredentials("username", "password"));
BasicHttpContext localcontext = new B... | public void render(ParagraphElement cnt, double x, double y, Graphics2D g, LayoutingContext layoutingContext, FlowContext flowContext) {
InlineImageContent ic = (InlineImageContent) cnt;
try {
URLConnection urlConn = ic.getUrl().openConnection();
urlConn.setConnectTimeout(150... | false |
5,541 | 8,267,306 | 12,440,171 | public void testWriteThreadsNoCompression() throws Exception {
Bootstrap bootstrap = new Bootstrap();
bootstrap.loadProfiles(CommandLineProcessorFactory.PROFILE.DB, CommandLineProcessorFactory.PROFILE.REST_CLIENT, CommandLineProcessorFactory.PROFILE.COLLECTOR);
final LocalLogFileWriter write... | public void writeFile(String resource, InputStream is) throws IOException {
File f = prepareFsReferenceAsFile(resource);
FileOutputStream fos = new FileOutputStream(f);
BufferedOutputStream bos = new BufferedOutputStream(fos);
try {
IOUtils.copy(is, bos);
} finall... | true |
5,542 | 4,897,872 | 22,627,884 | protected int executeUpdates(List<UpdateStatement> statements, OlVersionCheck olVersionCheck) throws DaoException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("start executeUpdates");
}
PreparedStatement stmt = null;
Connection conn = null;
int rowsAffected = 0;
... | private <T> Collection<T> loadProviders(final Class<T> providerClass) throws ModelException {
try {
final String providerNamePrefix = providerClass.getName() + ".";
final Map<String, T> providers = new TreeMap<String, T>(new Comparator<String>() {
public int compare(... | false |
5,543 | 8,801,744 | 692,680 | public static void copyFile(File src, File dest, boolean force) throws IOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file: " + dest);
}
}
byte[] buff... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | true |
5,544 | 17,076,233 | 2,210,700 | private void unzipResource(final String resourceName, final File targetDirectory) throws IOException {
final URL resource = this.getClass().getResource(resourceName);
assertNotNull("Expected '" + resourceName + "' not found.", resource);
assertTrue(targetDirectory.isAbsolute());
File... | private String hash(String message) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new AssertionError("Can't find the SHA1 algorithm in the java.security package");
}
String saltStr... | false |
5,545 | 2,381,662 | 4,932,279 | @Test(expected = GadgetException.class)
public void malformedGadgetSpecThrows() throws Exception {
HttpRequest request = createIgnoreCacheRequest();
expect(pipeline.execute(request)).andReturn(new HttpResponse("malformed junk"));
replay(pipeline);
specFactory.getGadgetSpec(create... | 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++) {
PreparedStatement pstmt = con.prepareStatement("INSER... | false |
5,546 | 3,567,576 | 8,515,616 | protected static String md5(String s) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes());
byte digest[] = md.digest();
StringBuffer result = new StringBuffer();
for (int i = 0; i < digest.length; i++) {
result.append(In... | public ResponseStatus nowPlaying(String artist, String track, String album, int length, int tracknumber) throws IOException {
if (sessionId == null) throw new IllegalStateException("Perform successful handshake first.");
String b = album != null ? encode(album) : "";
String l = length == -1 ... | false |
5,547 | 16,063,556 | 7,386,971 | public static String md(String passwd) {
MessageDigest md5 = null;
String digest = passwd;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(passwd.getBytes());
byte[] digestData = md5.digest();
digest = byteArrayToHex(digestData);
... | public String hash(String senha) {
String result = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(senha.getBytes());
byte[] hashMd5 = md.digest();
for (int i = 0; i < hashMd5.length; i++) result += Integer.toHexString((((hashM... | true |
5,548 | 22,312,282 | 9,840,907 | 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 final void copyFile(File source, File destination) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel targetChannel = new FileOutputStream(destination).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChan... | false |
5,549 | 17,231,006 | 14,661,394 | @Override
public String transformSingleFile(X3DEditorSupport.X3dEditor xed) {
Node[] node = xed.getActivatedNodes();
X3DDataObject dob = (X3DDataObject) xed.getX3dEditorSupport().getDataObject();
FileObject mySrc = dob.getPrimaryFile();
File mySrcF = FileUtil.toFile(mySrc);
... | public void run() {
XmlFilesFilter filter = new XmlFilesFilter();
String pathTemp = Settings.get("vo_store.databaseMetaCollection");
String sectionName = pathTemp.substring(1, pathTemp.indexOf("/", 2));
String templateName = VOAccess.getElementByName(settingsDB, "TEMPLATE", sectionNa... | true |
5,550 | 10,432,997 | 15,311,522 | private static void copy(File source, File dest) throws FileNotFoundException, IOException {
FileInputStream input = new FileInputStream(source);
FileOutputStream output = new FileOutputStream(dest);
System.out.println("Copying " + source + " to " + dest);
IOUtils.copy(input, output)... | public String buscaCDE() {
URL url;
Properties prop = new CargaProperties().Carga();
BufferedReader in;
String inputLine;
String miLinea = null;
try {
url = new URL(prop.getProperty("CDE"));
in = new BufferedReader(new InputStreamReader(url.ope... | false |
5,551 | 13,586,003 | 15,984,793 | public ObservationResult[] call(String url, String servicename, String srsname, String version, String offering, String observed_property, String responseFormat) {
System.out.println("GetObservationBasic.call url " + url);
URL service = null;
URLConnection connection = null;
ArrayLis... | public InputStream getPage(String page) throws IOException {
URL url = new URL(hattrickServerURL + "/Common/" + page);
HttpURLConnection huc = (HttpURLConnection) url.openConnection();
huc.setRequestProperty("Cookie", sessionCookie);
return huc.getInputStream();
}
| false |
5,552 | 18,170,211 | 18,731,269 | static List<String> readZipFilesOftypeToFolder(String zipFileLocation, String outputDir, String fileType) {
List<String> list = new ArrayList<String>();
ZipFile zipFile = readZipFile(zipFileLocation);
FileOutputStream output = null;
InputStream inputStream = null;
Enumeration... | public static SpeciesTree create(String url) throws IOException {
SpeciesTree tree = new SpeciesTree();
tree.setUrl(url);
System.out.println("Fetching URL: " + url);
BufferedReader in = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
String toParse = nu... | false |
5,553 | 15,537,156 | 316,912 | 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();
... | 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 |
5,554 | 21,322,699 | 3,854,738 | public void zipUp() throws PersistenceException {
ZipOutputStream out = null;
try {
if (!backup.exists()) backup.createNewFile();
out = new ZipOutputStream(new FileOutputStream(backup));
out.setLevel(Deflater.DEFAULT_COMPRESSION);
for (String file : ba... | public void loadProperties() throws IOException {
File file = new File(filename);
URL url = file.toURI().toURL();
Properties temp = new Properties();
temp.load(url.openStream());
Point2d start = new Point2d();
Point2d end = new Point2d();
if (temp.getProperty(... | false |
5,555 | 22,423,727 | 17,907,353 | public void copyFile(String source_file_path, String destination_file_path) {
FileWriter fw = null;
FileReader fr = null;
BufferedReader br = null;
BufferedWriter bw = null;
File source = null;
try {
fr = new FileReader(source_file_path);
fw = ... | public static void resourceToFile(final String resource, final String filePath) throws IOException {
log.debug("Classloader is " + IOCopyUtils.class.getClassLoader());
InputStream in = IOCopyUtils.class.getResourceAsStream(resource);
if (in == null) {
log.warn("Resource not '" + ... | true |
5,556 | 7,466,372 | 3,229,363 | public void save(UploadedFile file, Long student, Long activity) {
File destiny = new File(fileFolder, student + "_" + activity + "_" + file.getFileName());
try {
IOUtils.copy(file.getFile(), new FileOutputStream(destiny));
} catch (IOException e) {
throw new RuntimeE... | public void copyFile2(String src, String dest) throws IOException {
String newLine = System.getProperty("line.separator");
FileWriter fw = null;
FileReader fr = null;
BufferedReader br = null;
BufferedWriter bw = null;
File source = null;
try {
fr ... | true |
5,557 | 13,260,090 | 10,742,462 | public static URL getComponentXmlFileWith(String name) throws Exception {
List<URL> all = getComponentXmlFiles();
for (URL url : all) {
InputStream stream = null;
try {
stream = url.openStream();
Element root = XML.getRootElement(stream);
... | public static String md5(String string) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException exception) {
LOGGER.warn(exception.getMessage());
}
byte[] md5hash = new byte[32];
try {
... | false |
5,558 | 11,419,588 | 11,449,915 | public static String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(m... | public TtsTrackImpl(URL url, String voiceName, VoicesCache vc) throws IOException {
this.voiceCache = vc;
isReady = false;
URLConnection connection = url.openConnection();
frameSize = (int) (period * format.getChannels() * format.getSampleSizeInBits() * format.getSampleRate() / 8000)... | false |
5,559 | 6,361,318 | 3,809,797 | public void run() {
date = DateUtil.addMonth(-1);
List list = bo.getDao().getHibernateTemplate().find("from MailAffixPojo where upload_time <'" + date + "' and to_number(sized) >" + size);
if (null != list && list.size() > 0) {
try {
FTPClient ftp = new FTPClient(... | protected void addAssetResources(MimeMultipart pkg, MarinerPageContext context) throws PackagingException {
boolean includeFullyQualifiedURLs = context.getBooleanDevicePolicyValue("protocol.mime.fully.qualified.urls");
MarinerRequestContext requestContext = context.getRequestContext();
Appli... | false |
5,560 | 17,785,594 | 13,868,519 | public void handler(List<GoldenBoot> gbs, TargetPage target) {
try {
URL url = new URL(target.getUrl());
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
String include = "Top Scorers";
while ... | public static void addClasses(URL url) {
BufferedReader reader = null;
String line;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
while ((line = reader.readLine()) !... | true |
5,561 | 22,423,727 | 6,322,440 | public void copyFile(String source_file_path, String destination_file_path) {
FileWriter fw = null;
FileReader fr = null;
BufferedReader br = null;
BufferedWriter bw = null;
File source = null;
try {
fr = new FileReader(source_file_path);
fw = ... | public static void copyFile(final File fromFile, File toFile) throws IOException {
try {
if (!fromFile.exists()) {
throw new IOException("FileCopy: " + "no such source file: " + fromFile.getAbsoluteFile());
}
if (!fromFile.isFile()) {
throw... | true |
5,562 | 20,352,327 | 17,212,288 | public XmldbURI createFile(String newName, InputStream is, Long length, String contentType) throws IOException, PermissionDeniedException, CollectionDoesNotExistException {
if (LOG.isDebugEnabled()) LOG.debug("Create '" + newName + "' in '" + xmldbUri + "'");
XmldbURI newNameUri = XmldbURI.create(ne... | private void copyFile(File source, File destination) throws IOException {
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = new FileInputStream(source);
fileOutputStream = new FileOutputStream(destination);
... | true |
5,563 | 6,614,947 | 4,456,641 | public static String getPageSource(String url) throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
InputStream in = response.getEntity().getContent();
B... | private void copyFile(File srcFile, File destFile) throws IOException {
if (!(srcFile.exists() && srcFile.isFile())) throw new IllegalArgumentException("Source file doesn't exist: " + srcFile.getAbsolutePath());
if (destFile.exists() && destFile.isDirectory()) throw new IllegalArgumentException("Des... | false |
5,564 | 21,322,698 | 2,857,623 | protected void unZip() throws PersistenceException {
boolean newZip = false;
try {
if (null == backup) {
mode = (String) context.get(Context.MODE);
if (null == mode) mode = Context.MODE_NAME_RESTORE;
backupDirectory = (File) context.get(Con... | private void copy(File src, File dest, String name) {
File srcFile = new File(src, name);
File destFile = new File(dest, name);
if (destFile.exists()) {
if (destFile.lastModified() == srcFile.lastModified()) return;
destFile.delete();
}
FileChannel in ... | true |
5,565 | 18,515,326 | 5,832,949 | public static boolean cpy(File a, File b) {
try {
FileInputStream astream = null;
FileOutputStream bstream = null;
try {
astream = new FileInputStream(a);
bstream = new FileOutputStream(b);
long flength = a.length();
... | private void getImage(String filename) throws MalformedURLException, IOException, SAXException, FileNotFoundException {
String url = Constants.STRATEGICDOMINATION_URL + "/images/gameimages/" + filename;
WebRequest req = new GetMethodWebRequest(url);
WebResponse response = wc.getResponse(req)... | true |
5,566 | 4,830,846 | 4,411,141 | @Override
public synchronized void deleteHttpSessionStatistics(String contextName, String project, Date dateFrom, Date dateTo) throws DatabaseException {
final Connection connection = this.getConnection();
try {
connection.setAutoCommit(false);
String queryString = "DELET... | private void addDocToDB(String action, DataSource database) {
String typeOfDoc = findTypeOfDoc(action).trim().toLowerCase();
Connection con = null;
try {
con = database.getConnection();
con.setAutoCommit(false);
checkDupDoc(typeOfDoc, con);
Str... | true |
5,567 | 3,691,985 | 11,358,169 | public static void downloadFile(HttpServletResponse response, String file) throws IOException {
response.setContentType(FileUtils.getContentType(file));
response.setContentLength(FileUtils.getContentLength(file));
response.setHeader("Content-type", ResponseUtils.DOWNLOAD_CONTENT_TYPE);
... | public void backupFile(File fromFile, File toFile) {
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
to = new FileOutputStream(toFile);
byte[] buffer = new byte[4096];
int bytesRead;
... | true |
5,568 | 5,444,168 | 18,875,887 | public static void writeFullImageToStream(Image scaledImage, String javaFormat, OutputStream os) throws IOException {
BufferedImage bufImage = new BufferedImage(scaledImage.getWidth(null), scaledImage.getHeight(null), BufferedImage.TYPE_BYTE_BINARY);
Graphics gr = bufImage.getGraphics();
gr.... | @Override
protected int run(CmdLineParser parser) {
final List<String> args = parser.getRemainingArgs();
if (args.isEmpty()) {
System.err.println("sort :: WORKDIR not given.");
return 3;
}
if (args.size() == 1) {
System.err.println("sort :: INP... | true |
5,569 | 19,180,786 | 19,994,918 | public void testCopyFolderContents() throws IOException {
log.info("Running: testCopyFolderContents()");
IOUtils.copyFolderContents(srcFolderName, destFolderName);
Assert.assertTrue(destFile1.exists() && destFile1.isFile());
Assert.assertTrue(destFile2.exists() && destFile2.isFile())... | void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
out.close... | true |
5,570 | 19,782,619 | 5,659,863 | public synchronized String encrypt(String p_plainText) throws ServiceUnavailableException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new ServiceUnavailableException(e.getMessage());
}
... | public static FileChannel newFileChannel(File file, String rw, boolean enableException) throws IOException {
if (file == null) return null;
if (rw == null || rw.length() == 0) {
return null;
}
rw = rw.toLowerCase();
if (rw.equals(MODE_READ)) {
if (File... | false |
5,571 | 523,070 | 14,885,369 | 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 File copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
copyChannel(inChannel, outChannel);
return out;
}
| true |
5,572 | 5,084,177 | 6,969,465 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletConfig config = getServletConfig();
ServletContext context = config.getServletContext();
try {
String driver = context.getInitParameter("driver");... | public synchronized String encrypt(String plaintext) {
MessageDigest md = null;
String hash = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
hash = (new BASE64Encoder()).enco... | true |
5,573 | 17,999,460 | 10,009,723 | public static long toFile(final DigitalObject object, final File file) {
try {
FileOutputStream fOut = new FileOutputStream(file);
long bytesCopied = IOUtils.copyLarge(object.getContent().getInputStream(), fOut);
fOut.close();
return bytesCopied;
} cat... | @Override
public File fetchHSMFile(String fsID, String filePath) throws HSMException {
log.debug("fetchHSMFile called with fsID=" + fsID + ", filePath=" + filePath);
if (absIncomingDir.mkdirs()) {
log.info("M-WRITE " + absIncomingDir);
}
File tarFile;
try {
... | true |
5,574 | 11,290,317 | 17,074,899 | private void trainSRLParser(byte flag, JarArchiveOutputStream zout) throws Exception {
AbstractSRLParser labeler = null;
AbstractDecoder[] decoder = null;
if (flag == SRLParser.FLAG_TRAIN_LEXICON) {
System.out.println("\n* Save lexica");
labeler = new SRLParser(flag, ... | public void save(File f, AudioFileFormat.Type t) throws IOException {
if (t.getExtension().equals("raw")) {
IOUtils.copy(makeInputStream(), new FileOutputStream(f));
} else {
AudioSystem.write(makeStream(), t, f);
}
}
| true |
5,575 | 15,741,733 | 14,406,880 | public static void downloadURLNow(URL url, File to, SHA1Sum sha1, boolean force) throws Exception {
{
String sep = System.getProperty("file.separator");
String folders = to.getPath();
String path = "";
for (int i = 0; i < folders.length(); i++) {
... | @Override
public void setDocumentSpace(DocumentSpace space) {
for (Document doc : space) {
if (doc instanceof XMLDOMDocument) {
writer.writeDocument(doc);
} else if (doc instanceof BinaryDocument) {
BinaryDocument bin = (BinaryDocument) doc;
... | false |
5,576 | 11,992,308 | 13,569,337 | public static String generateStringSHA256(String content) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ScannerChecksum.class.getName()).log(Level.SEVERE, null, ex);
}
... | public static String getMD5HashFromString(String message) {
String hashword = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(message.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
hashword = hash.toString(... | true |
5,577 | 9,403,118 | 1,096,936 | public byte[] uniqueID(String name, String topic) {
String key;
byte[] id;
synchronized (cache_) {
key = name + "|" + topic;
id = (byte[]) cache_.get(key);
if (id == null) {
MessageDigest md;
try {
md = M... | private static String readJarURL(URL url) throws IOException {
JarURLConnection juc = (JarURLConnection) url.openConnection();
InputStream in = juc.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
int i = in.read();
while (i != -1) {
out.... | false |
5,578 | 9,547,229 | 14,254,575 | public void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;
URL url;
InputStream stream = null;
try {
url = new URL(masterUrl);
... | private byte[] _generate() throws NoSuchAlgorithmException {
if (host == null) {
try {
seed = InetAddress.getLocalHost().toString();
} catch (UnknownHostException e) {
seed = "localhost/127.0.0.1";
} catch (SecurityException e) {
... | false |
5,579 | 13,121,131 | 9,176,940 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public static void copyFile(File in, File out, boolean read, boolean write, boolean execute) throws FileNotFoundException, IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
File outFile = null;
if (out.isDirectory()) {
outFile = new File(out.getAbsoluteP... | true |
5,580 | 12,465,375 | 17,373,549 | private void write(File src, File dst, byte id3v1Tag[], byte id3v2HeadTag[], byte id3v2TailTag[]) throws IOException {
if (src == null || !src.exists()) throw new IOException(Debug.getDebug("missing src", src));
if (!src.getName().toLowerCase().endsWith(".mp3")) throw new IOException(Debug.getDebug(... | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) throw new IOException("Destination '" + destFile + "' exists but is a directory");
FileInputStream input = new FileInputStream(srcFile);
... | true |
5,581 | 9,756,057 | 923,861 | public void writeToFile(File out) throws IOException, DocumentException {
FileChannel inChannel = new FileInputStream(pdf_file).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} ca... | public static void main(String args[]) {
InputStream input = System.in;
OutputStream output = System.out;
if (args.length > 0) {
try {
input = new FileInputStream(args[0]);
} catch (FileNotFoundException e) {
System.err.println("Unable ... | true |
5,582 | 13,783,899 | 10,313,906 | 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 File copyFile(File file, String newName, File folder) {
File newFile = null;
if (!file.exists()) {
System.out.println("File " + file + " does not exist");
return null;
}
if (file.isFile()) {
BufferedOutputStream out = null;
Buff... | true |
5,583 | 12,800,568 | 3,011,295 | public void exportFile() {
String expfolder = PropertyHandler.getInstance().getProperty(PropertyHandler.KINDLE_EXPORT_FOLDER_KEY);
File out = new File(expfolder + File.separator + previewInfo.getTitle() + ".prc");
File f = new File(absPath);
try {
FileOutputStream fout = ... | public static void main(String args[]) throws IOException, TrimmerException, DataStoreException {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("ace", "path to ace file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("phd", "path ... | true |
5,584 | 4,673,959 | 7,406,942 | public static String createRecoveryContent(String password) {
try {
password = encryptGeneral1(password);
String data = URLEncoder.encode("key", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
URL url = new URL("https://mypasswords-server.appspot.com/recovery_file"... | private void getXMLData() {
String result = null;
URL url = null;
URLConnection conn = null;
BufferedReader rd = null;
StringBuffer sb = new StringBuffer();
String line;
try {
url = new URL(this.url);
conn = url.openConnection();
... | true |
5,585 | 19,136,768 | 14,166,352 | public static void main(String[] args) {
CookieManager cm = new CookieManager();
try {
URL url = new URL("http://www.hccp.org/test/cookieTest.jsp");
URLConnection conn = url.openConnection();
conn.connect();
cm.storeCookies(conn);
System.ou... | public static boolean downloadFile(String urlString, String outputFile, int protocol) {
InputStream is = null;
File file = new File(outputFile);
FileOutputStream fos = null;
if (protocol == HTTP_PROTOCOL) {
try {
URL url = new URL(urlString);
... | false |
5,586 | 17,190,231 | 9,168,699 | public static void call(String host, String port, String method, String[] params) {
cat.debug("call (host:" + host + " port:" + port + " method:" + method);
try {
String message = null;
StringBuffer bufMessage = new StringBuffer();
bufMessage.append("<?xml version... | public void insertArchiveEntries(ArchiveEntry entries[]) throws WeatherMonitorException {
String sql = null;
try {
Connection con = getConnection();
Statement stmt = con.createStatement();
ResultSet rslt = null;
con.setAutoCommit(false);
fo... | false |
5,587 | 8,122,281 | 19,036,213 | 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... | private void createNodes() {
try {
URL url = this.getClass().getResource("NodesFile.txt");
InputStreamReader inReader = new InputStreamReader(url.openStream());
BufferedReader inNodes = new BufferedReader(inReader);
String s;
while ((s = inNodes.re... | true |
5,588 | 16,809,623 | 19,322,906 | public boolean parseResults(URL url, String analysis_type, CurationI curation, Date analysis_date, String regexp) throws OutputMalFormatException {
boolean parsed = false;
try {
InputStream data_stream = url.openStream();
parsed = parseResults(data_stream, analysis_type, cura... | @Test
public void test_baseMaterialsForTypeID_NonExistingID() throws Exception {
URL url = new URL(baseUrl + "/baseMaterialsForTypeID/1234567890");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestPr... | false |
5,589 | 505,090 | 11,733,067 | public static void main(String[] args) {
URL url = null;
EventHeap eh = new EventHeap("iw-room2");
Event newEvent;
float chan1 = -1, chan2 = -1;
try {
url = new URL("http://iw--bluetooth-ap/cgi-bin/sens.cgi");
} catch (MalformedURLException e) {
}
... | public static String sha1(String src) {
MessageDigest md1 = null;
try {
md1 = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
md1.update(src.getBytes("UTF-8"));
} catch (Unsupp... | false |
5,590 | 17,804,386 | 1,261,429 | public void refreshStatus() {
if (!enabledDisplay) return;
try {
String url = getServerFortURL();
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
String data = null;
int counter = 0;
while ((dat... | private static String downloadMedia(String mediadir, URL remoteFile) throws Exception, InterruptedException {
File tmpDir = new File(System.getProperty("java.io.tmpdir") + "org.ogre4j.examples/" + mediadir);
if (!tmpDir.exists()) {
tmpDir.mkdirs();
}
URLConnection urlConn... | false |
5,591 | 9,980,885 | 10,171,842 | private void verifyAvailability() {
for (int i = 0; i < servers.size(); i++) {
String hostEntry = (String) servers.get(i);
String hostString = hostEntry.substring(0, hostEntry.indexOf(":"));
String portString = hostEntry.substring(hostEntry.indexOf(":") + 1);
... | public String upload() throws IOException {
int idx = docIndex.incrementAndGet();
String tmpName = "namefinder/doc_" + idx + "__" + fileFileName;
File tmpFile = tmpFile(tmpName);
if (tmpFile.exists()) {
org.apache.commons.io.FileUtils.deleteQuietly(tmpFile);
}
... | false |
5,592 | 892,621 | 22,088,424 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public static void main(String[] args) {
int[] mas = { 5, 10, 20, -30, 55, -60, 9, -40, -20 };
int next;
for (int a = 0; a < mas.length; a++) {
for (int i = 0; i < mas.length - 1; i++) {
if (mas[i] > mas[i + 1]) {
next = mas[i];
... | false |
5,593 | 6,686,537 | 16,924,659 | private static Map<String, File> loadServiceCache() {
ArrayList<String> preferredOrder = new ArrayList<String>();
HashMap<String, File> serviceFileMapping = new HashMap<String, File>();
File file = new File(IsqlToolkit.getBaseDirectory(), CACHE_FILE);
if (!file.exists()) {
... | 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();
... | false |
5,594 | 2,285,441 | 10,126,016 | static synchronized Person lookup(PhoneNumber number, String siteName) {
Vector<Person> foundPersons = new Vector<Person>(5);
if (number.isFreeCall()) {
Person p = new Person("", "FreeCall");
p.addNumber(number);
foundPersons.add(p);
} else if (number.isSI... | public T08OTSDTMInterpositionUnitTestCase(String name) throws java.io.IOException {
super(name);
java.net.URL url = ClassLoader.getSystemResource("host0.cosnaming.jndi.properties");
jndiProps = new java.util.Properties();
jndiProps.load(url.openStream());
}
| false |
5,595 | 13,683,865 | 4,700,182 | public URL getResource(String path) throws MalformedURLException {
if (!path.startsWith("/")) throw new MalformedURLException("Path '" + path + "' does not start with '/'");
URL url = new URL(myResourceBaseURL, path.substring(1));
InputStream is = null;
try {
is = url.ope... | public String sendRequest(HttpRequest request) throws IOException, AuthenticationException, RedmineException, NotFoundException {
logger.debug(request.getRequestLine().toString());
DefaultHttpClient httpclient = HttpUtil.getNewHttpClient();
configureProxy(httpclient);
if (login != nu... | false |
5,596 | 7,132,186 | 20,009,109 | 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 concatFiles(final String as_base_file_name) throws IOException, FileNotFoundException {
new File(as_base_file_name).createNewFile();
final OutputStream lo_out = new FileOutputStream(as_base_file_name, true);
int ln_part = 1, ln_readed = -1;
final byte[] lh_buffer =... | true |
5,597 | 1,966,263 | 18,935,086 | 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 copia(FileInputStream input, FileOutputStream output) throws ErrorException {
if (input == null || output == null) {
throw new ErrorException("Param null");
}
FileChannel inChannel = input.getChannel();
FileChannel outChannel = output.getChannel();
tr... | true |
5,598 | 18,214,578 | 7,468,318 | public void openJadFile(URL url) {
try {
setStatusBar("Loading...");
jad.clear();
jad.load(url.openStream());
loadFromJad(url);
} catch (FileNotFoundException ex) {
System.err.println("Cannot found " + url.getPath());
} catch (NullP... | 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 |
5,599 | 19,322,907 | 19,469,022 | @Test
public void test_baseMaterialsForTypeID_StringInsteadOfID() throws Exception {
URL url = new URL(baseUrl + "/baseMaterialsForTypeID/blah-blah");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setReques... | public List<String> addLine(String username, String URL, int page) {
List<String> rss = new ArrayList<String>();
try {
URL url = new URL(URL + page);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
Syst... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.