id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
5,100 | 22,924,615 | 11,751,791 | @Override
public void run() {
try {
bitmapDrawable = new BitmapDrawable(new URL(url).openStream());
imageCache.put(id, new SoftReference<Drawable>(bitmapDrawable));
log("image::: put: id = " + id + " ");
... | private void connect(URL url) throws IOException {
String protocol = url.getProtocol();
if (!protocol.equals("http")) throw new IllegalArgumentException("URL must use 'http:' protocol");
int port = url.getPort();
if (port == -1) port = 80;
fileName = url.getFile();
co... | false |
5,101 | 17,597,668 | 14,710,734 | private boolean copyFiles(File sourceDir, File destinationDir) {
boolean result = false;
try {
if (sourceDir != null && destinationDir != null && sourceDir.exists() && destinationDir.exists() && sourceDir.isDirectory() && destinationDir.isDirectory()) {
File sourceFiles[]... | public static boolean writeFile(HttpServletResponse resp, File reqFile) {
boolean retVal = false;
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(reqFile));
IOUtils.copy(in, resp.getOutputStream());
logger.debug("File successf... | true |
5,102 | 3,516,106 | 7,981,027 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | public static boolean validPassword(String password, String passwordInDb) throws NoSuchAlgorithmException, UnsupportedEncodingException {
byte[] pwdInDb = hexStringToByte(passwordInDb);
byte[] salt = new byte[SALT_LENGTH];
System.arraycopy(pwdInDb, 0, salt, 0, SALT_LENGTH);
MessageDi... | true |
5,103 | 21,246,898 | 12,816,795 | public static void main(String[] args) throws ParseException, FileNotFoundException, IOException {
InputStream input = new BufferedInputStream(UpdateLanguages.class.getResourceAsStream("definition_template"));
Translator t = new Translator(input, "UTF8");
Node template = Translator.Start();
... | public static FileChannel getFileChannel(Object o) throws IOException {
Class c = o.getClass();
try {
Method m = c.getMethod("getChannel", null);
return (FileChannel) m.invoke(o, null);
} catch (IllegalAccessException x) {
} catch (NoSuchMethodException x) {
... | true |
5,104 | 4,238,332 | 10,176,882 | public static void cpdir(File src, File dest) throws BrutException {
dest.mkdirs();
File[] files = src.listFiles();
for (int i = 0; i < files.length; i++) {
File file = files[i];
File destFile = new File(dest.getPath() + File.separatorChar + file.getName());
... | @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 |
5,105 | 2,021,567 | 5,856,886 | public boolean storeFile(String local, String remote) throws IOException {
boolean stored = false;
GridFTP ftp = new GridFTP();
ftp.setDefaultPort(port);
System.out.println(this + ".storeFile " + remote);
try {
ftp.connect(host);
ftp.login(username, pa... | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | false |
5,106 | 5,138,483 | 18,544,887 | public static List<String> extract(String zipFilePath, String destDirPath) throws IOException {
List<String> list = null;
ZipFile zip = new ZipFile(zipFilePath);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
... | public boolean add(String url) {
try {
HttpURLConnection request = (HttpURLConnection) new URL(url).openConnection();
request.setRequestMethod("POST");
request.setRequestProperty(GameRecord.GAME_IP_HEADER, String.valueOf(ip));
request.setRequestProperty(GameRe... | false |
5,107 | 23,267,978 | 15,831,694 | public static boolean copy(InputStream is, File file) {
try {
IOUtils.copy(is, new FileOutputStream(file));
return true;
} catch (Exception e) {
logger.severe(e.getMessage());
return false;
}
}
| 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... | true |
5,108 | 1,022,820 | 14,257,554 | public static final String computeHash(String stringToCompile) {
String retVal = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(stringToCompile.getBytes());
byte[] result = md5.digest();
StringBuff... | @Override
public synchronized File download_dictionary(Dictionary dict, String localfpath) {
abort = false;
try {
URL dictionary_location = new URL(dict.getLocation());
InputStream in = dictionary_location.openStream();
FileOutputStream w = new FileOutputStrea... | false |
5,109 | 704,314 | 2,090,333 | 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 static byte[] tryLoadFile(String path) throws IOException {
InputStream in = new FileInputStream(path);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, out);
in.close();
out.close();
return out.toByteArray();
}
| true |
5,110 | 6,920,765 | 3,799,026 | public static final void sequence(int[] list, int above) {
int temp, max, min;
boolean tag = true;
for (int i = list.length - 1; i >= 0; i--) {
for (int j = 0; j < i; j++) {
if (above < 0) {
if (list[j] < list[j + 1]) {
... | public RecordIterator(URL fileUrl, ModelDataFile modelDataFile) throws DataFileException {
this.modelDataFile = modelDataFile;
InputStream urlStream = null;
try {
urlStream = fileUrl.openStream();
} catch (IOException e) {
throw new DataFileException("Error op... | false |
5,111 | 17,788,458 | 78,966 | private static synchronized boolean doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
destFile = new File(destFile + FILE_SEPARATOR + srcFile.getName());
}
FileInputStream input = new FileInpu... | 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 |
5,112 | 21,144,775 | 2,807,114 | public static void main(String[] args) {
String logConfiguration = args[2];
DOMConfigurator.configure(logConfiguration);
String urlToRun = args[0];
String outputFile = args[1];
InputStream conInput = null;
BufferedReader reader = null;
BufferedWriter writer = ... | public Controller(String m_hostname, String team, boolean m_shouldexit) throws InternalException {
m_received_messages = new ConcurrentLinkedQueue<ReceivedMessage>();
m_fragmsgs = new ArrayList<String>();
m_customizedtaunts = new HashMap<Integer, String>();
m_nethandler = new Caching... | false |
5,113 | 2,107,034 | 8,201,873 | public static void main(String[] args) throws IOException {
File inputFile = new File("D:/farrago.txt");
File outputFile = new File("D:/outagain.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()... | public Graph getGraph(URL urlFilename) throws MraldException {
try {
System.out.print("DBGraphReader: gettingGraph using url");
InputStream inUrl = urlFilename.openStream();
XMLGraphReader gr = new XMLGraphReader();
gr.setNodeType(Defau... | false |
5,114 | 1,008,332 | 14,661,394 | 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())) {
... | public void run() {
XmlFilesFilter filter = new XmlFilesFilter();
String pathTemp = Settings.get("vo_store.databaseMetaCollection");
String sectionName = pathTemp.substring(1, pathTemp.indexOf("/", 2));
String templateName = VOAccess.getElementByName(settingsDB, "TEMPLATE", sectionNa... | true |
5,115 | 3,533,514 | 23,641,084 | public boolean saveVideoXMLOnWebserver() {
String text = "";
boolean erg = false;
try {
URL url = new URL("http://localhost:8080/virtPresenterVerwalter/videofile.jsp?id=" + this.getId());
HttpURLConnection http = (HttpURLConnection) url.openConnection();
B... | @Override
public void run() {
EventType type = event.getEventType();
IBaseObject field = event.getField();
log.info("select----->" + field.getAttribute(IDatafield.URL));
try {
IParent parent = field.getParent();
String name = field.getName();
i... | false |
5,116 | 16,069,454 | 2,375,094 | public int add(WebService ws) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
String sql = "insert into WebServices (MethodName, ServiceURI) " + "values ('" + ws.getMethodName() + "... | public boolean run() {
Connection conn = null;
Statement stmt = null;
try {
conn = getDataSource().getConnection();
conn.setAutoCommit(false);
conn.rollback();
stmt = conn.createStatement();
for (... | true |
5,117 | 17,116,110 | 7,419,810 | public void deleteProposal(String id) throws Exception {
String tmp = "";
PreparedStatement prepStmt = null;
try {
if (id == null || id.length() == 0) throw new Exception("Invalid parameter");
con = database.getConnection();
String delProposal = "delete fr... | static void test() throws SQLException {
Connection conn = null;
Statement st = null;
ResultSet rs = null;
Savepoint sp = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
st = conn.createStatement();
Stri... | true |
5,118 | 17,615,293 | 2,198,030 | public BufferedImage process(final InputStream is, DjatokaDecodeParam params) throws DjatokaException {
if (isWindows) return processUsingTemp(is, params);
ArrayList<Double> dims = null;
if (params.getRegion() != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
... | 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.... | true |
5,119 | 7,005,222 | 4,249,821 | private void downloadResults() {
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(System.currentTimeMillis());
String filename = String.format("%s%sresult_%tF.xml", vysledky, File.separator, cal);
String EOL = "" + (char) 0x0D + (char) 0x0A;
try {
... | private String loadStatusResult() {
try {
URL url = new URL(getServerUrl());
InputStream input = url.openStream();
InputStreamReader is = new InputStreamReader(input, "utf-8");
BufferedReader reader = new BufferedReader(is);
StringBuffer buffer = n... | true |
5,120 | 21,016,411 | 17,003,469 | public File addFile(File file, String suffix) throws IOException {
if (file.exists() && file.isFile()) {
File nf = File.createTempFile(prefix, "." + suffix, workdir);
nf.delete();
if (!file.renameTo(nf)) {
IOUtils.copy(file, nf);
}
... | public static String login() throws Exception {
if (sid == null) {
String login = ROLAPClientAux.loadProperties().getProperty("user");
String password = ROLAPClientAux.loadProperties().getProperty("password");
MessageDigest md = MessageDigest.getInstance("MD5");
... | false |
5,121 | 21,090,885 | 19,812,348 | public static String calculateHA1(String username, byte[] password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getBytes(username, ISO_8859_1));
md.update((byte) ':');
md.update(getBytes(DAAP_REALM, ISO_8859_1));
md.updat... | static ConversionMap create(String file) {
ConversionMap out = new ConversionMap();
URL url = ConversionMap.class.getResource(file);
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = in.readLine();
while (... | false |
5,122 | 18,675,737 | 8,597,004 | private void post(String title, Document content, Set<String> tags) throws HttpException, IOException, TransformerException {
PostMethod method = null;
try {
method = new PostMethod("http://www.blogger.com/feeds/" + this.blogId + "/posts/default");
method.addRequestHeader("GD... | public String getHtmlSource(String url) {
StringBuffer codeBuffer = null;
BufferedReader in = null;
URLConnection uc = null;
try {
uc = new URL(url).openConnection();
uc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows XP; DigExt)")... | false |
5,123 | 20,919,947 | 9,704,751 | public static String sha1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("UTF-8"), 0, text.length());
byte[] sha1hash = md.digest();
return convertToHex(sha1hash);
}
| public OOXMLSignatureService(InputStream documentInputStream, OutputStream documentOutputStream, SignatureFacet signatureFacet, String role, IdentityDTO identity, byte[] photo, RevocationDataService revocationDataService, TimeStampService timeStampService, DigestAlgo signatureDigestAlgo) throws IOException {
... | false |
5,124 | 20,580,825 | 14,193,058 | public static ByteBuffer readURL(URL url) throws IOException, MalformedURLException {
URLConnection connection = null;
try {
connection = url.openConnection();
return readInputStream(new BufferedInputStream(connection.getInputStream()));
} catch (IOException e) {
... | 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... | false |
5,125 | 23,069,799 | 11,163,692 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | public static void transfer(File src, File dest, boolean removeSrc) throws FileNotFoundException, IOException {
Log.warning("source: " + src);
Log.warning("dest: " + dest);
if (!src.canRead()) {
throw new IOException("can not read src file: " + src);
}
if (!dest.g... | true |
5,126 | 16,386,620 | 10,207,809 | public static void main(String[] args) {
try {
FileReader reader = new FileReader(args[0]);
FileWriter writer = new FileWriter(args[1]);
html2xhtml(reader, writer);
writer.close();
reader.close();
} catch (Exception e) {
freemin... | @SuppressWarnings("finally")
private void decompress(final File src) throws IOException
{
final String srcPath = src.getPath();
checkSourceFile(src);
final boolean test = this.switches.contains(Switch.test);
final File dst;
if (test)
dst = File.createTempFile("jaxlib-bzip", null);
e... | true |
5,127 | 10,055,931 | 4,753,846 | private static Vector<String> getIgnoreList() {
try {
URL url = DeclarationTranslation.class.getClassLoader().getResource("ignorelist");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
Vector<String> ret = new Vector<String>();... | public static boolean checkVersion(String vers) throws IOException {
try {
String tmp = "";
URL url = new URL("http://rbmsoft.com.br/apis/ql/index.php?url=null&versao=" + vers);
BufferedInputStream buf = new BufferedInputStream(url.openStream());
int dado = 0;... | false |
5,128 | 18,098,931 | 536,114 | public static final void main(String[] args) throws FileNotFoundException, IOException {
ArrayList<String[]> result = new ArrayList<String[]>();
IStream is = new StreamImpl();
IOUtils.copy(new FileInputStream("H:\\7-项目预算表.xlsx"), is.getOutputStream());
int count = loadExcel(result, i... | 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 |
5,129 | 740,874 | 15,889,430 | public static void main(String[] argv) {
if (1 < argv.length) {
File[] sources = Source(argv[0]);
if (null != sources) {
for (File src : sources) {
File[] targets = Target(src, argv);
if (null != targets) {
... | public Parameters getParameters(HttpExchange http) throws IOException {
ParametersImpl params = new ParametersImpl();
String query = null;
if (http.getRequestMethod().equalsIgnoreCase("GET")) {
query = http.getRequestURI().getRawQuery();
} else if (http.getRequestMethod()... | true |
5,130 | 580,527 | 11,335,657 | public void elimina(Pedido pe) throws errorSQL, errorConexionBD {
System.out.println("GestorPedido.elimina()");
int id = pe.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM pedido WHERE id=" + id;
System.out.... | public void sorter() {
String inputLine1, inputLine2;
String epiNames[] = new String[1000];
String epiEpisodes[] = new String[1000];
int lineCounter = 0;
try {
String pluginDir = pluginInterface.getPluginDirectoryName();
String eplist_file = pluginDir ... | false |
5,131 | 22,544,688 | 19,332,852 | @Override
protected RequestLogHandler createRequestLogHandler() {
try {
File logbackConf = File.createTempFile("logback-access", ".xml");
IOUtils.copy(Thread.currentThread().getContextClassLoader().getResourceAsStream("logback-access.xml"), new FileOutputStream(logbackConf));
... | public void access() {
Authenticator.setDefault(new MyAuthenticator());
try {
URL url = new URL("http://localhost/ws/test");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine()) != nu... | false |
5,132 | 6,513,769 | 11,343,453 | @Before
public void BeforeTheTest() throws Exception {
URL url = ProfileParserTest.class.getClassLoader().getResource("ca/uhn/hl7v2/conf/parser/tests/example_ack.xml");
URLConnection conn = url.openConnection();
InputStream instream = conn.getInputStream();
if (instream == null) ... | public static String getWebpage(String url) {
String content = "";
if (!url.trim().toLowerCase().startsWith("http://")) {
url = "http://" + url;
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
S... | true |
5,133 | 10,540,679 | 23,484,507 | 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... | 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 |
5,134 | 15,460,365 | 12,555,621 | private String calculateMD5(String value) {
String finalString;
try {
MessageDigest md5Alg = MessageDigest.getInstance("MD5");
md5Alg.reset();
md5Alg.update(value.getBytes());
byte messageDigest[] = md5Alg.digest();
StringBuilder hexString ... | public String md5(Value request) throws FaultException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(request.strValue().getBytes("UTF8"));
} catch (UnsupportedEncodingException e) {
throw new FaultException("UnsupportedO... | true |
5,135 | 16,466,520 | 991,473 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | private void doUpdate(final boolean notifyOnChange) {
if (!validServerUrl) {
return;
}
boolean tempBuildClean = true;
List failedBuilds = new ArrayList();
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
... | false |
5,136 | 10,332,951 | 743,715 | public static void loginSkyDrive() throws Exception {
System.out.println("login ");
u = new URL(loginurl);
uc = (HttpURLConnection) u.openConnection();
uc.setRequestProperty("Cookie", msprcookie + ";" + mspokcookie);
uc.setDoOutput(true);
uc.setRequestMethod("POST");
... | InputStream selectSource(String item) {
if (item.endsWith(".pls")) {
item = fetch_pls(item);
if (item == null) return null;
} else if (item.endsWith(".m3u")) {
item = fetch_m3u(item);
if (item == null) return null;
}
if (!item.endsWith(... | false |
5,137 | 19,946,541 | 11,334,496 | public int commit() throws TransactionException, SQLException, ConnectionFactoryException {
Connection conn = ConnectionFactoryProxy.getInstance().getConnection(_poolName);
conn.setAutoCommit(false);
int numRowsUpdated = 0;
try {
Iterator statements = _statements.iterator... | public void reset(String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.setInt(1, currentPilot);
psta.setString(2, componentName);
... | true |
5,138 | 15,007,015 | 16,822,378 | public static byte[] wrapBMP(Image image) throws IOException {
if (image.getOriginalType() != Image.ORIGINAL_BMP) throw new IOException("Only BMP can be wrapped in WMF.");
InputStream imgIn;
byte data[] = null;
if (image.getOriginalData() == null) {
imgIn = image.url().op... | public String descargarArchivo(String miArchivo, String nUsuario) {
try {
URL url = new URL(conf.Conf.descarga + nUsuario + "/" + miArchivo);
URLConnection urlCon = url.openConnection();
System.out.println(urlCon.getContentType());
InputStream is = urlCon.getI... | false |
5,139 | 18,099,086 | 20,836,129 | @Override
protected void service(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
res.setHeader("X-Generator", "VisualMon");
String path = req.getPathInfo();
if (null == path || "".equals(path)) res.sendRedirect(req.getServletPath() + "/... | public void addUser(String strUserName, String strPass) {
String datetime = Function.getSysTime().toString();
String time = datetime.substring(0, 4) + datetime.substring(5, 7) + datetime.substring(8, 10) + datetime.substring(11, 13) + datetime.substring(14, 16) + datetime.substring(17, 19) + datetim... | false |
5,140 | 6,988,217 | 20,753,922 | public void testQueryForBinary() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource source = (JCRNodeSource) resolveSource(BASE_URL + "images/photo.png");
assertNotNull(source);
assertEquals(false, source.exists());
OutputStream os = source.getOutputStream(... | public void doImport(File f, boolean checkHosp) throws Exception {
connector.getConnection().setAutoCommit(false);
File base = f.getParentFile();
ZipInputStream in = new ZipInputStream(new FileInputStream(f));
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
... | true |
5,141 | 20,644,476 | 7,087,624 | private static AtomContainer askForMovieSettings() throws IOException, QTException {
final InputStream inputStream = QuickTimeFormatGenerator.class.getResourceAsStream(REFERENCE_MOVIE_RESOURCE);
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream(1024 * 100);
IOUtils.copy(input... | public static void copyFiles(String strPath, String trgPath) {
File src = new File(strPath);
File trg = new File(trgPath);
if (src.isDirectory()) {
if (trg.exists() != true) trg.mkdirs();
String list[] = src.list();
for (int i = 0; i < list.length; i++) {
... | true |
5,142 | 7,039,646 | 13,335,071 | 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();
... | public static boolean copy(File source, File dest) {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in.map(FileChannel... | true |
5,143 | 18,942,525 | 13,395,222 | public void updateUserInfo(AuthSession authSession, AuthUserExtendedInfo infoAuth) {
log.info("Start update auth");
PreparedStatement ps = null;
DatabaseAdapter db = null;
try {
db = DatabaseAdapter.getInstance();
String sql = "update WM_AUTH_USER " + "set " +... | public static 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 |
5,144 | 21,754,657 | 4,456,641 | private JButton getButtonImagen() {
if (buttonImagen == null) {
buttonImagen = new JButton();
buttonImagen.setText(Messages.getString("gui.AdministracionResorces.6"));
buttonImagen.setIcon(new ImageIcon(getClass().getResource("/es/unizar/cps/tecnoDiscap/data/icons/view_si... | private void copyFile(File srcFile, File destFile) throws IOException {
if (!(srcFile.exists() && srcFile.isFile())) throw new IllegalArgumentException("Source file doesn't exist: " + srcFile.getAbsolutePath());
if (destFile.exists() && destFile.isDirectory()) throw new IllegalArgumentException("Des... | true |
5,145 | 21,940,225 | 6,697,724 | public void echo(HttpRequest request, HttpResponse response) throws IOException {
InputStream in = request.getInputStream();
if ("gzip".equals(request.getField("Content-Encoding"))) {
in = new GZIPInputStream(in);
}
IOUtils.copy(in, response.getOutputStream());
}
| private void copyFile(File sourceFile, File targetFile) {
beNice();
dispatchEvent(SynchronizationEventType.FileCopy, sourceFile, targetFile);
File temporaryFile = new File(targetFile.getPath().concat(".jnstemp"));
while (temporaryFile.exists()) {
try {
beN... | true |
5,146 | 18,568,751 | 16,948,799 | public static Boolean decompress(File source, File destination) {
FileOutputStream outputStream;
ZipInputStream inputStream;
try {
outputStream = null;
inputStream = new ZipInputStream(new FileInputStream(source));
int read;
byte buffer[] = new... | public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
if (!dest.exists() || (dest.exists() && overwrite)) {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(d... | true |
5,147 | 20,924,120 | 13,351,233 | public static void gunzip() throws Exception {
System.out.println("gunzip()");
GZIPInputStream zipin = new GZIPInputStream(new FileInputStream("/zip/myzip.gz"));
byte buffer[] = new byte[BLOCKSIZE];
FileOutputStream out = new FileOutputStream("/zip/covers");
for (int length; ... | public static boolean copyFile(File src, File target) throws IOException {
if (src == null || target == null || !src.exists()) return false;
if (!target.exists()) if (!createNewFile(target)) return false;
InputStream ins = new BufferedInputStream(new FileInputStream(src));
OutputStre... | true |
5,148 | 10,816,494 | 2,232,618 | @Override
public void sendData(String serverUrl, String fileName, String type, InputStream is) throws IOException {
ClientSession clientSession = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + serverUrl);
}
clientSes... | public void testStorageByteArray() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
{
OutputStream output = r.getOutputStream();
output.write("This is an example".getBytes("UTF-8"));
output.write(" and another one.... | true |
5,149 | 9,869,150 | 13,209,824 | private String unJar(String jarPath, String jarEntry) {
String path;
if (jarPath.lastIndexOf("lib/") >= 0) path = jarPath.substring(0, jarPath.lastIndexOf("lib/")); else path = jarPath.substring(0, jarPath.lastIndexOf("/"));
String relPath = jarEntry.substring(0, jarEntry.lastIndexOf("/"));
... | private void loadConfig(ServletContext ctx, String configFileName) {
Digester digester = new Digester();
digester.push(this);
digester.addFactoryCreate("pagespy/server", new AbstractObjectCreationFactory() {
public Object createObject(Attributes attrs) {
String c... | false |
5,150 | 5,021,577 | 20,681,843 | public static boolean copyDataToNewTable(EboContext p_eboctx, String srcTableName, String destTableName, String where, boolean log, int mode) throws boRuntimeException {
srcTableName = srcTableName.toUpperCase();
destTableName = destTableName.toUpperCase();
Connection cn = null;
Conn... | public void testRevcounter() throws ServiceException, IOException {
JCRNodeSource emptySource = loadTestSource();
for (int i = 0; i < 3; i++) {
OutputStream sourceOut = emptySource.getOutputStream();
InputStream contentIn = getClass().getResourceAsStream(CONTENT_FILE);
... | false |
5,151 | 4,598,940 | 7,414,887 | public static void retrieveAttachments(RemoteAttachment[] attachments, String id, String projectName, String key, SimpleDateFormat formatter, java.sql.Connection connect) {
if (attachments.length != 0) {
for (RemoteAttachment attachment : attachments) {
attachmentAuthor = attachm... | private static String tinyUrl(String url)
{
HttpURLConnection httpURLConnection = null;
OutputStream httpOutputStream = null;
String responseStr = null;
try
{
URLConnection con = new URL("http://is.gd/api.php?longurl=" + url).openConnection();
if(con != null)
{
httpURLConnection = (HttpURLConne... | false |
5,152 | 15,382,680 | 7,749,347 | public static String obterConteudoSite(String u) {
URL url;
try {
url = new URL(u);
URLConnection conn = null;
if (proxy != null) conn = url.openConnection(proxy.getProxy()); else conn = url.openConnection();
conn.setDoOutput(true);
Buffere... | 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... | false |
5,153 | 17,901,734 | 7,434,461 | public static void track(String strUserName, String strShortDescription, String strLongDescription, String strPriority, String strComponent) {
String strFromToken = "";
try {
URL url = new URL(getTracUrl() + "newticket");
BufferedReader reader = new BufferedReader(new InputSt... | protected String getPostRequestContent(String urlText, String postParam) throws Exception {
URL url = new URL(urlText);
HttpURLConnection urlcon = (HttpURLConnection) url.openConnection();
urlcon.setRequestMethod("POST");
urlcon.setUseCaches(false);
urlcon.setDoOutput(true);
... | true |
5,154 | 9,366,909 | 6,597,132 | 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 void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream inStream = null;
FileOutputStream outStream = null;
FileChannel source = null;
FileChannel de... | false |
5,155 | 5,772,945 | 16,164,368 | @SuppressWarnings("unchecked")
public HttpResponse putFile(String root, String to_path, File file_obj) throws DropboxException {
String path = "/files/" + root + to_path;
try {
Path targetPath = new Path(path);
String target = buildFullURL(secureProtocol, content_host, po... | public static String getHashedPassword(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(password.getBytes());
BigInteger hashedInt = new BigInteger(1, digest.digest());
return String.format("%1$032X", hashedInt);
... | false |
5,156 | 3,201,728 | 1,516,551 | @Override
public InputStream openStream(long off, long len) throws IOException {
URLConnection con = url.openConnection();
if (!(con instanceof HttpURLConnection)) {
return null;
}
long t0 = System.currentTimeMillis();
HttpURLConnection urlcon = (HttpURLConnec... | public static HttpURLConnection getHttpConn(String urlStr, String Method) throws IOException {
URL url = null;
HttpURLConnection connection = null;
url = new URL(urlStr);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.s... | false |
5,157 | 13,266,451 | 5,706,224 | public String loadURLString(java.net.URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String s = "";
while (br.ready() && s != null) {
s = br.readLine();
... | public void run() {
try {
File outDir = new File(outDirTextField.getText());
if (!outDir.exists()) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(... | false |
5,158 | 4,519,500 | 20,273,405 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String pathInfo = req.getPathInfo();
String pluginPathInfo = pathInfo.substring(prefix.length());
String gwtPathInfo = pluginPathInfo.substring(pluginKey.length() + 1);... | public static void decompress(final File file, final File folder, final boolean deleteZipAfter) throws IOException {
final ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(file.getCanonicalFile())));
ZipEntry ze;
try {
while (null != (ze = zis.g... | true |
5,159 | 2,511,576 | 19,707,472 | public void doUpdate(String version) {
try {
final String hyperlink_url = "http://xnavigator.sourceforge.net/dist/";
JFrame updateInfoFrame = null;
try {
JPanel panel = new JPanel();
panel.setLayout(null);
panel.setBackgroun... | private void loadRDFURL(URL url) throws RDFParseException, RepositoryException {
URI urlContext = valueFactory.createURI(url.toString());
try {
URLConnection urlConn = url.openConnection();
urlConn.setRequestProperty("Accept", "application/rdf+xml");
InputStream i... | false |
5,160 | 3,253,027 | 18,773,058 | private static void addFile(File file, TarArchiveOutputStream taos) throws IOException {
String filename = null;
filename = file.getName();
TarArchiveEntry tae = new TarArchiveEntry(filename);
tae.setSize(file.length());
taos.putArchiveEntry(tae);
FileInputStream fis ... | public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | false |
5,161 | 186,569 | 11,560,551 | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | private static void extract(ZipFile zipFile) throws Exception {
FileUtils.deleteQuietly(WEBKIT_DIR);
WEBKIT_DIR.mkdirs();
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
i... | false |
5,162 | 15,767,021 | 23,147,990 | private void documentFileChooserActionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getActionCommand().equals(JFileChooser.APPROVE_SELECTION)) {
File selectedFile = documentFileChooser.getSelectedFile();
File collectionCopyFile;
String newDocumentName = selectedFile... | public boolean copy(String file, String target, int tag) {
try {
File file_in = new File(file);
File file_out = new File(target);
File parent = file_out.getParentFile();
parent.mkdirs();
FileInputStream in1 = new FileInputStream(file_in);
... | true |
5,163 | 17,037,028 | 12,879,112 | private String md5(String value) {
String md5Value = "1";
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(value.getBytes());
md5Value = getHex(digest.digest());
} catch (Exception e) {
e.printStackTrace();
}... | protected String getGraphPath(String name) throws ServletException {
String hash;
try {
MessageDigest md = MessageDigest.getInstance(m_messagedigest_algorithm);
md.update(name.getBytes());
hash = bytesToHex(md.digest());
} catch (NoSuchAlgorithmException e... | true |
5,164 | 4,491,957 | 4,068,544 | public void copyToCurrentDir(File _copyFile, String _fileName) throws IOException {
File outputFile = new File(getCurrentPath() + File.separator + _fileName);
FileReader in;
FileWriter out;
if (!outputFile.exists()) {
outputFile.createNewFile();
}
in = new... | public static void saveDigraph(mainFrame parentFrame, DigraphView digraphView, File tobeSaved) {
DigraphFile digraphFile = new DigraphFile();
DigraphTextFile digraphTextFile = new DigraphTextFile();
try {
if (!DigraphFile.DIGRAPH_FILE_EXTENSION.equals(getExtension(tobeSaved))) {
... | true |
5,165 | 2,440,033 | 8,587,767 | public Blowfish(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA1");
digest.update(password.getBytes());
} catch (Exception e) {
System.out.println(e);
}
m_bfish = new BlowfishCBC(digest.digest()... | public static String encodeMD5(String input) {
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("NoSu... | true |
5,166 | 23,010,293 | 370,458 | public static String getTextFromUrl(final String url) throws IOException {
final String lineSeparator = System.getProperty("line.separator");
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
try {
final StringBuilder result = new StringBui... | public static void copy(URL url, String outPath) throws IOException {
System.out.println("copying from: " + url + " to " + outPath);
InputStream in = url.openStream();
FileOutputStream fout = new FileOutputStream(outPath);
byte[] data = new byte[8192];
int read = -1;
... | true |
5,167 | 8,594,656 | 18,488,919 | @Override
public DownloadObject download() throws IOException {
final HttpGet findLink = new HttpGet(url.toString());
final HttpResponse response = this.client.execute(findLink);
final String body = IOUtil.getString(response);
LinkTag linkTag = null;
try {
lin... | private void insert(Connection c) throws SQLException {
if (m_fromDb) throw new IllegalStateException("The record already exists in the database");
StringBuffer names = new StringBuffer("INSERT INTO ifServices (nodeID,ipAddr,serviceID");
StringBuffer values = new StringBuffer("?,?,?");
... | false |
5,168 | 9,791,183 | 19,014,667 | private void handleFile(File file, HttpServletRequest request, HttpServletResponse response) throws Exception {
String filename = file.getName();
long filesize = file.length();
String mimeType = getMimeType(filename);
response.setContentType(mimeType);
if (filesize > getDownl... | public static boolean copyFileChannel(final File _fileFrom, final File _fileTo, final boolean _append) {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
srcChannel = new FileInputStream(_fileFrom).getChannel();
dstChannel = new FileOutputStream(_fi... | true |
5,169 | 17,806,538 | 19,670,855 | public void run(IAction action) {
int style = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getStyle();
Shell shell = new Shell((style & SWT.MIRRORED) != 0 ? SWT.RIGHT_TO_LEFT : SWT.NONE);
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl... | private synchronized void configure() {
final Map res = new HashMap();
try {
final Enumeration resources = getConfigResources();
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
while (resources.hasMoreElements()) {
final URL ur... | false |
5,170 | 19,382,420 | 22,517,711 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
ejb.bprocess.OAIPMH.AutoHarvesterSession ahSession = home.create();
java.util.Vector vector = new java.util.Vector(1, 1);
Integer libraryId... | private static void ftpTest() {
FTPClient f = new FTPClient();
try {
f.connect("oscomak.net");
System.out.print(f.getReplyString());
f.setFileType(FTPClient.BINARY_FILE_TYPE);
} catch (SocketException e) {
e.printStackTrace();
} catch (... | false |
5,171 | 5,927,306 | 20,834,960 | boolean createSessionArchive(String archiveFilename) {
byte[] buffer = new byte[1024];
try {
ZipOutputStream archive = new ZipOutputStream(new FileOutputStream(archiveFilename));
for (mAnnotationsCursor.moveToFirst(); !mAnnotationsCursor.isAfterLast(); mAnnotationsCursor.move... | private String getHash(String string) {
Monitor hashTime = JamonMonitorLogger.getTimeMonitor(Cache.class, "HashTime").start();
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
... | false |
5,172 | 13,234,957 | 6,506,273 | protected String readFileUsingHttp(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProper... | public static byte[] hash(String plainTextValue) {
MessageDigest msgDigest;
try {
msgDigest = MessageDigest.getInstance("MD5");
msgDigest.update(plainTextValue.getBytes("UTF-8"));
byte[] digest = msgDigest.digest();
return digest;
} catch (Exce... | false |
5,173 | 519,787 | 6,368,468 | public InputStream unZip(URL url) throws Exception {
ZipInputStream zipped = new ZipInputStream(url.openStream());
System.out.println("unzipping: " + url.getFile());
ZipEntry zip = zipped.getNextEntry();
byte[] b = new byte[4096];
ByteArrayOutputStream bOut = new ByteArrayOut... | boolean copyFileStructure(File oldFile, File newFile) {
if (oldFile == null || newFile == null) return false;
File searchFile = newFile;
do {
if (oldFile.equals(searchFile)) return false;
searchFile = searchFile.getParentFile();
} while (searchFile != null);
... | false |
5,174 | 10,524,166 | 5,596,825 | public static void copyURLToFile(URL source, File destination) throws IOException {
InputStream input = source.openStream();
try {
FileOutputStream output = openOutputStream(destination);
try {
IOUtils.copy(input, output);
} finally {
... | public ZIPSignatureService(InputStream documentInputStream, SignatureFacet signatureFacet, OutputStream documentOutputStream, RevocationDataService revocationDataService, TimeStampService timeStampService, String role, IdentityDTO identity, byte[] photo, DigestAlgo signatureDigestAlgo) throws IOException {
... | true |
5,175 | 10,361,727 | 120,346 | void queryInactive() {
try {
XMLConfigParser.readUrlHost();
String url = XMLConfigParser.urlHost;
Date currenttime = new Date();
String query;
String param1 = "op=queryinactive";
String param2 = "time=" + currenttime.getTime();
... | private static String getDocumentAt(String urlString) {
StringBuffer html_text = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream... | false |
5,176 | 15,759,378 | 1,983,098 | 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 = ... | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | false |
5,177 | 889,519 | 7,300,247 | 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... | public void moveMessage(DBMimeMessage oSrcMsg) throws MessagingException {
if (DebugFile.trace) {
DebugFile.writeln("Begin DBFolder.moveMessage()");
DebugFile.incIdent();
}
JDCConnection oConn = null;
PreparedStatement oStmt = null;
ResultSet oRSet = n... | false |
5,178 | 19,604,083 | 1,023,289 | @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 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 |
5,179 | 12,408,144 | 15,678,668 | public static String generateSHA1Digest(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("UTF-8"), 0, text.length());
sha1hash = md.digest();
return ... | public static String hashPassword(String password) {
String hashStr = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes(Charset.defaultCharset()));
BigInteger hash = new BigInteger(1, md5.digest());
hashStr ... | true |
5,180 | 15,066,035 | 21,201,276 | private void connect(byte[] bData) {
System.out.println("Connecting to: " + url.toString());
String SOAPAction = "";
URLConnection connection = null;
try {
connection = url.openConnection();
httpConn = (HttpURLConnection) connection;
httpConn.setRe... | private static void run(Display display, int x) {
Shell shell = new Shell(display);
shell.setBounds(0, 0, 350, 350);
shell.setLayout(new FillLayout(SWT.VERTICAL));
ERDiagramEditPartFactory editPartFactory = new ERDiagramEditPartFactory();
GraphicalViewer viewer = new Scrollin... | false |
5,181 | 15,700,440 | 12,579,074 | private void getViolationsReportBySLATIdYearMonth() throws IOException {
String xmlFile10Send = System.getenv("SLASOI_HOME") + System.getProperty("file.separator") + "Integration" + System.getProperty("file.separator") + "soap" + System.getProperty("file.separator") + "getViolationsReportBySLATIdYearMonth.x... | public static XMLConfigurator loadFromDefaultSystemProperty() throws IOException {
String urlStr = System.getProperty(DEFAULT_SYS_PROP_NAME);
if (urlStr == null || urlStr.length() == 0) {
return null;
}
InputStream in = null;
DOMRetriever xmlDoc = null;
tr... | false |
5,182 | 6,168,445 | 17,203,112 | public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | private void trySend(Primitive p) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
mSerializer.serialize(p, out);
} catch (SerializerException e) {
mTxManager.notifyErrorResponse(p.getTransactionID(), ImErrorInfo.SERIALIZER_ERROR, "I... | false |
5,183 | 15,471,169 | 9,860,859 | public static String getMD5(String value) {
if (StringUtils.isBlank(value)) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes("UTF-8"));
return toHexString(md.digest());
} catch (Throwable e) {
ret... | @Override
public boolean identification(String username, String password) {
this.getLogger().info(DbUserServiceImpl.class, ">>>identification " + username + "<<<");
try {
IFeelerUser user = this.getDbServ().queryFeelerUser(username);
if (user == null) {
re... | true |
5,184 | 2,767,689 | 8,562,659 | @Override
public void loadData() {
try {
String url = "http://ichart.finance.yahoo.com/table.csv?s=" + symbol + "&a=00&b=2&c=1962&d=11&e=11&f=2099&g=d&ignore=.csv";
URLConnection conn = (new URL(url)).openConnection();
conn.connect();
BufferedReader in = n... | protected void validate(long googcmId, long reservePrice, String description, String category, int days, String status, String title, byte[] imgBytes) throws PortalException, SystemException {
if (Validator.isNull(description)) throw new AuctionDescriptionException(); else if (Validator.isNull(title)) throw... | true |
5,185 | 12,454,179 | 19,760,848 | @Override
public void excluir(Disciplina t) throws Exception {
PreparedStatement stmt = null;
String sql = "DELETE from disciplina where id_disciplina = ?";
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1, t.getIdDisciplina());
stmt.executeUp... | public static void main(String[] args) {
try {
Class.forName("org.hsqldb.jdbcDriver");
} catch (ClassNotFoundException e) {
System.out.println("HSQL Driver not found.");
System.exit(1);
}
Connection con = null;
try {
con = Drive... | true |
5,186 | 555,513 | 11,090,449 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public static Drawable fetchCachedDrawable(String url) throws MalformedURLException, IOException {
Log.d(LOG_TAG, "Fetching cached : " + url);
String cacheName = md5(url);
checkAndCreateDirectoryIfNeeded();
File r = new File(CACHELOCATION + cacheName);
if (!r.exists()) {
... | true |
5,187 | 479,674 | 1,655,162 | public static synchronized String getSequenceNumber(String SequenceName) {
String result = "0";
Connection conn = null;
Statement ps = null;
ResultSet rs = null;
try {
conn = TPCW_Database.getConnection();
conn.setAutoCommit(false);
String ... | public boolean updatenum(int num, String pid) {
boolean flag = false;
Connection conn = null;
PreparedStatement pm = null;
try {
conn = Pool.getConnection();
conn.setAutoCommit(false);
pm = conn.prepareStatement("update addwuliao set innum=? where ... | true |
5,188 | 14,776,698 | 18,457,132 | private final int copyFiles(File[] list, String dest, boolean dest_is_full_name) throws InterruptedException {
Context c = ctx;
File file = null;
for (int i = 0; i < list.length; i++) {
boolean existed = false;
FileChannel in = null;
... | private static void copyFile(File src, File dst) throws IOException {
FileChannel in = new FileInputStream(src).getChannel();
FileChannel out = new FileOutputStream(dst).getChannel();
in.transferTo(0, in.size(), out);
in.close();
out.close();
}
| true |
5,189 | 5,870,262 | 14,876,163 | @Test
public void testDoGet() throws Exception {
HttpHost targetHost = new HttpHost("localhost", 8080, "http");
DefaultHttpClient client = new DefaultHttpClient();
client.getCredentialsProvider().setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePa... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | false |
5,190 | 19,180,786 | 7,996,909 | public void testCopyFolderContents() throws IOException {
log.info("Running: testCopyFolderContents()");
IOUtils.copyFolderContents(srcFolderName, destFolderName);
Assert.assertTrue(destFile1.exists() && destFile1.isFile());
Assert.assertTrue(destFile2.exists() && destFile2.isFile())... | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | false |
5,191 | 22,409,057 | 20,306,674 | private void sortWhats(String[] labels, int[] whats, String simplifyString) {
int n = whats.length;
boolean swapped;
do {
swapped = false;
for (int i = 0; i < n - 1; i++) {
int i0_pos = simplifyString.indexOf(labels[whats[i]]);
int i1_p... | public int create(BusinessObject o) throws DAOException {
int insert = 0;
int id = 0;
Bill bill = (Bill) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("INSERT_BILL"));
pst.setDate(1, new java.sql.Date(bill.getDate().getTime(... | false |
5,192 | 79,355 | 12,787,570 | 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 copyContent(final File srcFile, final File dstFile, final boolean gzipContent) throws IOException {
final File dstFolder = dstFile.getParentFile();
dstFolder.mkdirs();
if (!dstFolder.exists()) {
throw new RuntimeException("Unable to create the folder " + dstFo... | true |
5,193 | 12,577,673 | 18,942,517 | public void performOk(final IProject project, final TomcatPropertyPage page) {
page.setPropertyValue("tomcat.jdbc.driver", c_drivers.getText());
page.setPropertyValue("tomcat.jdbc.url", url.getText());
page.setPropertyValue("tomcat.jdbc.user", username.getText());
... | public Long addRole(AuthSession authSession, RoleBean roleBean) {
PreparedStatement ps = null;
DatabaseAdapter dbDyn = null;
try {
dbDyn = DatabaseAdapter.getInstance();
CustomSequenceType seq = new CustomSequenceType();
seq.setSequenceName("seq_WM_AUTH_AC... | false |
5,194 | 15,153,344 | 12,222,321 | public ActualTask(TEditor editor, TIGDataBase dataBase, String directoryPath) {
File myDirectory = new File(directoryPath);
int i;
Vector images = new Vector();
images = dataBase.allImageSearch();
lengthOfTask = images.size() * 2;
String di... | public static long copyFile(File source, File target) throws IOException {
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = new FileInputStream(source);
fileOutputStream = new FileOutputStream(target);
... | true |
5,195 | 11,798,810 | 587,211 | private synchronized Document executeHttpMethod(final HttpUriRequest httpRequest) throws UnauthorizedException, ThrottledException, ApiException {
if (!isNextRequestAllowed()) {
try {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Wait " + WAITING_TIME + "ms for... | @Override
public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException {
String url = request.getParameter(URL_PARAM_NAME);
if (StringUtils.isEmpty(url)) {
log.error("url parameter not provided.");
throw new DataSourceException(Re... | false |
5,196 | 6,013,590 | 3,011,295 | public void saveUserUpFile(UserInfo userInfo, String distFileName, InputStream instream) throws IOException {
String fullPicFile = BBSCSUtil.getUserWebFilePath(userInfo.getId()) + distFileName;
String fullPicFileSmall = BBSCSUtil.getUserWebFilePath(userInfo.getId()) + distFileName + Constant.IMG_SMA... | public static void main(String args[]) throws IOException, TrimmerException, DataStoreException {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("ace", "path to ace file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("phd", "path ... | true |
5,197 | 17,200,624 | 7,169,017 | public void run() {
runCounter++;
try {
LOGGER.info("Fetching feed [" + runCounter + "] " + _feedInfo);
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
disableSSLCertificateChecking(httpClient)... | private void download(String fileName, HttpServletResponse response) throws IOException {
TelnetInputStream ftpIn = ftpClient_sun.get(fileName);
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
OutputStream out = null;
try {
... | false |
5,198 | 14,960,335 | 10,095,870 | private String readData(URL url) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer responseBuffer = new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
responseBuffer.app... | public String getMD5String(String par1Str) {
try {
String s = (new StringBuilder()).append(field_27370_a).append(par1Str).toString();
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(s.getBytes(), 0, s.length());
return (new... | false |
5,199 | 12,721,184 | 20,089,257 | public static int fileCopy(String strSourceFilePath, String strDestinationFilePath, String strFileName) throws IOException {
String SEPARATOR = System.getProperty("file.separator");
File dir = new File(strSourceFilePath);
if (!dir.exists()) dir.mkdirs();
File realDir = new File(strDe... | public void store(String path, InputStream stream) throws IOException {
toIgnore.add(normalizePath(path));
ZipEntry entry = new ZipEntry(path);
zipOutput.putNextEntry(entry);
IOUtils.copy(stream, zipOutput);
zipOutput.closeEntry();
}
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.