id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
898,200 | 11,527,585 | 9,983,984 | @Test
public final void testImportODScontentXml() throws Exception {
URL url = ODSTableImporterTest.class.getResource("/Messages.ods_FILES/content.xml");
String systemId = url.getPath();
InputStream in = url.openStream();
ODSTableImporter b = new ODSTableImporter();
b.imp... | private String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | false |
898,201 | 16,604,588 | 6,471,727 | public static AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
InputStream inputStream = null;
if (useragent != null) {
URLConnection myCon = url.openConnection();
myCon.setUseCaches(false);
myCon.setDoInput(true);
... | public void load() throws IOException {
File file = new File(filename);
URL url = file.toURI().toURL();
Properties temp = new Properties();
temp.load(url.openStream());
if (temp.getProperty("Width") != null) try {
width = Integer.valueOf(temp.getProperty("Width"))... | false |
898,202 | 9,597,889 | 3,660,402 | private void copy(File source, File dest) throws IOException {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteB... | public void importCertFile(File file) throws IOException {
File kd;
File cd;
synchronized (this) {
kd = keysDir;
cd = certsDir;
}
if (!cd.isDirectory()) {
kd.mkdirs();
cd.mkdirs();
}
String newName = file.getName... | true |
898,203 | 3,236,017 | 8,070,379 | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputResource.getInputStream()));
File targetDirectoryAsFile = new File(targetDirectory);
if (!targetDirectoryAsFile.exists... | true |
898,204 | 3,236,017 | 17,793,612 | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException {
try {
String encodedString = ((StringValue) arguments[0].next()).getStringValue();
byte[] decodedBytes = Base64.decode(encodedString);
if (argument... | true |
898,205 | 2,791,310 | 4,569,312 | protected synchronized AbstractBaseObject insert(AbstractBaseObject obj) throws ApplicationException {
PreparedStatement preStat = null;
StringBuffer sqlStat = new StringBuffer();
DmsRelationalWord tmpDmsRelationalWord = (DmsRelationalWord) ((DmsRelationalWord) obj).clone();
synchron... | public static String getMD5(String s) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(s.toLowerCase().getBytes());
return HexString.bufferToHex(md5.digest());
} catch (NoSuchAlgorithmException e) {
System.err.println("Error gra... | false |
898,206 | 22,608,285 | 18,310,878 | private void dealWith(String line) throws Exception {
if (line.startsWith("#") || (line.length() == 0)) {
return;
}
String sarr[];
sarr = StringUtil.split(line, '\t');
String path = destDir + File.separator + sarr[0];
boolean copyFile = true;
if (s... | public static void copyFile(File src, File dst) throws IOException {
File inputFile = src;
File outputFile = dst;
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.clos... | false |
898,207 | 7,949,001 | 15,429,599 | protected byte[] getBytesForWebPageUsingHTTPClient(String urlString) throws ClientProtocolException, IOException {
log("Retrieving url: " + urlString);
DefaultHttpClient httpclient = new DefaultHttpClient();
if (this.archiveAccessSpecification.getUserID() != null) {
httpclient.ge... | public static boolean copyFile(File src, File dest) throws IOException {
if (src == null) {
throw new IllegalArgumentException("src == null");
}
if (dest == null) {
throw new IllegalArgumentException("dest == null");
}
if (!src.isFile()) {
... | false |
898,208 | 10,171,842 | 23,031,483 | 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);
}
... | private static void copy(File source, File target, byte[] buffer) throws FileNotFoundException, IOException {
InputStream in = new FileInputStream(source);
File parent = target.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
if (target.isDirectory()) {... | true |
898,209 | 10,432,260 | 11,915,880 | private void appendArchive() throws Exception {
String cmd;
if (profile == CompilationProfile.UNIX_GCC) {
cmd = "cat";
} else if (profile == CompilationProfile.MINGW_WINDOWS) {
cmd = "type";
} else {
throw new Exception("Unknown cat equivalent for ... | private static void cut() {
File inputFile = new File(inputFileName);
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), inputCharSet));
} catch (FileNotFoundException e) {
System.err.print("Invalid Fi... | true |
898,210 | 668,660 | 22,993,367 | 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 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 |
898,211 | 10,943,077 | 250,595 | private void copy(File fromFile, File toFile) throws IOException {
String fromFileName = fromFile.getName();
File tmpFile = new File(fromFileName);
String toFileName = toFile.getName();
if (!tmpFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName... | 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 |
898,212 | 22,424,633 | 7,525,367 | public static void copyFile(String input, String output) {
try {
FileChannel srcChannel = new FileInputStream("srcFilename").getChannel();
FileChannel dstChannel = new FileOutputStream("dstFilename").getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());... | public static void streamCopyFile(File srcFile, File destFile) {
try {
FileInputStream fi = new FileInputStream(srcFile);
FileOutputStream fo = new FileOutputStream(destFile);
byte[] buf = new byte[1024];
int readLength = 0;
while (readLength != -1... | true |
898,213 | 13,935,756 | 2,495,361 | static List<String> listProperties(final MetadataType type) {
List<String> props = new ArrayList<String>();
try {
File adapter = File.createTempFile("adapter", null);
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(type.adapter);
... | public static synchronized Integer getNextSequence(String seqNum) throws ApplicationException {
Connection dbConn = null;
java.sql.PreparedStatement preStat = null;
java.sql.ResultSet rs = null;
boolean noTableMatchFlag = false;
int currID = 0;
int nextID = 0;
... | false |
898,214 | 1,244,216 | 14,419,083 | public String postEvent(EventDocument eventDoc, Map attachments) {
if (eventDoc == null || eventDoc.getEvent() == null) return null;
if (queue == null) {
sendEvent(eventDoc, attachments);
return eventDoc.getEvent().getEventId();
}
if (attachments != null) {
... | public static String plainStringToMD5(String input) {
if (input == null) {
throw new NullPointerException("Input cannot be null");
}
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
try {
md = Mes... | false |
898,215 | 694,747 | 607,724 | 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]... | public void copyFile(String oldPathFile, String newPathFile) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPathFile);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPathFile);
FileO... | true |
898,216 | 16,650,253 | 7,300,267 | public int visitStatement(String statement) throws SQLException {
mySQLLogger.info(statement);
if (getConnection() == null) {
throw new JdbcException("cannot exec: " + statement + ", because 'not connected to database'");
}
Statement stmt = getConnection().createStatement... | public void appendMessage(MimeMessage oMsg) throws FolderClosedException, StoreClosedException, MessagingException {
if (DebugFile.trace) {
DebugFile.writeln("Begin DBFolder.appendMessage()");
DebugFile.incIdent();
}
final String EmptyString = "";
if (!((DBSto... | true |
898,217 | 470,160 | 9,312,243 | 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... | void shutdown(final boolean unexpected) {
if (unexpected) {
log.warn("S H U T D O W N --- received unexpected shutdown request.");
} else {
log.info("S H U T D O W N --- start regular shutdown.");
}
if (this.uncaughtException != null) {
log... | true |
898,218 | 20,508,692 | 23,147,989 | private void gzip(FileHolder fileHolder) {
byte[] buffer = new byte[BUFFER_SIZE];
int bytes_read;
if (fileHolder.selectedFileList.size() == 0) {
return;
}
File destFile = new File(fileHolder.destFiles[0]);
try {
OutputStream outStream = new Fil... | public boolean copy(String file, String path) {
try {
File file_in = new File(file);
String tmp1, tmp2;
tmp1 = file;
tmp2 = path;
while (tmp2.contains("\\")) {
tmp2 = tmp2.substring(tmp2.indexOf("\\") + 1);
tmp1 = tm... | true |
898,219 | 8,951,478 | 21,792,245 | private void jbInit() throws Exception {
getContentPane().setLayout(borderLayout1);
this.setTitle("�ϥλ���");
jTextPane1.setEditable(false);
this.getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
jScrollPane1.getViewport().add(jTextPane1);
this.setSize(... | public static String[] retrieveFasta(String id) throws Exception {
URL url = new URL("http://www.uniprot.org/uniprot/" + id + ".fasta");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String header = reader.readLine();
StringBuffer seq = new Stri... | true |
898,220 | 4,928,349 | 12,044,335 | 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(... | JcrFile createBody(Part part) throws IOException, MessagingException {
JcrFile body = new JcrFile();
body.setName("part");
ByteArrayOutputStream pout = new ByteArrayOutputStream();
IOUtils.copy(part.getInputStream(), pout);
body.setDataProvider(new JcrDataProviderImpl(TYPE.BY... | false |
898,221 | 6,805,931 | 23,484,507 | private static File copyJarToPool(File file) {
File outFile = new File(RizzToolConstants.TOOL_POOL_FOLDER.getAbsolutePath() + File.separator + file.getName());
if (file != null && file.exists() && file.canRead()) {
try {
FileChannel inChan = new FileInputStream(file).getC... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getName());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getName());
if... | true |
898,222 | 9,325,670 | 10,000,832 | 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 static void main(String[] args) {
LogFrame.getInstance();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.trim().startsWith(DEBUG_PARAMETER_NAME + "=")) {
properties.put(DEBUG_PARAMETER_NAME, arg.trim().substring(DEBUG_PARAMETER_NA... | false |
898,223 | 17,590,757 | 19,880,277 | private boolean initConnection() {
try {
if (ftp == null) {
ftp = new FTPClient();
serverIP = getServer();
userName = getUserName();
password = getPassword();
}
ftp.connect(serverIP);
ftp.login(us... | private void postUrl() throws Exception {
String authors = "";
for (String auth : plugin.getDescription().getAuthors()) {
authors = authors + " " + auth;
}
authors = authors.trim();
String url = String.format("http://bukkitstats.randomappdev.com/ping.aspx?snam=%s&... | false |
898,224 | 7,468,813 | 716,792 | public static String doPostWithBasicAuthentication(URL url, String username, String password, String parameters, Map<String, String> headers) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoInput(true);
con... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
898,225 | 8,787,103 | 11,394,767 | private void headinfoThread() {
try {
URLConnection urlc = resource.url.openConnection();
resource.setFileSize(urlc.getContentLength());
resource.setDate(urlc.getLastModified());
} catch (IOException e) {
System.out.println("Error ResourceConnection, d... | public static byte[] gerarHash(String frase) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(frase.getBytes());
return md.digest();
} catch (NoSuchAlgorithmException e) {
return null;
}
}
| false |
898,226 | 17,377,418 | 1,831,676 | private static String[] loadDB(String name) throws IOException {
URL url = SpecialConstants.class.getResource(name);
if (url == null) throw new FileNotFoundException("file " + name + " not found");
InputStream is = url.openStream();
try {
InputStreamReader isr = new Input... | public int create(BusinessObject o) throws DAOException {
int insert = 0;
int id = 0;
Account acc = (Account) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("INSERT_ACCOUNT"));
pst.setString(1, acc.getName());
pst... | false |
898,227 | 19,842,959 | 20,331,164 | 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 int read(String name) {
status = STATUS_OK;
try {
name = name.trim().toLowerCase();
if ((name.indexOf("file:") >= 0) || (name.indexOf(":/") > 0)) {
URL url = new URL(name);
in = new BufferedInputStream(url.openStream());
} el... | false |
898,228 | 2,633,237 | 908,793 | public URL rawGetURLfromWebID(String id) {
try {
System.out.println("Resolving id" + id);
String resolve = "/webid/ResolverServlet?wpid=MeetingMachine&method=form&uri=" + id + "&href=_[text/url]";
String resolver = "http://webid.hpl.hp.com:5190";
URL url = new... | 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... | false |
898,229 | 8,868,058 | 12,049,052 | private String getPage(String urlString) throws Exception {
if (pageBuffer.containsKey(urlString)) return pageBuffer.get(urlString);
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedReader in ... | private Collection<Class<? extends Plugin>> loadFromResource(ClassLoader classLoader, String resource) throws IOException {
Collection<Class<? extends Plugin>> pluginClasses = new HashSet<Class<? extends Plugin>>();
Enumeration providerFiles = classLoader.getResources(resource);
if (!provide... | true |
898,230 | 786,781 | 1,296,795 | public Vector _getSiteNames() {
Vector _mySites = new Vector();
boolean gotSites = false;
while (!gotSites) {
try {
URL dataurl = new URL(getDocumentBase(), siteFile);
BufferedReader readme = new BufferedReader(new InputStreamReader(new GZIPInputSt... | static InputStream getUrlStream(String url) throws IOException {
System.out.print("getting : " + url + " ... ");
long start = System.currentTimeMillis();
URLConnection c = new URL(url).openConnection();
InputStream is = c.getInputStream();
System.out.print((System.currentTime... | false |
898,231 | 9,270,406 | 14,944,207 | public void downSync(Vector v) throws SQLException {
try {
con = allocateConnection(tableName);
PreparedStatement update = con.prepareStatement("update cal_Event set owner=?,subject=?,text=?,place=?," + "contactperson=?,startdate=?,enddate=?,starttime=?,endtime=?,allday=?," + "syncst... | public void testStreamURL() throws Exception {
boolean ok = false;
String url = "http://www.apache.org/dist/lucene/solr/";
String txt = null;
try {
txt = IOUtils.toString(new URL(url).openStream());
} catch (Exception ex) {
fail("this test only works i... | false |
898,232 | 810,884 | 3,516,106 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | false |
898,233 | 7,872,663 | 11,519,124 | private static boolean prepareQualifyingFile(String completePath, String outputFile) {
try {
File inFile = new File(completePath + fSep + "qualifying.txt");
FileChannel inC = new FileInputStream(inFile).getChannel();
BufferedReader br = new BufferedReader(new FileReader(i... | protected static void copyFile(File in, File out) throws IOException {
java.io.FileWriter filewriter = null;
java.io.FileReader filereader = null;
try {
filewriter = new java.io.FileWriter(out);
filereader = new java.io.FileReader(in);
char[] buf = new cha... | true |
898,234 | 7,631,407 | 7,847,812 | public static InputStream getNotCacheResourceAsStream(final String fileName) {
if ((fileName.indexOf("file:") >= 0) || (fileName.indexOf(":/") > 0)) {
try {
URL url = new URL(fileName);
return new BufferedInputStream(url.openStream());
} catch (Excepti... | protected synchronized void doLogin(long timeout, String eventMask) throws IOException, AuthenticationFailedException, TimeoutException {
ChallengeAction challengeAction;
ManagerResponse challengeResponse;
String challenge;
String key;
LoginAction loginAction;
Manager... | false |
898,235 | 7,525,367 | 20,886,787 | public static void streamCopyFile(File srcFile, File destFile) {
try {
FileInputStream fi = new FileInputStream(srcFile);
FileOutputStream fo = new FileOutputStream(destFile);
byte[] buf = new byte[1024];
int readLength = 0;
while (readLength != -1... | public static void copyFile(final File source, final File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByt... | true |
898,236 | 8,211,013 | 6,886,408 | protected byte[] computeHash() {
try {
final MessageDigest inputHash = MessageDigest.getInstance("SHA");
inputHash.update(bufferFileData().getBytes());
return inputHash.digest();
} catch (final NoSuchAlgorithmException nsae) {
lastException = nsae;
... | public static final String md5(final String s) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int... | true |
898,237 | 9,801,258 | 17,267,601 | public InetSocketAddress getServerAddress() throws IOException {
URL url = new URL(ADDRESS_SERVER_URL);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setDoOutput(true);
con.setReadTimeout(2000);
con.connect();
... | public void setBckImg(String newPath) {
try {
File inputFile = new File(getPath());
File outputFile = new File(newPath);
if (!inputFile.getCanonicalPath().equals(outputFile.getCanonicalPath())) {
FileInputStream in = new FileInputStream(inputFile);
... | false |
898,238 | 3,609,806 | 8,070,379 | private static String getData(String myurl) throws Exception {
System.out.println("getdata");
URL url = new URL(myurl);
uc = (HttpURLConnection) url.openConnection();
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String temp = "", k = "";
while ... | public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputResource.getInputStream()));
File targetDirectoryAsFile = new File(targetDirectory);
if (!targetDirectoryAsFile.exists... | false |
898,239 | 8,688,865 | 6,914,912 | private void translate(String sender, String message) {
StringTokenizer st = new StringTokenizer(message, " ");
message = message.replaceFirst(st.nextToken(), "");
String typeCode = st.nextToken();
message = message.replaceFirst(typeCode, "");
try {
String data = ... | public static void main(String[] a) throws Exception {
HashMap<String, Integer> numberOfOccurencesOfThisComboe = new HashMap<String, Integer>();
HashMap<String, String> fileToCATHMapping = new HashMap<String, String>();
ArrayList<String> allFilesToBeCopied = new ArrayList<String>();
... | false |
898,240 | 2,177,544 | 20,162,871 | public static boolean makeBackup(File dir, String sourcedir, String destinationdir, String destinationDirEnding, boolean autoInitialized) {
boolean success = false;
String[] files;
files = dir.list();
File checkdir = new File(destinationdir + System.getProperty("file.separator") + de... | public static void copyFile(String f_in, String f_out, boolean remove) throws FileNotFoundException, IOException {
if (remove) {
PogoString readcode = new PogoString(PogoUtil.readFile(f_in));
readcode = PogoUtil.removeLogMessages(readcode);
PogoUtil.writeFile(f_out, readc... | true |
898,241 | 120,707 | 657,072 | 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 Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | false |
898,242 | 15,461,843 | 2,193,301 | 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 HttpURLHandler(URL url, String requestMethod, Map<String, String> parameters, String outputEncoding) throws IOException {
logger.debug("Creating http url handler for: " + url + "; using method: " + requestMethod + "; with parameters: " + parameters);
if (url == null) throw new IllegalArgument... | false |
898,243 | 3,260,787 | 9,304,937 | public CopyAllDataToOtherFolderResponse CopyAllDataToOtherFolder(DPWSContext context, CopyAllDataToOtherFolder CopyAllDataInps) throws DPWSException {
CopyAllDataToOtherFolderResponse cpyRp = new CopyAllDataToOtherFolderResponseImpl();
int hany = 0;
String errorMsg = null;
try {
... | public static String encrypt(String passPhrase, String password) {
String algorithm = "PBEWithMD5AndDES";
byte[] salt = new byte[8];
int iterations = 20;
byte[] output = new byte[128];
if (passPhrase == null || "".equals(passPhrase) || password == null || "".equals(password))... | false |
898,244 | 21,505,139 | 14,918,000 | public InputStream retrieveStream(String url) {
HttpGet getRequest = new HttpGet(url);
try {
HttpResponse getResponse = client.execute(getRequest);
final int statusCode = getResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
... | public void invoke(MessageContext msgContext) throws AxisFault {
log.debug("Enter: MD5AttachHandler::invoke");
try {
Message msg = msgContext.getRequestMessage();
SOAPConstants soapConstants = msgContext.getSOAPConstants();
org.apache.axis.message.SOAPEnvelope env... | false |
898,245 | 19,392,665 | 15,333,826 | @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... | public synchronized String encrypt(String password) {
try {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA-1");
md.update(password.getBytes("UTF-8"));
byte raw[] = md.digest();
byte[] hash = (new Base64()).encode(raw);
ret... | true |
898,246 | 12,694,085 | 1,849,189 | Object execute(String method, Vector params) throws XmlRpcException, IOException {
fault = false;
long now = 0;
if (XmlRpc.debug) {
System.err.println("Client calling procedure '" + method + "' with parameters " + params);
now = System.currentT... | public InputPort getInputPort(String file) throws IOException {
if (file.equals("/dev/null")) {
return new StreamInputPort(new NullInputStream(), file);
}
URL url = Util.tryURL(file);
if (url != null) {
return new StreamInputPort(url.openStream(), url.toExtern... | false |
898,247 | 3,734,993 | 5,017,376 | private void fetchAlignment() throws IOException {
String urlString = BASE_URL + ALN_URL + DATASET_URL + "&family=" + mFamily;
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
processAlignment(in);
}
| public static String md5(String str) {
StringBuffer buf = new StringBuffer();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] data = new byte[32];
md.update(str.getBytes(md5Encoding), 0, str.length());
data = md.digest();
... | false |
898,248 | 7,975,225 | 21,742,963 | protected void downloadFile(String filename, java.io.File targetFile, File partFile, ProgressMonitor monitor) throws java.io.IOException {
FileOutputStream out = null;
InputStream is = null;
try {
filename = toCanonicalFilename(filename);
URL url = new URL(root + file... | public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("usage: PutFromFile [properties file] [file with pmpxml]");
throw new IllegalArgumentException("Wrong number of arguments");
}
Reader is = new FileReader(args[1]);
... | false |
898,249 | 21,374,275 | 13,616,724 | private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExce... | public void write(File file) throws Exception {
if (medooFile != null) {
if (!medooFile.renameTo(file)) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(med... | true |
898,250 | 7,672,521 | 4,923,514 | public void removeExifTag(File jpegImageFile, File dst) throws IOException, ImageReadException, ImageWriteException {
OutputStream os = null;
try {
TiffOutputSet outputSet = null;
IImageMetadata metadata = Sanselan.getMetadata(jpegImageFile);
JpegImageMetadata jpe... | public static void main(String[] args) {
if (args.length != 3) {
System.out.println("Usage: HexStrToBin enc/dec <infileName> <outfilename>");
System.exit(1);
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream in = new F... | true |
898,251 | 14,914,613 | 10,598,290 | private void retrieveData() {
StringBuffer obsBuf = new StringBuffer();
try {
URL url = new URL(getProperty("sourceURL"));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String lineIn = null;
while ((lineIn = in.readLi... | public String encryptLdapPassword(String algorithm) {
String sEncrypted = _password;
if ((_password != null) && (_password.length() > 0)) {
algorithm = Val.chkStr(algorithm);
boolean bMD5 = algorithm.equalsIgnoreCase("MD5");
boolean bSHA = algorithm.equalsIgnoreCa... | false |
898,252 | 14,183,083 | 8,544,629 | 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.... | @Override
protected void copyContent(String filename) throws IOException {
InputStream in = null;
try {
String resourceDir = System.getProperty("resourceDir");
File resource = new File(resourceDir, filename);
ByteArrayOutputStream o... | true |
898,253 | 9,135,964 | 17,431,783 | 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());
... | protected void registerClasses() throws PrintException {
if (!init) {
try {
Enumeration<URL> somethingToRegister = this.getClass().getClassLoader().getResources("META-INF/" + getClass().getSimpleName() + ".properties");
while (somethingToRegister.hasMoreElements()... | false |
898,254 | 10,479,536 | 5,551,392 | private void bubbleSort(int values[]) {
PerfMonTimer timerOuter = PerfMonTimer.start("SortingTest.bubbleSort");
try {
int len = values.length - 1;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len - i; j++) {
if (values[j] > values[j ... | public static String getMD5Str(String source) {
String s = null;
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(sou... | false |
898,255 | 101,811 | 11,519,124 | public void bubbleSort(int[] arr) {
boolean swapped = true;
int j = 0;
int tmp;
while (swapped) {
swapped = false;
j++;
for (int i = 0; i < arr.length - j; i++) {
if (arr[i] > arr[i + 1]) {
tmp = arr[i];
... | protected static void copyFile(File in, File out) throws IOException {
java.io.FileWriter filewriter = null;
java.io.FileReader filereader = null;
try {
filewriter = new java.io.FileWriter(out);
filereader = new java.io.FileReader(in);
char[] buf = new cha... | false |
898,256 | 1,663,419 | 19,319,640 | private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExce... | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | true |
898,257 | 5,553,144 | 13,604,491 | private void initStreams() throws IOException {
if (audio != null) {
audio.close();
}
if (url != null) {
audio = new OggInputStream(url.openStream());
} else {
audio = new OggInputStream(ResourceLoader.getResourceAsStream(ref));
}
}
| public static int executeUpdate(EOAdaptorChannel channel, String sql, boolean autoCommit) throws SQLException {
int rowsUpdated;
boolean wasOpen = channel.isOpen();
if (!wasOpen) {
channel.openChannel();
}
Connection conn = ((JDBCContext) channel.adaptorContext())... | false |
898,258 | 20,661,433 | 267,366 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | false |
898,259 | 4,260,650 | 2,059,352 | public void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
Closer c = new Closer();
try {
source = c.register(new Fi... | public static void main(String[] args) {
String inFile = "test_data/blobs.png";
String outFile = "ReadWriteTest.png";
itkImageFileReaderUC2_Pointer reader = itkImageFileReaderUC2.itkImageFileReaderUC2_New();
itkImageFileWriterUC2_Pointer writer = itkImageFileWriterUC2.itkImageFileWri... | true |
898,260 | 1,910,796 | 5,026,545 | public void saveToPackage() {
boolean inPackage = false;
String className = IconEditor.className;
if (!checkPackage()) {
JOptionPane.showMessageDialog(this, "No package selected. Aborting.", "Package not selected!", JOptionPane.WARNING_MESSAGE);
return;
}
... | public void writeConfigurationFile() throws IOException, ComponentException {
SystemConfig config = parent.getParentSystem().getConfiguration();
File original = config.getLocation();
File backup = new File(original.getParentFile(), original.getName() + "." + System.currentTimeMillis());
... | true |
898,261 | 10,178,498 | 3,675,186 | public static IChemModel readInChI(URL url) throws CDKException {
IChemModel chemModel = new ChemModel();
try {
IMoleculeSet moleculeSet = new MoleculeSet();
chemModel.setMoleculeSet(moleculeSet);
StdInChIParser parser = new StdInChIParser();
BufferedR... | public final Matrix2D<E> read(final URL url) throws IOException {
if (url == null) {
throw new IllegalArgumentException("url must not be null");
}
InputStream inputStream = null;
try {
inputStream = url.openStream();
return read(inputStream);
... | false |
898,262 | 11,353,263 | 7,998,444 | @Test
@Ignore
public void testToJson() throws IOException {
JsonSerializer js = new StreamingJsonSerializer(new ObjectMapper());
BulkOperation op = js.createBulkOperation(createTestData(10000), false);
IOUtils.copy(op.getData(), System.out);
}
| 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 |
898,263 | 23,677,151 | 15,372,362 | public static IProject CreateJavaProject(String name, IPath classpath) throws CoreException {
// Create and Open New Project in Workspace
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject(name);
project.create(null);
project... | public List<String> loadList(String name) {
List<String> ret = new ArrayList<String>();
try {
URL url = getClass().getClassLoader().getResource("lists/" + name + ".utf-8");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
... | false |
898,264 | 6,751,999 | 19,307,121 | public static void main(String[] args) throws Exception {
TripleDES tdes = new TripleDES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\testTDESENC.txt"));
SingleKey ... | public static byte[] sendSmsRequest(String url, String param) {
byte[] bytes = null;
try {
URL httpurl = new URL(url);
HttpURLConnection httpConn = (HttpURLConnection) httpurl.openConnection();
httpConn.setRequestProperty("Accept-Language", "zh-CN");
h... | false |
898,265 | 4,648,562 | 8,567,304 | public String Hash(String plain) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(plain.getBytes(), 0, plain.length());
return new BigInteger(1, md5.digest()).toString(16);
} catch (Exception ex) {
Log.serverlogger.warn("No such... | public TapdocContextImpl(Registry registry, FileObject javaDom, List<String> javadocLinks, List<String> libraryLocations, FileObject outputDirectory, List<String> tapdocLinks, DocumentGenerator documentGenerator) {
this.registry = registry;
this.documentGenerator = documentGenerator;
try {
... | false |
898,266 | 8,106,130 | 16,389,745 | private void copyFile(File source, File dest) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
so... | private void doIt() throws Throwable {
GenericDAO<User> dao = DAOFactory.createDAO(User.class);
try {
final User user = dao.findUniqueByCriteria(Expression.eq("login", login));
if (user == null) throw new IllegalArgumentException("Specified user isn't exist");
if ... | true |
898,267 | 12,499,532 | 13,199,957 | public File copyLocalFileAsTempFileInExternallyAccessableDir(String localFileRef) throws IOException {
log.debug("copyLocalFileAsTempFileInExternallyAccessableDir");
File f = this.createTempFileInExternallyAccessableDir();
FileChannel srcChannel = new FileInputStream(localFileRef).getChannel... | private File copyFile(String fileInClassPath, String systemPath) throws Exception {
InputStream is = getClass().getResourceAsStream(fileInClassPath);
OutputStream os = new FileOutputStream(systemPath);
IOUtils.copy(is, os);
is.close();
os.close();
return new File(syst... | true |
898,268 | 13,490,964 | 668,660 | public void write(File file) throws Exception {
if (isInMemory()) {
FileOutputStream fout = null;
try {
fout = new FileOutputStream(file);
fout.write(get());
} finally {
if (fout != null) {
fout.close();
... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
898,269 | 20,827,140 | 14,820,646 | public static Chunk updateLastSend(Chunk c) throws Exception {
DBConnectionManager dbm = null;
Connection conn = null;
PreparedStatement stmt = null;
Chunk ret = null;
String SQL = "UPDATE CHUNK SET SENT=? WHERE FILEHASH=? AND STARTOFF=? AND LENGTH=?";
log.debug("upda... | public byte[] getCoded(String name, String pass) {
byte[] digest = null;
if (pass != null && 0 < pass.length()) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(name.getBytes());
md.update(pass.getBytes());
... | false |
898,270 | 16,632,749 | 14,075,551 | public void run() {
if (data.length() > 0) {
String method = getMethod();
String action = getAction();
URL url;
try {
URL actionURL;
URL baseURL = hdoc.getBase();
if (action ==... | public void doFTP() throws BuildException {
FTPClient ftp = null;
try {
task.log("Opening FTP connection to " + task.getServer(), Project.MSG_VERBOSE);
ftp = new FTPClient();
if (task.isConfigurationSet()) {
ftp = FTPConfigurator.configure(ftp, tas... | false |
898,271 | 10,540,679 | 916,271 | private static void downloadFile(String downloadFileName) throws Exception {
URL getFileUrl = new URL("http://www.tegsoft.com/Tobe/getFile" + "?tegsoftFileName=" + downloadFileName);
URLConnection getFileUrlConnection = getFileUrl.openConnection();
InputStream is = getFileUrlConnection.getIn... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
898,272 | 11,896,430 | 4,623,013 | protected InputStream createIconType(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
JavaliController.debug(JavaliController.LG_VERBOSE, "Creating iconType");
String cHash = PRM_TYPE + "=" + TP_ICON;
String iconName = req.getParameter("iconName");
... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
898,273 | 15,858,891 | 20,991,251 | @Override
public void send() {
BufferedReader in = null;
StringBuffer result = new StringBuffer();
try {
URL url = new URL(getUrl());
in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine())... | private void initialize() {
List providers = new ArrayList();
while (this.urls.hasMoreElements()) {
URL url = (URL) this.urls.nextElement();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8... | true |
898,274 | 17,114,030 | 6,096,495 | public static void main(String[] args) {
try {
FTPClient p = new FTPClient();
p.connect("url");
p.login("login", "pass");
int sendCommand = p.sendCommand("SYST");
System.out.println("TryMe.main() - " + sendCommand + " (sendCommand)");
s... | public String getMD5(String password) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte byteData[] = md.digest();
StringBuffer sb = new StringBuffer();
for(int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[... | false |
898,275 | 14,129,929 | 20,336,463 | public static void copy(String sourceFile, String targetFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel();
FileChannel targetChannel = new FileOutputStream(targetFile).getChannel();
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.s... | private static void prepare() {
System.err.println("PREPARING-----------------------------------------");
deleteHome();
InputStream configStream = null;
FileOutputStream tempStream = null;
try {
configStream = AllTests.class.getClassLoader().getResourceAsStream("n... | true |
898,276 | 17,425,238 | 7,068,381 | public static NSData sendSynchronousRequest(NSMutableURLRequest req, NSHTTPURLResponseHolder resp, NSErrorHolder error) {
NSData data = null;
URL url = req.URL().xmlvmGetURL();
URLConnection conn;
try {
conn = url.openConnection();
data = new NSData(conn.getIn... | public static void main(String argv[]) {
try {
if (argv.length != 1 && argv.length != 3) {
usage();
System.exit(1);
}
URL url = new URL(argv[0]);
URLConnection conn;
conn = url.openConnection();
if (conn.... | false |
898,277 | 13,031,531 | 1,691,633 | protected String getOldHash(String text) {
String hash = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte[] digestedBytes = md.digest();
hash = HexUtils.convert(digestedBytes);
} catch (No... | private String encryptPassword(String password) throws NoSuchAlgorithmException {
MessageDigest encript = MessageDigest.getInstance("MD5");
encript.update(password.getBytes());
byte[] b = encript.digest();
int size = b.length;
StringBuffer h = new StringBuffer(size);
... | true |
898,278 | 9,034,967 | 23,284,463 | public static String generateMessageId(String plain) {
byte[] cipher = new byte[35];
String messageId = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(plain.getBytes());
cipher = md5.digest();
StringBuffer sb = new... | public static DownloadedContent downloadContent(final InputStream is) throws IOException {
if (is == null) {
return new DownloadedContent.InMemory(new byte[] {});
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final byte[] buffer = new byte[1024];
... | false |
898,279 | 9,233,950 | 15,759,378 | public static void copyFile(File src, File dest) throws IOException {
if (!src.exists()) throw new IOException("File not found '" + src.getAbsolutePath() + "'");
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
BufferedInputStream in = new BufferedInputStream(... | public static String email_get_public_hash(String email) {
try {
if (email != null) {
email = email.trim().toLowerCase();
CRC32 crc32 = new CRC32();
crc32.reset();
crc32.update(email.getBytes());
MessageDigest md5 = ... | false |
898,280 | 6,668,684 | 19,919,874 | public static void doIt(String action) {
int f = -1;
Statement s = null;
Connection connection = null;
try {
init();
log.info("<<< Looking up UserTransaction >>>");
UserTransaction usertransaction = (UserTransaction) context.lookup("java:comp/UserT... | public Long createSite(Site site, List<String> hosts) {
if (log.isDebugEnabled()) {
log.debug("site: " + site);
if (site != null) {
log.debug(" language: " + site.getDefLanguage());
log.debug(" country: " + site.getDefCountry());
... | true |
898,281 | 10,871,260 | 23,124,633 | public static final String getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
try {
localHost = InetAddress.getLo... | private void saveFile(Folder folder, Object key, InputStream stream) throws FileManagerException {
File file = new File(folder, key.toString());
LOGGER.debug("Writing file: " + file.getAbsolutePath());
Writer writer = null;
Writer encodedWriter = null;
try {
encod... | false |
898,282 | 7,749,347 | 13,395,834 | public static String ReadURLStringAndWrite(URL url, String str) throws Exception {
String stringToReverse = URLEncoder.encode(str, "UTF-8");
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(connection.getOu... | TreeMap<Integer, Integer> initProperties(URL propurl) {
String zoneFileName = null;
String costFileName = null;
String homesFileName = null;
String jobsFileName = null;
Properties props = new Properties();
try {
props.loadFromXML(propurl.openStream());
... | false |
898,283 | 20,428,223 | 13,822,269 | public void extractSong(Song s, File dir) {
FileInputStream fin = null;
FileOutputStream fout = null;
File dest = new File(dir, s.file.getName());
if (dest.equals(s.file)) return;
byte[] buf = new byte[COPY_BLOCKSIZE];
try {
fin = new FileInputStream(s.fil... | public static String md5(String password) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);
} catch (NoSuchAlgorithmException ex) ... | false |
898,284 | 23,047,155 | 21,925,741 | @Override
public void run() {
long timeout = 10 * 1000L;
long start = (new Date()).getTime();
try {
InputStream is = socket.getInputStream();
boolean available = false;
while (!available && !socket.isClosed()) {
... | public static boolean predictDataSet(String completePath, String Type, String predictionOutputFileName, String slopeOneDataFolderName) {
try {
if (Type.equalsIgnoreCase("Qualifying")) {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + "CompleteQualifyingDataI... | true |
898,285 | 10,482,004 | 22,619,332 | public static void main(String[] args) throws IOException {
System.out.println("Start filtering zgps...");
final Config config = ConfigUtils.loadConfig(args[0]);
final String CONFIG_MODULE = "GPSFilterZGPS";
File sourceFileSelectedStages = new File(config.findParam(CONFIG_MODULE, "so... | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
LOG.debug("copying file");
String tTempFileName = this.getTempDir() + "uploaded-file.tmp";
IOUtils.copy(pDeposit.getFile(), new FileOutputStream(tTempFileName));
Datastrea... | true |
898,286 | 7,927,385 | 6,050,588 | private String send(String method, String contentType, String urlStr, String body) throws MalformedURLException, IOException {
HttpURLConnection postCon = (HttpURLConnection) new URL(getUrl(urlStr)).openConnection();
postCon.setRequestMethod(method);
postCon.setDoOutput(true);
postCo... | public static String getKeyWithRightLength(final String key, int keyLength) {
if (keyLength > 0) {
if (key.length() == keyLength) {
return key;
} else {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("... | false |
898,287 | 11,701,818 | 7,039,646 | private static void copyFile(File source, File destination) throws IOException, SecurityException {
if (!destination.exists()) destination.createNewFile();
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(s... | private static final void cloneFile(File origin, File target) throws IOException {
FileChannel srcChannel = null;
FileChannel destChannel = null;
try {
srcChannel = new FileInputStream(origin).getChannel();
destChannel = new FileOutputStream(target).getChannel();
... | true |
898,288 | 12,104,132 | 14,414,546 | @Override
public void render(Output output) throws IOException {
output.setStatus(statusCode, statusMessage);
if (headersMap != null) {
Iterator<Entry<String, String>> iterator = headersMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, ... | private void deleteProject(String uid, String home, HttpServletRequest request, HttpServletResponse response) throws Exception {
String project = request.getParameter("project");
String line;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
htmlHe... | true |
898,289 | 21,553,327 | 13,612,487 | @JiveScriptCommand(help = "Load and executes a JiveScript file")
public void load(String path) throws JiveScriptException, IOException {
loading = true;
JivesScene.setActiveScene(null);
boolean allowScripting = JiveScriptEngine.allowScripting;
JiveScriptEngine.allowScripting = tr... | private ArrayList<String> loadProperties(String filename) throws DevFailed, IOException {
java.net.URL url = getClass().getResource(filename);
if (url == null) {
Except.throw_exception("LOAD_PROPERTY_FAILED", "URL for property file (" + filename + ") is null !", "PogoProperty.loadPropert... | true |
898,290 | 12,883,277 | 11,981,880 | private void createWikiPages(WikiContext context) throws PluginException {
OntologyWikiPageName owpn = new OntologyWikiPageName(omemo.getFormDataAlias().toUpperCase(), omemo.getFormDataVersionDate());
String wikiPageFullFileName = WikiPageName2FullFileName(context, owpn.toString());
String r... | private void loadProperties() {
if (properties == null) {
properties = new Properties();
try {
URL url = getClass().getResource(propsFile);
properties.load(url.openStream());
} catch (IOException ioe) {
ioe.printStackTrace()... | false |
898,291 | 2,746,011 | 10,176,882 | @RequestMapping(value = "/privatefiles/{file_name}")
public void getFile(@PathVariable("file_name") String fileName, HttpServletResponse response, Principal principal) {
try {
Boolean validUser = false;
final String currentUser = principal.getName();
Authentication au... | @SuppressWarnings("unchecked")
protected void processDownloadAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
File transformationFile = new File(xslBase, "file-info.xsl");
HashMap<String, Object> params = new HashMap<String, Object>();
params.putAll(req... | true |
898,292 | 14,450,904 | 13,352,120 | @Override
public void run() {
handle.start();
handle.switchToIndeterminate();
FacebookJsonRestClient client = new FacebookJsonRestClient(API_KEY, SECRET);
client.setIsDesktop(true);
HttpURLConnection connection;
... | public File createFileFromClasspathResource(String resourceUrl) throws IOException {
File fichierTest = File.createTempFile("xmlFieldTestFile", "");
FileOutputStream fos = new FileOutputStream(fichierTest);
InputStream is = DefaultXmlFieldSelectorTest.class.getResourceAsStream(resourceUrl);
... | false |
898,293 | 2,324,866 | 12,454,182 | public SpreadSheetFrame(FileManager owner, File file, Delimiter delim) {
super(owner, file.getPath());
JPanel pane = new JPanel(new BorderLayout());
super.contentPane.add(pane);
this.tableModel = new BigTableModel(file, delim);
this.table = new JTable(tableModel);
thi... | public void excluirTopico(Integer idDisciplina) throws Exception {
String sql = "DELETE from topico WHERE id_disciplina = ?";
PreparedStatement stmt = null;
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1, idDisciplina);
stmt.executeUpdate();
... | false |
898,294 | 18,347,503 | 14,763,206 | public void setPage(String url) {
System.out.println("SetPage(" + url + ")");
if (url != null) {
if (!url.startsWith("http://")) {
url = "http://" + url;
}
boolean exists = false;
for (int i = 0; i < urlComboBox.getItemCount(); i++) {
... | public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException {
FileChannel inputChannel = new FileInputStream(inputFile).getChannel();
FileChannel outputChannel = new FileOutputStream(outputFile).getChannel();
try {
inpu... | false |
898,295 | 2,226,036 | 8,988,251 | public void run() {
saveWLHome();
for (final TabControl control : tabControls) {
control.performOk(WLPropertyPage.this.getProject(), WLPropertyPage.this);
}
if (isEnabledJCLCopy()) {
final File url = new ... | private static void exportConfigResource(ClassLoader classLoader, String resourceName, String targetFileName) throws Exception {
InputStream is = classLoader.getResourceAsStream(resourceName);
FileOutputStream fos = new FileOutputStream(targetFileName, false);
IOUtils.copy(is, fos);
... | true |
898,296 | 5,545,050 | 19,396,006 | public void sendFile(File file, String filename, String contentType) throws SearchLibException {
response.setContentType(contentType);
response.addHeader("Content-Disposition", "attachment; filename=" + filename);
FileInputStream inputStream = null;
try {
inputStream = ne... | private Tuple execute(final HttpMethodBase method, int numTries) throws IOException {
final Timer timer = Metric.newTimer("RestClientImpl.execute");
try {
final int sc = httpClient.executeMethod(method);
if (sc < OK_MIN || sc > OK_MAX) {
throw new RestExceptio... | true |
898,297 | 21,902,615 | 12,980,532 | public static String encrypt(String plaintext) throws EncryptionException {
if (plaintext == null) {
throw new EncryptionException();
}
try {
final MessageDigest md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
ret... | public String htmlContentSimple(String urlStr, String charset) {
StringBuffer html = new StringBuffer();
URL url = null;
BufferedReader reader = null;
try {
url = new URL(urlStr);
reader = new BufferedReader(new InputStreamReader(url.openStream(), charset));
... | false |
898,298 | 293,542 | 20,539,816 | public stock(String ticker) {
try {
URL url = new URL("http://finance.yahoo.com/q?s=" + ticker + "&d=v1");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
StringBuffer page = new StringBuffer(8192);
... | public static Collection<SearchKeyResult> searchKey(String iText, String iKeyServer) throws Exception {
Vector<SearchKeyResult> outVec = new Vector<SearchKeyResult>();
String uri = iKeyServer + "/pks/lookup?search=" + URLEncoder.encode(iText, "UTF-8");
URL url = new URL(uri);
Buffere... | true |
898,299 | 7,895,612 | 9,945,506 | public final String encrypt(String input) throws Exception {
try {
MessageDigest messageDigest = (MessageDigest) MessageDigest.getInstance(algorithm).clone();
messageDigest.reset();
messageDigest.update(input.getBytes());
String output = convert(messageDigest.... | public synchronized String decrypt(String plaintext) throws Exception {
MessageDigest md = null;
String strhash = new String((new BASE64Decoder()).decodeBuffer(plaintext));
System.out.println("strhash1122 " + strhash);
try {
md = MessageDigest.getInstance("MD5");
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.