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 |
|---|---|---|---|---|---|
100 | 6,214,338 | 7,468,318 | private File unzipArchive(File zipArchive, File outDir, String nameInZipArchive) throws IOException {
File mainFile = null;
ZipEntry entry = null;
ZipInputStream zis = new ZipInputStream(new FileInputStream((zipArchive)));
FileOutputStream fos = null;
byte buffer[] = new byte... | 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 |
101 | 10,058,360 | 19,321,031 | void startzm() {
URL myzzurl;
InputStream myzstream;
byte zmemimage[];
boolean joined;
zmemimage = null;
try {
System.err.println(zcodefile);
myzzurl = new URL(zcodefile);
myzstream = myzzurl.openStream();
zmemimage = su... | public static ArrayList<String> remoteCall(Map<String, String> dataDict) {
ArrayList<String> result = new ArrayList<String>();
String encodedData = "";
for (String key : dataDict.keySet()) {
String encodedSegment = "";
String value = dataDict.get(key);
if ... | false |
102 | 10,846,738 | 18,731,110 | private static <OS extends OutputStream> OS getUnzipAndDecodeOutputStream(InputStream inputStream, final OS outputStream) {
final PipedOutputStream pipedOutputStream = new PipedOutputStream();
final List<Throwable> ungzipThreadThrowableList = new LinkedList<Throwable>();
Writer decoderWriter... | 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 |
103 | 101,811 | 7,142,336 | 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];
... | public int getHttpStatus(ProxyInfo proxyInfo, String sUrl, String cookie, String host) {
HttpURLConnection connection = null;
try {
if (proxyInfo == null) {
URL url = new URL(sUrl);
connection = (HttpURLConnection) url.openConnection();
} else ... | false |
104 | 12,490,148 | 1,889,366 | private void createIDocPluginProject(IProgressMonitor monitor, String sourceFileName, String pluginName, String pluginNameJCo) throws CoreException, IOException {
monitor.subTask(MessageFormat.format(Messages.ProjectGenerator_CreatePluginTaskDescription, pluginName));
final Map<String, byte[]> files... | public String hash(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
log.info("No sha-256 available");
try {
digest = MessageDigest.getInstance("SHA-... | false |
105 | 2,168,607 | 19,145,296 | public int create(BusinessObject o) throws DAOException {
int insert = 0;
int id = 0;
Contact contact = (Contact) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("INSERT_CONTACT"));
pst.setString(1, contact.getName());
... | public static double[][] getCurrency() throws IOException {
URL url = new URL("http://hk.finance.yahoo.com/currency");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "big5"));
double currency[][] = new double[11][11];
while (true) {
String ... | false |
106 | 11,980,724 | 22,788,900 | protected IRunnableWithProgress getProjectCreationRunnable() {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
int remainingWorkUnits = 10;
monitor.beginTask("New Modulo Proje... | @Override
public void saveStructure(long userId, TreeStructureInfo info, List<TreeStructureNode> structure) throws DatabaseException {
if (info == null) throw new NullPointerException("info");
if (structure == null) throw new NullPointerException("structure");
try {
getConnec... | false |
107 | 4,417,164 | 15,814,599 | private InputStream connectURL(String aurl) throws IOException {
InputStream in = null;
int response = -1;
URL url = new URL(aurl);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP connection.");
H... | public String encrypt(String pwd) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
System.out.println("Error");
}
try {
md5.update(pwd.getBytes... | false |
108 | 8,612,648 | 11,113,074 | 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 void backupXML() {
try {
TimeStamp timeStamp = new TimeStamp();
String fnameIn = this.fnameXML();
String pathBackup = this.pathXML + "\\Backup\\";
String fnameOut = fnameIn.substring(fnameIn.indexOf(this.fname), fnameIn.length());
fnameOut =... | true |
109 | 4,147,990 | 8,639,730 | public static void copyFile(File dst, File src, boolean append) throws FileNotFoundException, IOException {
dst.createNewFile();
FileChannel in = new FileInputStream(src).getChannel();
FileChannel out = new FileOutputStream(dst).getChannel();
long startAt = 0;
if (append) sta... | public static String md5encrypt(String toEncrypt) {
if (toEncrypt == null) {
throw new IllegalArgumentException("null is not a valid password to encrypt");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(toEncrypt.getBytes());
... | false |
110 | 20,296,791 | 12,909,291 | public void retrieveChallenge() throws MalformedURLException, IOException, FBConnectionException, FBErrorException {
URL url = new URL(getHost() + getPath());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-FB-User", getUser());
conn.setR... | public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType(s_contentType);
response.setHeader("Cache-control", "no-cache");
InputStream graphStream = getGraphStream(request);
OutputStream out = getOutputStream(re... | false |
111 | 11,319,480 | 21,518,266 | 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 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 |
112 | 3,762,872 | 13,139,266 | public String getHash(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] toChapter1Digest = md.digest();
return Keystore.hexEncode(toChapter1Digest);
} catch (Exception e) {
logger.err... | public static String encripta(String senha) throws GCIException {
LOGGER.debug(INICIANDO_METODO + "encripta(String)");
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
... | true |
113 | 12,776,677 | 19,471,650 | private void checkLogin(String email, String password) throws JspTagException {
String cryptedPassword;
try {
MessageDigest crypt = MessageDigest.getInstance("MD5");
crypt.update(password.getBytes());
byte digest[] = crypt.digest();
StringBuffer hexStr... | @edu.umd.cs.findbugs.annotations.SuppressWarnings({ "DLS", "REC" })
public static String md5Encode(String val) {
String output = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(val.getBytes());
byte[] digest = md.digest();
... | true |
114 | 5,620,476 | 21,162,921 | private String[] verifyConnection(Socket clientConnection) throws Exception {
List<String> requestLines = new ArrayList<String>();
InputStream is = clientConnection.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
StringTokenizer st = new StringTok... | private static void convertToOnline(final String filePath, final DocuBean docuBean) throws Exception {
File source = new File(filePath + File.separator + docuBean.getFileName());
File dir = new File(filePath + File.separator + docuBean.getId());
if (!dir.exists()) {
dir.mkdir();
... | true |
115 | 5,195,056 | 16,008,963 | public String getData() throws ValueFormatException, RepositoryException, IOException {
InputStream is = getStream();
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
IOUtils.closeQuietly(is);
return sw.toString();
}
| public static void unzip(final File file, final ZipFile zipFile, final File targetDirectory) throws PtException {
LOG.info("Unzipping zip file '" + file.getAbsolutePath() + "' to directory " + "'" + targetDirectory.getAbsolutePath() + "'.");
assert (file.exists() && file.isFile());
if (targe... | true |
116 | 21,857,917 | 2,168,608 | public static String makeMD5(String pin) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(pin.getBytes());
byte[] hash = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < h... | public int delete(BusinessObject o) throws DAOException {
int delete = 0;
Contact contact = (Contact) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("DELETE_CONTACT"));
pst.setInt(1, contact.getId());
delete = pst.execute... | false |
117 | 2,476,569 | 21,733,505 | public static void reconstruct(final List files, final Map properties, final OutputStream fout, final String base_url, final String producer, final PageSize[] size, final List hf) throws CConvertException {
OutputStream out = fout;
OutputStream out2 = fout;
boolean signed = false;
Ou... | private void loadMap() {
final String wordList = "vietwordlist.txt";
try {
File dataFile = new File(supportDir, wordList);
if (!dataFile.exists()) {
final ReadableByteChannel input = Channels.newChannel(ClassLoader.getSystemResourceAsStream("dict/" + dataFile.... | true |
118 | 7,046,481 | 12,908,232 | public InlineImageChunk(URL url) {
super();
this.url = url;
try {
URLConnection urlConn = url.openConnection();
urlConn.setReadTimeout(15000);
ImageInputStream iis = ImageIO.createImageInputStream(urlConn.getInputStream());
Iterator<ImageReader... | private void readFromObjectInput(String filename) {
try {
URL url = new URL(getCodeBase(), filename);
InputStream stream = url.openStream();
ObjectInput input = new ObjectInputStream(stream);
fDrawing.release();
fDrawing = (Drawing) input.readObjec... | false |
119 | 17,562,349 | 19,718,986 | public String digestResponse() {
String digest = null;
if (null == nonce) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes());
md.update(":".getBytes());
md.update(realm.getBytes());
... | public static void concatenateToDestFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
if (!destFile.createNewFile()) {
throw new IllegalArgumentException("Could not create destination file:" + destFile.getName());
}
}
... | false |
120 | 840,277 | 536,222 | 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 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 |
121 | 21,488,869 | 4,114,808 | 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 boolean copier(String source, String nomFichierSource, java.io.File destination) {
boolean resultat = false;
OutputStream tmpOut;
try {
tmpOut = new BufferedOutputStream(new FileOutputStream(nomFichierSource + "001.tmp"));
InputStream is = getClass().getResourc... | true |
122 | 4,603,066 | 20,112,083 | public User createUser(Map userData) throws HamboFatalException {
DBConnection con = null;
try {
con = DBServiceManager.allocateConnection();
con.setAutoCommit(false);
String userId = (String) userData.get(HamboUser.USER_ID);
String sql = "insert into ... | @Override
public void connect() throws IOException {
URL url = getLocator().getURL();
if (url.getProtocol().equals("file")) {
final String newUrlStr = URLUtils.createAbsoluteFileUrl(url.toExternalForm());
if (newUrlStr != null) {
if (!newUrlStr.toString().... | false |
123 | 16,012,363 | 20,103,762 | public static void main(String[] args) throws IOException {
String uri = "hdfs://localhost:8020/user/leeing/maxtemp/sample.txt";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.o... | public boolean backupLastAuditSchema(File lastAuditSchema) {
boolean isBkupFileOK = false;
String writeTimestamp = DateFormatUtils.format(new java.util.Date(), configFile.getTimestampPattern());
File target = new File(configFile.getAuditSchemaFileDir() + File.separator + configFile.getAuditS... | true |
124 | 12,107,388 | 16,929,855 | private static List<CountryEntry> retrieveCountries() throws IOException {
URL url = new URL("http://" + ISO_3166_HOST + ISO_3166_TXT_FILE_PATH);
BufferedReader input = new BufferedReader(new InputStreamReader(url.openStream()));
List<CountryEntry> countries = new LinkedList<CountryEntry>();... | public void runTask(HashMap pjobParms) throws Exception {
FTPClient lftpClient = null;
FileInputStream lfisSourceFile = null;
JBJFPluginDefinition lpluginCipher = null;
IJBJFPluginCipher theCipher = null;
try {
JBJFFTPDefinition lxmlFTP = null;
if (get... | false |
125 | 9,366,909 | 19,602,724 | public synchronized void download(URL url, File file) throws IOException {
reset();
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
InputStream in = ... | public static String getWikiPage(String city) throws MalformedURLException, IOException, ParserConfigurationException, SAXException {
String url = "http://api.geonames.org/wikipediaSearch?q=" + city + "&maxRows=1&lang=it&username=lorenzo.abram";
URLConnection conn = new URL(url).openConnection();
... | false |
126 | 19,604,083 | 941,896 | @Override
public String fetchURL(String urlString) throws ServiceException {
try {
URL url = new URL(urlString);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String content = "";
String line;
while ((line... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
127 | 7,667 | 17,726,029 | 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... | 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 |
128 | 19,555,516 | 17,334,847 | public void loadFromFile() {
if (filename == null) return;
try {
BufferedReader reader;
try {
File file = new File(filename);
if (!file.exists()) return;
reader = new BufferedReader(new FileReader(file));
} catch (ja... | private static MyCookieData parseCookie(Cookie cookie) throws CookieException {
String value = cookie.getValue();
System.out.println("original cookie: " + value);
value = value.replace("%3A", ":");
value = value.replace("%40", "@");
System.out.println("cookie after replacemen... | false |
129 | 15,971,793 | 13,237,415 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1.setEnabled(false);
for (int i = 0; i < max; i++) {
Card crd = WLP.getSelectedCard(WLP.jTable1.getSelectedRows()[i]);
String s, s2;
s = "";
s2 = "";
try {
... | public static List<ServerInfo> getStartedServers() {
List<ServerInfo> infos = new ArrayList<ServerInfo>();
try {
StringBuilder request = new StringBuilder();
request.append(url).append("/").append(displayServlet);
request.append("?ingame=1");
URL objUr... | false |
130 | 11,592,707 | 10,977,091 | public static String getBiopaxId(Reaction reaction) {
String id = null;
if (reaction.getId() > Reaction.NO_ID_ASSIGNED) {
id = reaction.getId().toString();
} else {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(re... | public String md5(String password) {
MessageDigest m = null;
try {
m = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
}
m.update(password.getBytes(), 0, password.length());
return new BigInteger(1, m.digest()).toString(16);
}... | true |
131 | 23,525,479 | 800,221 | protected static final void copyFile(String from, String to) throws SeleniumException {
try {
java.io.File fileFrom = new File(from);
java.io.File fileTo = new File(to);
FileReader in = new FileReader(fileFrom);
FileWriter out = new FileWriter(fileTo);
... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
132 | 13,873,860 | 18,634,052 | static byte[] genDigest(String pad, byte[] passwd) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance(DIGEST_ALGORITHM);
digest.update(pad.getBytes());
digest.update(passwd);
return digest.digest();
}
| public static String readRss(String feed, int num) {
InputStream stream = null;
try {
feed = appendParam(feed, "num", "" + num);
System.out.println("feed=" + feed);
URL url = new URL(feed);
URLConnection connection = url.openConnection();
c... | false |
133 | 1,312,612 | 12,096,098 | public void initFromXml(final String xmlFileName) throws java.net.MalformedURLException, ConfigurationException, IOException {
if (xmlInitialized) {
return;
}
templates = null;
MergeTemplateWriter.setTokenList(getTokenProvider().getKnownTokens());
java.net.URL url... | public static String calculatesMD5(String plainText) throws NoSuchAlgorithmException {
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(plainText.getBytes());
byte[] digest = mdAlgorithm.digest();
StringBuffer hexString = new StringBuffer();
fo... | false |
134 | 15,461,843 | 12,883,277 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | private void createWikiPages(WikiContext context) throws PluginException {
OntologyWikiPageName owpn = new OntologyWikiPageName(omemo.getFormDataAlias().toUpperCase(), omemo.getFormDataVersionDate());
String wikiPageFullFileName = WikiPageName2FullFileName(context, owpn.toString());
String r... | true |
135 | 16,946,193 | 19,053,519 | 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()));
... | protected String getManualDownloadURL() {
if (_newestVersionString.indexOf("weekly") > 0) {
return "http://www.cs.rice.edu/~javaplt/drjavarice/weekly/";
}
final String DRJAVA_FILES_PAGE = "http://sourceforge.net/project/showfiles.php?group_id=44253";
final String LINK_PRE... | false |
136 | 22,900,234 | 6,146,146 | 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 static String encrypt(String text) throws NoSuchAlgorithmException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
try {
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (UnsupportedEncodingExceptio... | true |
137 | 7,861,020 | 15,519,967 | private void writeToFile(Body b, File mime4jFile) throws FileNotFoundException, IOException {
if (b instanceof TextBody) {
String charset = CharsetUtil.toJavaCharset(b.getParent().getCharset());
if (charset == null) {
charset = "ISO8859-1";
}
O... | private void output(HttpServletResponse resp, InputStream is, long length, String fileName) throws Exception {
resp.reset();
String mimeType = "image/jpeg";
resp.setContentType(mimeType);
resp.setContentLength((int) length);
resp.setHeader("Content-Disposition", "inline; file... | true |
138 | 12,428,012 | 13,221,213 | public static void putWithUserSettings(String from, String to, String renameTo, boolean binary, IProgressMonitor monitor) {
if (monitor != null && monitor.isCanceled()) {
return;
}
FTPHolder ftpHolder = new FTPHolder(from, to, renameTo, binary);
synchedSet.add(ftpHolder);... | public static Image load(final InputStream input, String format, Point dimension) throws CoreException {
MultiStatus status = new MultiStatus(GraphVizActivator.ID, 0, "Errors occurred while running Graphviz", null);
File dotInput = null, dotOutput = null;
ByteArrayOutputStream dotContents = ... | false |
139 | 9,261,775 | 16,762,677 | public static void unzipAndRemove(final String file) {
String destination = file.substring(0, file.length() - 3);
InputStream is = null;
OutputStream os = null;
try {
is = new GZIPInputStream(new FileInputStream(file));
os = new FileOutputStream(destination);
... | public static void copyFile(File src, File dest) throws IOException {
FileInputStream fIn;
FileOutputStream fOut;
FileChannel fIChan, fOChan;
long fSize;
MappedByteBuffer mBuf;
fIn = new FileInputStream(src);
fOut = new FileOutputStream(dest);
fIChan =... | true |
140 | 18,298,936 | 15,402,323 | protected InputStream makeRequestAndGetJSONData(String url) throws URISyntaxException, ClientProtocolException, IOException {
DefaultHttpClient httpClient = new DefaultHttpClient();
URI uri;
InputStream data = null;
uri = new URI(url);
HttpGet method = new HttpGet(uri);
... | public static String getMd5Hash(String text) {
StringBuffer result = new StringBuffer(32);
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
Formatter f = new Formatter(result);
byte[] digest = md5.digest();
... | false |
141 | 14,397,289 | 19,875,183 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("image/png");
OutputStream outStream;
outStream = resp.getOutputStream();
InputStream is;
String name = req.getParameter("name");
... | private void copy(File inputFile, File outputFile) {
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), "UTF-8"));
writer = new BufferedWriter(new OutputStreamWriter(new F... | true |
142 | 20,310,074 | 7,008,364 | public static String encryptPassword(String originalPassword) {
if (!StringUtils.hasText(originalPassword)) {
originalPassword = randomPassword();
}
try {
MessageDigest md5 = MessageDigest.getInstance(PASSWORD_ENCRYPTION_TYPE);
md5.update(originalPassword.... | private String getBytes(String in) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(in.getBytes());
byte[] passWordBytes = md5.digest();
String s = "[";
for (int i = 0; i < passWordBytes.length; i++) s += passWordBytes[i] + ",... | true |
143 | 1,115,931 | 22,525,884 | public void testSetRequestProperty() throws Exception {
MockHTTPServer httpServer = new MockHTTPServer("HTTP Server for User-Specified Request Property", 2);
httpServer.start();
synchronized (bound) {
if (!httpServer.started) {
bound.wait(5000);
}
... | public String generateKey(String className, String methodName, String text, String meaning) {
if (text == null) {
return null;
}
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw n... | false |
144 | 22,075,089 | 6,258,282 | public static void executa(String arquivo, String filial, String ip) {
String drive = arquivo.substring(0, 2);
if (drive.indexOf(":") == -1) drive = "";
Properties p = Util.lerPropriedades(arquivo);
String servidor = p.getProperty("servidor");
String impressora = p.getPropert... | public void testDigest() {
try {
String myinfo = "我的测试信息";
MessageDigest alga = MessageDigest.getInstance("SHA-1");
alga.update(myinfo.getBytes());
byte[] digesta = alga.digest();
System.out.println("本信息摘要是:" + byte2hex(digesta));
Messa... | false |
145 | 10,893,111 | 6,959,224 | public static void copyFile(File in, File out) throws IOException {
try {
FileReader inf = new FileReader(in);
OutputStreamWriter outf = new OutputStreamWriter(new FileOutputStream(out), "UTF-8");
int c;
while ((c = inf.read()) != -1) outf.write(c);
... | public static void copy(File source, File dest) throws java.io.IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer ... | true |
146 | 21,302,551 | 8,612,648 | public static Document convertHtmlToXml(final InputStream htmlInputStream, final String classpathXsltResource, final String encoding) {
Parser p = new Parser();
javax.xml.parsers.DocumentBuilder db;
try {
db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuil... | 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 |
147 | 19,344,016 | 4,830,848 | public static synchronized String encrypt(String plaintext) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BAS... | @Override
public synchronized void deletePersistenceEntityStatistics(Integer elementId, String contextName, String project, String name, Date dateFrom, Date dateTo) throws DatabaseException {
final Connection connection = this.getConnection();
try {
connection.setAutoCommit(false);
... | false |
148 | 6,050,588 | 12,296,633 | 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("... | public static String digest(String password) {
try {
byte[] digest;
synchronized (__md5Lock) {
if (__md == null) {
try {
__md = MessageDigest.getInstance("MD5");
} catch (E... | true |
149 | 18,293,811 | 12,044,335 | private static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("�������� ���� �� ���������" + from_file);
if (!from_file.isFile()) abort("���������� ����������� ���... | 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... | true |
150 | 18,611,368 | 4,477,205 | private static void downloadFile(URL url, File destFile) throws Exception {
try {
URLConnection urlConnection = url.openConnection();
File tmpFile = null;
try {
tmpFile = File.createTempFile("remoteLib_", null);
InputStream in = null;
... | private static void copyFile(File srcFile, File destFile, long chunkSize) throws IOException {
FileInputStream is = null;
FileOutputStream os = null;
try {
is = new FileInputStream(srcFile);
FileChannel iChannel = is.getChannel();
os = new FileOutputStream... | true |
151 | 17,981,986 | 859,105 | public void saveProjectFile(File aFile) {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
File destDir = new File(theProjectsDirectory, sdf.format(Calendar.getInstance().getTime()));
if (destDir.mkdirs()) {
File outFile = new File(destDir, "project.xml");
... | 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 |
152 | 7,672,521 | 20,805,582 | 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 void copyFile(File s, File t) {
try {
FileChannel in = (new FileInputStream(s)).getChannel();
FileChannel out = (new FileOutputStream(t)).getChannel();
in.transferTo(0, s.length(), out);
in.close();
out.close();
} catch (Exception e)... | true |
153 | 19,117,993 | 8,055,629 | public static final void copyFile(File argSource, File argDestination) throws IOException {
FileChannel srcChannel = new FileInputStream(argSource).getChannel();
FileChannel dstChannel = new FileOutputStream(argDestination).getChannel();
try {
dstChannel.transferFrom(srcChannel, ... | void setURLString(String path, boolean forceLoad) {
if (path != null) {
if (this.url != null || inputStream != null) throw new IllegalArgumentException(Ding3dI18N.getString("MediaContainer5"));
try {
URL url = new URL(path);
InputStream stream;
... | false |
154 | 8,274,572 | 20,407,275 | public ODFSignatureService(TimeStampServiceValidator timeStampServiceValidator, RevocationDataService revocationDataService, SignatureFacet signatureFacet, InputStream documentInputStream, OutputStream documentOutputStream, TimeStampService timeStampService, String role, IdentityDTO identity, byte[] photo, DigestAl... | @NotNull
private Properties loadProperties() {
File file = new File(homeLocator.getHomeDir(), configFilename);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
throw new RuntimeException("IOException while creatin... | true |
155 | 8,862,015 | 17,074,899 | @Override
protected void loadInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
List<String> taxa = new Vector<String>();
String domain = m_domain.getStringValue();
String id = "";
if (domain.equalsIgnoreCase("Eukaryota")... | 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);
}
}
| false |
156 | 12,082,135 | 18,248,689 | public static Set<Province> getProvincias(String pURL) {
Set<Province> result = new HashSet<Province>();
String iniProv = "<prov>";
String finProv = "</prov>";
String iniNomProv = "<np>";
String finNomProv = "</np>";
String iniCodigo = "<cpine>";
String finCod... | @SuppressWarnings("unchecked")
private List<String> getWordList() {
IConfiguration config = Configurator.getDefaultConfigurator().getConfig(CONFIG_ID);
List<String> wList = (List<String>) config.getObject("word_list");
if (wList == null) {
wList = new ArrayList<String>();
... | true |
157 | 21,302,551 | 11,838,691 | public static Document convertHtmlToXml(final InputStream htmlInputStream, final String classpathXsltResource, final String encoding) {
Parser p = new Parser();
javax.xml.parsers.DocumentBuilder db;
try {
db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuil... | private void externalizeFiles(Document doc, File out) throws IOException {
File[] files = doc.getImages();
if (files.length > 0) {
File dir = new File(out.getParentFile(), out.getName() + ".images");
if (!dir.mkdirs()) throw new IOException("cannot create directory " + dir);
... | true |
158 | 18,804,133 | 5,777,002 | public static String encryptPassword(String password) {
if (password == null) return null;
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
log.error("Algorithm not found", e);
r... | public void testJTLM_publish100() throws Exception {
EXISchema corpus = EXISchemaFactoryTestUtil.getEXISchema("/JTLM/schemas/TLMComposite.xsd", getClass(), m_compilerErrors);
Assert.assertEquals(0, m_compilerErrors.getTotalCount());
GrammarCache grammarCache = new GrammarCache(corpus, Gramma... | false |
159 | 6,244,936 | 13,646,834 | 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 TestReport runImpl() throws Exception {
String parser = XMLResourceDescriptor.getXMLParserClassName();
DocumentFactory df = new SAXDocumentFactory(GenericDOMImplementation.getDOMImplementation(), parser);
File f = (new File(testFileName));
URL url = f.toURL();
Document... | false |
160 | 4,130,551 | 19,685,311 | private byte[] streamToBytes(InputStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
IOUtils.copy(in, out);
} finally {
IOUtils.closeQuietly(in);
}
return out.toByteArray();
}
| public static void copyFile(File inputFile, File outputFile) throws IOException {
FileChannel srcChannel = new FileInputStream(inputFile).getChannel();
FileChannel dstChannel = new FileOutputStream(outputFile).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
s... | true |
161 | 23,141,718 | 1,023,289 | protected URLConnection openConnection(URL url) throws IOException {
if (bundleEntry != null) return (new BundleURLConnection(url, bundleEntry));
String bidString = url.getHost();
if (bidString == null) {
throw new IOException(NLS.bind(AdaptorMsg.URL_NO_BUNDLE_ID, url.toExternalF... | public static String MD5(String s) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
return new BigInteger(1, m.digest()).toString(16);
} catch (NoSuchAlgorithmException ex) {
return "";
}
}
| false |
162 | 2,198,030 | 19,409,751 | private void copy(String imgPath, String path) {
try {
File input = new File(imgPath);
File output = new File(path, input.getName());
if (output.exists()) {
if (!MessageDialog.openQuestion(getShell(), "Overwrite", "There is already an image file " + input.... | public static void compress(final File zip, final Map<InputStream, String> entries) throws IOException {
if (zip == null || entries == null || CollectionUtils.isEmpty(entries.keySet())) throw new IllegalArgumentException("One ore more parameters are empty!");
if (zip.exists()) zip.delete(); else if ... | true |
163 | 2,737,487 | 17,456,566 | public static void copy(File src, File dest) throws IOException {
OutputStream stream = new FileOutputStream(dest);
FileInputStream fis = new FileInputStream(src);
byte[] buffer = new byte[16384];
while (fis.available() != 0) {
int read = fis.read(buffer);
str... | 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 |
164 | 4,591,683 | 23,494,305 | public static void copyFile(File source, File dest) throws IOException {
if (source.equals(dest)) throw new IOException("Source and destination cannot be the same file path");
FileChannel srcChannel = new FileInputStream(source).getChannel();
if (!dest.exists()) dest.createNewFile();
... | private static void copy(File src, File dst) {
try {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();... | true |
165 | 380,318 | 4,471,001 | static void conditionalCopyFile(File dst, File src) throws IOException {
if (dst.equals(src)) return;
if (!dst.isFile() || dst.lastModified() < src.lastModified()) {
System.out.println("Copying " + src);
InputStream is = new FileInputStream(src);
OutputStream os =... | 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 |
166 | 638,963 | 17,014,842 | 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 String createDefaultRepoConf() throws IOException {
InputStream confIn = getClass().getResourceAsStream(REPO_CONF_PATH);
File tempConfFile = File.createTempFile("repository", "xml");
tempConfFile.deleteOnExit();
IOUtils.copy(confIn, new FileOutputStream(tempConfFile));
... | true |
167 | 17,637,279 | 8,793,266 | 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 static void readDefault() {
ClassLoader l = Skeleton.class.getClassLoader();
URL url = l.getResource("weka/core/parser/JFlex/skeleton.default");
if (url == null) {
Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);
throw new GeneratorException();
}
... | false |
168 | 3,577,507 | 3,874,060 | 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);
} finally {
... | public static void copyFile(File sourceFile, File targetFile) throws IOException {
if (sourceFile == null || targetFile == null) {
throw new NullPointerException("Source file and target file must not be null");
}
File directory = targetFile.getParentFile();
if (!directory... | true |
169 | 15,097,860 | 8,537,682 | public static Bitmap loadPhotoBitmap(final String imageUrl, final String type) {
InputStream imageStream = null;
try {
HttpGet httpRequest = new HttpGet(new URL(imageUrl).toURI());
HttpResponse response = (HttpResponse) new DefaultHttpClient().execute(httpRequest);
... | public static String urlPost(Map<String, String> paraMap, String urlStr) throws IOException {
String strParam = "";
for (Map.Entry<String, String> entry : paraMap.entrySet()) {
strParam = strParam + (entry.getKey() + "=" + entry.getValue()) + "&";
}
URL url = new URL(urlS... | false |
170 | 14,193,058 | 19,555,516 | public static String submitURLRequest(String url) throws HttpException, IOException, URISyntaxException {
HttpClient httpclient = new DefaultHttpClient();
InputStream stream = null;
user_agents = new LinkedList<String>();
user_agents.add("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-U... | public void loadFromFile() {
if (filename == null) return;
try {
BufferedReader reader;
try {
File file = new File(filename);
if (!file.exists()) return;
reader = new BufferedReader(new FileReader(file));
} catch (ja... | false |
171 | 4,591,683 | 22,424,633 | public static void copyFile(File source, File dest) throws IOException {
if (source.equals(dest)) throw new IOException("Source and destination cannot be the same file path");
FileChannel srcChannel = new FileInputStream(source).getChannel();
if (!dest.exists()) dest.createNewFile();
... | 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());... | true |
172 | 8,330,065 | 6,442,346 | @Test
public void testWriteAndReadBiggerUnbuffered() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start(... | public static boolean copyFileCover(String srcFileName, String descFileName, boolean coverlay) {
File srcFile = new File(srcFileName);
if (!srcFile.exists()) {
System.out.println("复制文件失败,源文件" + srcFileName + "不存在!");
return false;
} else if (!srcFile.isFile()) {
... | true |
173 | 7,034,031 | 5,842,117 | private void copyFile(File sourceFile, File destFile) throws IOException {
if (log.isDebugEnabled()) {
log.debug("CopyFile : Source[" + sourceFile.getAbsolutePath() + "] Dest[" + destFile.getAbsolutePath() + "]");
}
if (!destFile.exists()) {
destFile.createNewFile();
... | private void copy(final File src, final File dstDir) {
dstDir.mkdirs();
final File dst = new File(dstDir, src.getName());
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(src), ... | true |
174 | 4,822,222 | 489,386 | public static void copy(String srcFileName, String destFileName) throws IOException {
if (srcFileName == null) {
throw new IllegalArgumentException("srcFileName is null");
}
if (destFileName == null) {
throw new IllegalArgumentException("destFileName is null");
... | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | true |
175 | 21,064,899 | 22,395,244 | protected static String getURLandWriteToDisk(String url, Model retModel) throws MalformedURLException, IOException {
String path = null;
URL ontURL = new URL(url);
InputStream ins = ontURL.openStream();
InputStreamReader bufRead;
OutputStreamWriter bufWrite;
int offse... | public static void main(String[] args) {
try {
File fichierXSD = new File("D:/Users/Balley/données/gml/commune.xsd");
URL urlFichierXSD = fichierXSD.toURI().toURL();
InputStream isXSD = urlFichierXSD.openStream();
DocumentBuilderFactory dbFactory = DocumentBui... | false |
176 | 8,068,393 | 13,336,051 | public static boolean copyFile(String fileIn, String fileOut) {
FileChannel in = null;
FileChannel out = null;
boolean retour = false;
try {
in = new FileInputStream(fileIn).getChannel();
out = new FileOutputStream(fileOut).getChannel();
in.transfe... | protected static String getFileContentAsString(URL url, String encoding) throws IOException {
InputStream input = null;
StringWriter sw = new StringWriter();
try {
System.out.println("Free mem :" + Runtime.getRuntime().freeMemory());
input = url.openStream();
... | true |
177 | 467,550 | 12,539,808 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void jsFunction_extract(ScriptableFile outputFile) throws IOException, FileSystemException, ArchiveException {
InputStream is = file.jsFunction_createInputStream();
OutputStream output = outputFile.jsFunction_createOutputStream();
BufferedInputStream buf = new BufferedInputStream(is);... | true |
178 | 22,117,571 | 2,069,219 | public void copyFileFromLocalMachineToRemoteMachine(InputStream source, File destination) throws Exception {
String fileName = destination.getPath();
File f = new File(getFtpServerHome(), "" + System.currentTimeMillis());
f.deleteOnExit();
org.apache.commons.io.IOUtils.copy(source, n... | public static void copieFichier(File fichier1, File fichier2) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(fichier1).getChannel();
out = new FileOutputStream(fichier2).getChannel();
in.transferTo(0, in.size(), out);
... | true |
179 | 17,164,077 | 18,960,732 | public void readConfig(String urlString) throws Exception {
try {
URL url = new URL(urlString);
InputStream in = url.openStream();
XmlDoc xml = new Parser().parse(new InputSource(in), true, true);
Verifier v = new Verifier(InputOutput.create(SCHEMA), null);
... | protected void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat) {
File inputFile = null;
File outputFile = null;
try {
inputFile = File.createTempFile("document", "." + inputFormat.getFileExtension());
... | false |
180 | 2,941,028 | 1,008,332 | private static void insertModuleInEar(File fromEar, File toEar, String moduleType, String moduleName, String contextRoot) throws Exception {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(fromEar));
FileOutputStream fos = new FileOutputStream(toEar);
ZipOutputStream tempZip ... | public void copyFileToFileWithPaths(String sourcePath, String destinPath) throws Exception {
BufferedInputStream in = null;
BufferedOutputStream out = null;
byte dataBuff[] = new byte[bufferSize];
File file1 = new File(sourcePath);
if (file1.exists() && (file1.isFile())) {
... | true |
181 | 4,660,318 | 1,896,089 | public static void main(String argv[]) {
Matrix A, B, C, Z, O, I, R, S, X, SUB, M, T, SQ, DEF, SOL;
int errorCount = 0;
int warningCount = 0;
double tmp, s;
double[] columnwise = { 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12. };
double[] rowwise = { 1., 4., 7., 1... | public static void copyFileByNIO(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | true |
182 | 1,158,840 | 9,830,269 | public static int zipFile(File file_input, File dir_output) {
File zip_output = new File(dir_output, file_input.getName() + ".zip");
ZipOutputStream zip_out_stream;
try {
FileOutputStream out = new FileOutputStream(zip_output);
zip_out_stream = new ZipOutputStream(new... | public final void deliver(final String from, final String recipient, final InputStream data) throws TooMuchDataException, IOException {
System.out.println("FROM: " + from);
System.out.println("TO: " + recipient);
final File tmpD... | true |
183 | 8,624,822 | 16,495,170 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
HttpSession session = request.getSession();
String session_id = session.getId();
F... | @Override
public HostRecord addressForHost(String domainName) throws Exception {
String fullUrl = requestUrlStub + domainName;
URL url = new URL(fullUrl);
HttpURLConnection connection = null;
connection = null;
connection = (HttpURLConnection) url.openConnection();
... | false |
184 | 12,469,140 | 242,983 | public Program updateProgramPath(int id, String sourcePath) throws AdaptationException {
Program program = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
String query = "UPDATE Programs SET " + "sourcePath = '" + ... | public void fetchFile(String ID) {
String url = "http://www.nal.usda.gov/cgi-bin/agricola-ind?bib=" + ID + "&conf=010000++++++++++++++&screen=MA";
System.out.println(url);
try {
PrintWriter pw = new PrintWriter(new FileWriter("MARC" + ID + ".txt"));
if (!id.contains("... | false |
185 | 4,193,495 | 19,549,579 | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| protected InputStream callApiMethod(String apiUrl, String xmlContent, String contentType, String method, int expected) {
try {
URL url = new URL(apiUrl);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
if (ApplicationConstants.CONNECT_TIMEOUT > -1) {... | false |
186 | 8,931,241 | 3,024,980 | public static void copy(File from, File to, CopyMode mode) throws IOException {
if (!from.exists()) {
IllegalArgumentException e = new IllegalArgumentException("Source doesn't exist: " + from.getCanonicalFile());
log.throwing("IOUtils", "copy", e);
throw e;
}
... | @Test
public void testCopy_inputStreamToWriter_Encoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new YellOn... | true |
187 | 14,132,965 | 16,619,409 | public static void copia(File nombreFuente, File nombreDestino) throws IOException {
FileInputStream fis = new FileInputStream(nombreFuente);
FileOutputStream fos = new FileOutputStream(nombreDestino);
FileChannel canalFuente = fis.getChannel();
FileChannel canalDestino = fos.getChan... | public void updateFiles(String ourPath) {
System.out.println("Update");
DataInputStream dis = null;
DataOutputStream dos = null;
for (int i = 0; i < newFiles.size() && i < nameNewFiles.size(); i++) {
try {
dis = new DataInputStream(new FileInputStream((Str... | true |
188 | 12,021,779 | 16,351,484 | private void insert() throws SQLException, NamingException {
Logger logger = getLogger();
if (logger.isDebugEnabled()) {
logger.debug("enter - " + getClass().getName() + ".insert()");
}
try {
if (logger.isInfoEnabled()) {
logger.info("insert():... | protected ProductionTabsProperties(final PlayerID playerId, final List<Rule> mRules, final String mapDir) {
m_rules = mRules;
final ResourceLoader loader = ResourceLoader.getMapResourceLoader(mapDir);
String propertyFile = PROPERTY_FILE + "." + playerId.getName() + ".properties";
URL... | false |
189 | 10,349,788 | 20,188,734 | public static boolean checkEncode(String origin, byte[] mDigest, String algorithm) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(origin.getBytes());
if (MessageDigest.isEqual(mDigest, md.digest())) {
return true;
} el... | public String output(final ComponentParameter compParameter) {
InputStream inputStream;
try {
final URL url = new URL("http://xml.weather.yahoo.com/forecastrss?p=" + getPagelet().getOptionProperty("_weather_code") + "&u=c");
inputStream = url.openStream();
} catch (fi... | false |
190 | 10,135,488 | 10,303,667 | @Override
public void run() {
try {
long pos = begin;
byte[] buf = new byte[1024];
URLConnection cn = url.openConnection();
Utils.setHeader(cn);
cn.setRequestProperty("Range", "bytes=" + begin + "-" + end);
BufferedInputStream bis =... | @Override
public void copy(final String fileName) throws FileIOException {
final long savedCurrentPositionInFile = currentPositionInFile;
if (opened) {
closeImpl();
}
final FileInputStream fis;
try {
fis = new FileInputStream(file);
} catch... | false |
191 | 3,330,945 | 23,400,216 | public void extractImage(String input, OutputStream os, DjatokaDecodeParam params, IWriter w) throws DjatokaException {
File in = null;
if (input.equals(STDIN)) {
try {
in = File.createTempFile("tmp", ".jp2");
input = in.getAbsolutePath();
... | public void add(Channel channel) throws Exception {
String sqlStr = null;
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
sqlStr = "insert into t_ip_channel (id,name,descri... | false |
192 | 7,366,470 | 8,212,984 | public RFC1345List(URL url) {
if (url == null) return;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(url.openStream())));
final String linePattern = " XX??????? HHHH X";
String line;
mnemos = new HashMap... | private void readCard() {
try {
final String urlString = createURLStringExistRESTGetXQuery("//scheda[cata = \"" + cata + "\"]");
InputStream inputStream = new URL(urlString).openStream();
uiSchedaXml.read(inputStream);
inputStream.close();
} catch (Mal... | false |
193 | 15,597,101 | 22,608,103 | public void actionPerformed(ActionEvent e) {
if (path.compareTo("") != 0) {
imageName = (path.substring(path.lastIndexOf(File.separator) + 1, path.length()));
String name = imageName.substring(0, imageName.lastIndexOf('.'));
String extension = imageName.substring(imageNam... | public static boolean copyFile(File sourceFile, File destFile) {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
srcChannel = new FileInputStream(sourceFile).getChannel();
dstChannel = new FileOutputStream(destFile).getChannel();
long p... | true |
194 | 11,333,342 | 7,781,593 | public AssessmentItemType getAssessmentItemType(String filename) {
if (filename.contains(" ") && (System.getProperty("os.name").contains("Windows"))) {
File source = new File(filename);
String tempDir = System.getenv("TEMP");
File dest = new File(tempDir + "/temp.xml");
... | public Object execute(ExecutionEvent event) throws ExecutionException {
final List<InformationUnit> informationUnitsFromExecutionEvent = InformationHandlerUtil.getInformationUnitsFromExecutionEvent(event);
Shell activeShell = HandlerUtil.getActiveShell(event);
DirectoryDialog fd = new Direct... | true |
195 | 22,328,847 | 22,095,678 | protected void doRestoreOrganizeType() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strDelQuery = "DELETE FROM " + Common.ORGANIZE_TYPE_TABLE;
String strSelQuery = "SELECT organize_type_id,organize_type_name,width " + ... | public static String deleteTag(String tag_id) {
String so = OctopusErrorMessages.UNKNOWN_ERROR;
if (tag_id == null || tag_id.trim().equals("")) {
return OctopusErrorMessages.TAG_ID_CANT_BE_EMPTY;
}
DBConnection theConnection = null;
try {
theConnection... | true |
196 | 249,612 | 1,760,353 | protected static boolean checkVersion(String address) {
Scanner scanner = null;
try {
URL url = new URL(address);
InputStream iS = url.openStream();
scanner = new Scanner(iS);
if (scanner == null && DEBUG) System.out.println("SCANNER NULL");
... | public static int deleteSysPosInsert() {
Connection conn = null;
PreparedStatement psmt = null;
StringBuffer SQL = new StringBuffer(200);
int deleted = 0;
SQL.append(" DELETE FROM JHF_SYS_POSITION_INSERT ");
try {
conn = JdbcConnectionPool.mainConnection()... | false |
197 | 9,152,056 | 7,542,014 | public AbstractASiCSignatureService(InputStream documentInputStream, DigestAlgo digestAlgo, RevocationDataService revocationDataService, TimeStampService timeStampService, String claimedRole, IdentityDTO identity, byte[] photo, TemporaryDataStorage temporaryDataStorage, OutputStream documentOutputStream) throws IOE... | public static String[] parsePLS(String strURL, Context c) {
URL url;
URLConnection urlConn = null;
String TAG = "parsePLS";
Vector<String> radio = new Vector<String>();
final String filetoken = "file";
final String SPLITTER = "=";
try {
url = new U... | false |
198 | 9,782,243 | 3,121,748 | private void updateUser(AddEditUserForm addform, HttpServletRequest request) throws Exception {
Session hbsession = HibernateUtil.currentSession();
try {
Transaction tx = hbsession.beginTransaction();
NvUsers user = (NvUsers) hbsession.load(NvUsers.class, addform.getLogin());... | private String clientLogin(AuthInfo authInfo) throws AuthoricationRequiredException {
logger.fine("clientLogin.");
try {
String url = "https://www.google.com/accounts/ClientLogin";
HttpPost httpPost = new HttpPost(url);
ArrayList<NameValuePair> params = new ArrayL... | false |
199 | 5,537,138 | 15,710,690 | public static String getDigest(String seed, String code) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(seed.getBytes("UTF-8"));
byte[] passwordMD5Byte = md.digest(code.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
... | @SuppressWarnings("unused")
private String getMD5(String value) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return "";
}
md5.reset();
md5.update(value.getBytes());
byte[]... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.