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 |
|---|---|---|---|---|---|
3,700 | 9,581,835 | 22,122,895 | public static void main(String[] args) {
String WTKdir = null;
String sourceFile = null;
String instrFile = null;
String outFile = null;
String jadFile = null;
Manifest mnf;
if (args.length == 0) {
usage();
return;
}
int... | protected String getHashCode(String value) {
if (log.isDebugEnabled()) log.debug("getHashCode(...) -> begin");
String retVal = null;
try {
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(value.getBytes());
byte[] digest = m... | false |
3,701 | 22,924,617 | 4,794,470 | private String md5(String s) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messag... | private void load() throws SQLException {
Connection conn = null;
Statement stmt = null;
try {
conn = FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
ClearData.clearTables(stmt);
stmt.execut... | false |
3,702 | 2,930,278 | 6,304,370 | public static void connectServer() {
if (ftpClient == null) {
int reply;
try {
setArg(configFile);
ftpClient = new FTPClient();
ftpClient.setDefaultPort(port);
ftpClient.configure(getFtpConfig());
ftpClie... | public static String[] viewFilesToImport(HttpSession session) {
FTPClient ftp = new FTPClient();
CofaxToolsUser user = (CofaxToolsUser) session.getAttribute("user");
String importFTPServer = (String) user.workingPubConfigElementsHash.get("IMPORTFTPSERVER") + "";
String importFTPLogin... | true |
3,703 | 6,258,282 | 20,183,893 | 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... | @Override
public String decryptString(String passphrase, String crypted) throws Exception {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(passphrase.getBytes("UTF-8"));
byte digest[] = md.digest();
String digestString = base64encode(digest);
S... | true |
3,704 | 1,833,576 | 13,325,917 | public FTPClient getFTP(final Credentials credentials, final String remoteFile) throws NumberFormatException, SocketException, IOException, AccessDeniedException {
String fileName = extractFilename(remoteFile);
String fileDirectory = getPathName(remoteFile).substring(0, getPathName(remoteFile).index... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getCanonicalPath());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getCanonicalP... | false |
3,705 | 3,532,296 | 10,313,620 | public String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | public void read(Model model, String url) {
try {
URLConnection conn = new URL(url).openConnection();
String encoding = conn.getContentEncoding();
if (encoding == null) {
read(model, conn.getInputStream(), url);
} else {
read(mo... | false |
3,706 | 18,287,600 | 13,745,786 | public static String getMD5Hash(String input) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(input.getBytes());
byte[] result = md5.digest();
StringBuffer hexString = new StringBuffer();
for (int i... | private String fetchHtml(URL url) throws IOException {
URLConnection connection;
if (StringUtils.isNotBlank(proxyHost) && proxyPort != null) {
Proxy proxy = new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved(proxyHost, proxyPort));
connection = url.openConnection(p... | false |
3,707 | 597,799 | 9,543,284 | 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 final void copyFile(String srcFilename, String dstFilename) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel ifc = null;
FileChannel ofc = null;
Util.copyBuffer.clear();
try {
fis = new FileInputStream... | true |
3,708 | 5,402,254 | 10,959,933 | public void setKey(String key) {
MessageDigest md5;
byte[] mdKey = new byte[32];
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(key.getBytes());
byte[] digest = md5.digest();
System.arraycopy(digest, 0, mdKey, 0, 16);
Syst... | public static void main(String[] args) throws Exception {
FileChannel fc = new FileOutputStream("data.txt").getChannel();
fc.write(ByteBuffer.wrap("some text ".getBytes()));
fc.close();
fc = new RandomAccessFile("data.txt", "rw").getChannel();
fc.position(fc.size());
... | false |
3,709 | 556,271 | 19,549,579 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | 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) {... | true |
3,710 | 17,275,141 | 21,877,683 | public static void copy(String sourceName, String destName, StatusWindow status) throws IOException {
File src = new File(sourceName);
File dest = new File(destName);
BufferedInputStream source = null;
BufferedOutputStream destination = null;
byte[] buffer;
int bytes_... | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (!(request instanceof HttpServletRequest)) {
log.fatal("not a http request");
return;
}
HttpServletRequest httpRequest = (HttpServletReq... | true |
3,711 | 23,563,689 | 15,663,187 | @Override
protected String doInBackground(Location... params) {
if (params == null || params.length == 0 || params[0] == null) {
return null;
}
Location location = params[0];
String address = "";
... | public ClientDTO changePassword(String pMail, String pMdp) {
Client vClientBean = null;
ClientDTO vClientDTO = null;
vClientBean = mClientDao.getClient(pMail);
if (vClientBean != null) {
MessageDigest vMd5Instance;
try {
vMd5Instance = MessageD... | false |
3,712 | 5,450,104 | 19,189,367 | private static void grab(String urlString) throws MalformedURLException, IOException {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = null;
StringBuffer sb = new StringBuffer();
in =... | public void insert() throws Exception {
Connection con = DbUtil.connectToDb();
PreparedStatement pStmt = null;
try {
pStmt = con.prepareStatement("INSERT INTO " + Constants.TABLENAME + " (name,phone,address)" + " values(?,?,?)");
con.setAutoCommit(false);
... | false |
3,713 | 15,854,368 | 15,659,812 | 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 {
... | private static void generateTIFF(Connection con, String category, String area_code, String topic_code, String timeseries, String diff_timeseries, Calendar time, String area_label, String raster_label, String image_label, String note, Rectangle2D bounds, Rectangle2D raster_bounds, String source_filename, String diff... | false |
3,714 | 19,142,737 | 19,060,603 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void copyFile(File in, File out) throws IOException {
if (in.getCanonicalPath().equals(out.getCanonicalPath())) {
return;
}
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
... | true |
3,715 | 210,587 | 2,494,612 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private void update() throws IOException {
FileOutputStream out = new FileOutputStream(combined);
try {
File[] _files = listJavascript();
List<File> files = new ArrayList<File>(Arrays.asList(_files));
files.add(0, new File(jsdir.getAbsolute... | true |
3,716 | 1,102,936 | 7,998,444 | public static void writeInputStreamToFile(final InputStream stream, final File target) {
long size = 0;
FileOutputStream fileOut;
try {
fileOut = new FileOutputStream(target);
size = IOUtils.copyLarge(stream, fileOut);
} catch (FileNotFoundException e) {
... | public static boolean isDicom(URL url) {
assert url != null;
boolean isDicom = false;
BufferedInputStream is = null;
try {
is = new BufferedInputStream(url.openStream());
is.skip(DICOM_PREAMBLE_SIZE);
byte[] buf = new byte[DICM.length];
... | false |
3,717 | 20,566,090 | 19,382,420 | public void run() {
if (getCommand() == null) throw new IllegalArgumentException("Given command is null!");
if (getSocketProvider() == null) throw new IllegalArgumentException("Given connection is not open!");
if (getCommand() instanceof ListCommand) {
try {
setRe... | 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... | false |
3,718 | 301,804 | 12,483,251 | static String fetchURLComposeExternPackageList(String urlpath, String pkglisturlpath) {
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (Malforme... | private void weightAndPlaceClasses() {
int rows = getRows();
for (int curRow = _maxPackageRank; curRow < rows; curRow++) {
xPos = getHGap() / 2;
BOTLObjectSourceDiagramNode[] rowObject = getObjectsInRow(curRow);
for (int i = 0; i < rowObject.length; i++) {
... | false |
3,719 | 2,732,151 | 9,295,754 | public static String compute(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("UTF-8"), 0, text.length());
md5hash = md.digest();
return convertToHex(md... | public static String encryptPassword(String password) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("SHA1");
digest.update(password.getBytes("UTF-8"));
byte[] hash = digest.digest();
StringBuffer buf = new StringBuffer();
f... | true |
3,720 | 3,609,806 | 20,305,472 | private static String getData(String myurl) throws Exception {
System.out.println("getdata");
URL url = new URL(myurl);
uc = (HttpURLConnection) url.openConnection();
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String temp = "", k = "";
while ... | @Override
public void run() {
try {
FileChannel out = new FileOutputStream(outputfile).getChannel();
long pos = 0;
status.setText("Slučovač: Proces Slučování spuštěn.. Prosím čekejte..");
for (int i = 1; i <= noofparts; i++) {
FileChannel i... | false |
3,721 | 4,773,756 | 4,114,529 | public void zipDocsetFiles(SaxHandler theXmlHandler, int theEventId, Attributes theAtts) throws BpsProcessException {
ZipOutputStream myZipOut = null;
BufferedInputStream myDocumentInputStream = null;
String myFinalFile = null;
String myTargetPath = null;
String myTargetFileN... | @Override
public void save(File folder) {
actInstance = instance;
this.setProperty(EsomMapper.PROPERTY_INSTANCE, String.valueOf(actInstance));
log.debug("instance: " + this.getProperty(EsomMapper.PROPERTY_INSTANCE));
if (this.getProperty(EsomMapper.PROPERTY_LRN_RADIO_SELECTED) ==... | true |
3,722 | 8,204,996 | 23,165,929 | public List<Template> getTemplatesByKeywordsAndPage(String keywords, int page) {
String newKeywords = keywords;
if (keywords == null || keywords.trim().length() == 0) {
newKeywords = TemplateService.NO_KEYWORDS;
}
List<Template> templates = new ArrayList<Template>();
... | private void createCanvas() {
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.setRootEditPart(new ScalableRootEditPart());
viewer.setEditPartFactory(new BlockEditPartFactory());
viewer.createControl(this);
viewer.setKeyHandler(new GraphicalViewerKeyHandler(vie... | false |
3,723 | 17,231,138 | 11,986,777 | @Override
protected AuthenticationHandlerResponse authenticateInternal(final Connection c, final AuthenticationCriteria criteria) throws LdapException {
byte[] hash;
try {
final MessageDigest md = MessageDigest.getInstance(passwordScheme);
md.update(criteria.getCredential... | private List<Token> generateTokens(int tokenCount) throws XSServiceException {
final List<Token> tokens = new ArrayList<Token>(tokenCount);
final Random r = new Random();
String t = Long.toString(new Date().getTime()) + Integer.toString(r.nextInt());
final MessageDigest m;
tr... | true |
3,724 | 21,113,767 | 10,682,592 | @Override
public void render(Output output) throws IOException {
output.setStatus(headersFile.getStatusCode(), headersFile.getStatusMessage());
for (Entry<String, Set<String>> header : headersFile.getHeadersMap().entrySet()) {
Set<String> values = header.getValue();
for (... | private InputStream open(String url) throws IOException {
debug(url);
if (!useCache) {
return new URL(url).openStream();
}
File f = new File(System.getProperty("java.io.tmpdir", "."), Digest.SHA1.encrypt(url) + ".xml");
debug("Cache : " + f);
if (f.exists(... | true |
3,725 | 1,543,361 | 5,918,578 | public ProgramSymbol createNewProgramSymbol(int programID, String module, String symbol, int address, int size) throws AdaptationException {
ProgramSymbol programSymbol = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
... | public void connect(String method, String data, String urlString, Properties properties, boolean allowredirect) throws Exception {
if (urlString != null) {
try {
url_ = new URL(url_, urlString);
} catch (Exception e) {
throw new Exception("Invalid URL"... | false |
3,726 | 22,117,571 | 3,516,106 | 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... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | false |
3,727 | 2,058,785 | 2,374,764 | public void doStatementQueryAndUpdate(Connection conn, String id) throws SQLException {
try {
int key = getNextKey();
Statement s1 = conn.createStatement();
String bValue = "doStatementQueryAndUpdate:" + id + testId;
if (key >= MAX_KEY_VALUE) {
... | private static String getHash(char[] passwd, String algorithm) throws NoSuchAlgorithmException {
MessageDigest alg = MessageDigest.getInstance(algorithm);
alg.reset();
alg.update(new String(passwd).getBytes());
byte[] digest = alg.digest();
StringBuilder sb = new StringBuilde... | false |
3,728 | 15,410,299 | 12,448,713 | public boolean isValid(WizardContext context) {
if (serviceSelection < 0) {
return false;
}
ServiceReference selection = (ServiceReference) serviceList.getElementAt(serviceSelection);
if (selection == null) {
return false;
}
String function = (... | private void writeGif(String filename, String outputFile) throws IOException {
File file = new File(filename);
InputStream in = new FileInputStream(file);
FileOutputStream fout = new FileOutputStream(outputFile);
int totalRead = 0;
int readBytes = 0;
int blockSize = 6... | false |
3,729 | 14,787,421 | 21,956,399 | private void saveStateAsLast(URL url) {
InputStream sourceStream = null;
OutputStream destinationStream = null;
File lastBundlesTxt = getLastBundleInfo();
try {
try {
destinationStream = new FileOutputStream(lastBundlesTxt);
sourceStream = ... | @Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("application/json");
resp.setCharacterEncoding("utf-8");
String format = req.getParameter("format");
EntityManager em = EMF.get().createEntityManager();
... | false |
3,730 | 8,558,409 | 7,507,773 | public static final void zip(final ZipOutputStream out, final File f, String base) throws Exception {
if (f.isDirectory()) {
final File[] fl = f.listFiles();
base = base.length() == 0 ? "" : base + File.separator;
for (final File element : fl) {
zip(out, e... | public boolean restore(File directory) {
log.debug("restore file from directory " + directory.getAbsolutePath());
try {
if (!directory.exists()) return false;
String[] operationFileNames = directory.list();
if (operationFileNames.length < 6) {
log.... | true |
3,731 | 16,351,775 | 2,538,511 | 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 static void copyFile(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| true |
3,732 | 20,009,109 | 427,727 | public static void concatFiles(final String as_base_file_name) throws IOException, FileNotFoundException {
new File(as_base_file_name).createNewFile();
final OutputStream lo_out = new FileOutputStream(as_base_file_name, true);
int ln_part = 1, ln_readed = -1;
final byte[] lh_buffer =... | 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));
... | true |
3,733 | 12,727,792 | 22,554,509 | public static void copyFile(File source, File target) throws Exception {
if (source == null || target == null) {
throw new IllegalArgumentException("The arguments may not be null.");
}
try {
FileChannel srcChannel = new FileInputStream(source).getChannel();
... | public void initialize(AtomPropsMenu menu) {
propertiesMenu = menu;
if (shieldings == null) {
try {
URL url = this.getClass().getClassLoader().getResource(RF);
InputStreamReader isr = new InputStreamReader(url.openStream());
BufferedReader ... | false |
3,734 | 21,321,506 | 21,907,699 | public static int convertImage(InputStream is, OutputStream os, String command) throws IOException, InterruptedException {
if (logger.isInfoEnabled()) {
logger.info(command);
}
Process p = Runtime.getRuntime().exec(command);
ByteArrayOutputStream errOut = new ByteArrayOut... | public void getFile(OutputStream output, Fragment fragment) throws Exception {
Assert.Arg.notNull(output, "output");
Assert.Arg.notNull(fragment, "fragment");
Assert.Arg.notNull(fragment.getId(), "fragment.getId()");
if (this.delegate != null) {
this.delegate.getFile(outp... | true |
3,735 | 13,863,615 | 775,447 | protected String getLibJSCode() throws IOException {
if (cachedLibJSCode == null) {
InputStream is = getClass().getResourceAsStream(JS_LIB_FILE);
StringWriter output = new StringWriter();
IOUtils.copy(is, output);
cachedLibJSCode = output.toString();
}... | void copyFile(String src, String dest) throws IOException {
int amount;
byte[] buffer = new byte[4096];
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
while ((amount = in.read(buffer)) != -1) out.write(buffer, 0, amount);
... | true |
3,736 | 22,842,674 | 12,039,036 | private byte[] getImage(String urlpath) throws Exception {
URL url = new URL(urlpath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(6 * 1000);
if (conn.getResponseCode() == 200) {
InputStre... | public static ArrayList<Credential> importCredentials(String urlString) {
ArrayList<Credential> results = new ArrayList<Credential>();
try {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer... | false |
3,737 | 22,319,064 | 7,363,810 | public void addRegisterInfo(HttpServletRequest request) throws ApplicationException {
String[] pids = request.getParameterValues("pid");
if (pids == null || pids.length <= 0) throw new ApplicationException("��ѡ��Ҫ���IJ�Ʒ");
RegisterDao registerDao = new RegisterDao();
Register registe... | public RandomAccessFileOrArray(URL url) throws IOException {
InputStream is = url.openStream();
try {
this.arrayIn = InputStreamToArray(is);
} finally {
try {
is.close();
} catch (IOException ioe) {
}
}
}
| false |
3,738 | 16,987,999 | 17,630,909 | private void copyFile(File sourceFile, File destFile) throws IOException {
if (!sourceFile.exists()) {
return;
}
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
source = n... | public static int[] sortAscending(double input[]) {
int[] order = new int[input.length];
for (int i = 0; i < order.length; i++) order[i] = i;
for (int i = input.length; --i >= 0; ) {
for (int j = 0; j < i; j++) {
if (input[j] > input[j + 1]) {
... | false |
3,739 | 21,929,693 | 18,374,479 | private void importUrl(String str) throws Exception {
URL url = new URL(str);
InputStream xmlStream = url.openStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
MessageHolder messages = MessageHolder.getInstance();
DocumentBuilder builder = facto... | public void removeUser(final User user) throws IOException {
try {
Connection conn = null;
boolean autoCommit = false;
try {
conn = pool.getConnection();
autoCommit = conn.getAutoCommit();
conn.setAutoCommit(false);
... | false |
3,740 | 7,128,553 | 21,374,041 | public Vector Get() throws Exception {
String query_str = BuildYahooQueryString();
if (query_str == null) return null;
Vector result = new Vector();
HttpURLConnection urlc = null;
try {
URL url = new URL(URL_YAHOO_QUOTE + "?" + query_str + "&" + FORMAT);
... | public void writeToStream(OutputStream out) throws IOException {
InputStream result = null;
if (tempFile != null) {
InputStream input = new BufferedInputStream(new FileInputStream(tempFile));
IOUtils.copy(input, out);
IOUtils.closeQuietly(input);
} else if... | false |
3,741 | 11,265,073 | 11,904,056 | public static void zip(File srcDir, File destFile, FileFilter filter) throws IOException {
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new FileOutputStream(destFile));
Collection<File> files = FileUtils.listFiles(srcDir, TrueFileFilter.TRUE, TrueFileFilter.TRU... | public static void convertEncoding(File infile, File outfile, String from, String to) throws IOException, UnsupportedEncodingException {
InputStream in;
if (infile != null) in = new FileInputStream(infile); else in = System.in;
OutputStream out;
outfile.createNewFile();
if (o... | true |
3,742 | 19,147,296 | 17,467,777 | public boolean ponerFlotantexRonda(int idJugadorDiv, int idRonda, int dato) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET flotante = " + dato + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRonda;
try {
co... | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| false |
3,743 | 6,242,862 | 16,353,456 | public void reload() throws SAXException, IOException {
if (url != null) {
java.io.InputStream is = url.openStream();
configDoc = builder.parse(is);
is.close();
System.out.println("XML config file read correctly from " + url);
} else {
conf... | private void fileCopy(File filename) throws IOException {
if (this.stdOut) {
this.fileDump(filename);
return;
}
File source_file = new File(spoolPath + "/" + filename);
File destination_file = new File(copyPath + "/" + filename);
FileInputStream source... | false |
3,744 | 1,169,633 | 8,711,848 | public static void reset() throws Exception {
Session session = DataStaticService.getHibernateSessionFactory().openSession();
try {
Connection connection = session.connection();
try {
Statement statement = connection.createStatement();
try {
... | public boolean urlToSpeech(String urlPath) {
boolean ok = false;
try {
URL url = new URL(urlPath);
InputStream is = url.openStream();
ok = streamToSpeech(is);
} catch (IOException ioe) {
System.err.println("Can't read data from " + urlPath);
... | false |
3,745 | 22,366,637 | 13,946,708 | public int delete(BusinessObject o) throws DAOException {
int delete = 0;
Project project = (Project) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("DELETE_PROJECT"));
pst.setInt(1, project.getId());
delete = pst.execute... | @Override
public String encryptPassword(String password) throws JetspeedSecurityException {
if (securePasswords == false) {
return password;
}
if (password == null) {
return null;
}
try {
if ("SHA-512".equals(passwordsAlgorithm)) {
... | false |
3,746 | 18,542,300 | 17,444,336 | public static void copy(File src, File dest) throws IOException {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel destChannel = new FileOutputStream(dest).getChannel();
destChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
... | public static synchronized String encrypt(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
return new BASE64Encoder().encode(raw);
} catch (NoSuchA... | false |
3,747 | 11,527,585 | 18,427,451 | @Test
public final void testImportODScontentXml() throws Exception {
URL url = ODSTableImporterTest.class.getResource("/Messages.ods_FILES/content.xml");
String systemId = url.getPath();
InputStream in = url.openStream();
ODSTableImporter b = new ODSTableImporter();
b.imp... | static void cleanFile(File file) {
final Counter cnt = new Counter();
final File out = new File(FileUtils.appendToFileName(file.getAbsolutePath(), ".cleaned"));
final SAMFileReader reader = new SAMFileReader(file);
final SAMRecordIterator it = reader.iterator();
final SAMFile... | false |
3,748 | 19,274,388 | 15,734,479 | public static String generateHash(String string, String algoritmo) {
try {
MessageDigest md = MessageDigest.getInstance(algoritmo);
md.update(string.getBytes());
byte[] result = md.digest();
int firstPart;
int lastPart;
StringBuilder sB... | private List<String[]> retrieveData(String query) {
List<String[]> data = new Vector<String[]>();
query = query.replaceAll("\\s", "+");
String q = "http://www.uniprot.org/uniprot/?query=" + query + "&format=tab&columns=id,protein%20names,organism";
try {
URL url = new URL... | false |
3,749 | 7,327,832 | 9,806,878 | @Override
protected File doInBackground(String... params) {
try {
String urlString = params[0];
final String fileName = params[1];
if (!urlString.endsWith("/")) {
urlString += "/";
}
urlString... | private static void validateJarFile(URL url) throws IOException {
InputStream stream = url.openStream();
JarInputStream jarStream = new JarInputStream(stream, true);
try {
while (null != jarStream.getNextEntry()) {
}
} finally {
try {
... | false |
3,750 | 5,145,801 | 13,447,231 | public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser("");
fc.setMultiSelectionEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int option = 0;
boolean save = m_data != null;
if (save) option = fc.showSaveDialog(this); else o... | public void copy(String pathFileIn, String pathFileOut) {
try {
File inputFile = new File(pathFileIn);
File outputFile = new File(pathFileOut);
FileReader in = new FileReader(inputFile);
File outDir = new File(DirOut);
if (!outDir.exists()) outDir.... | true |
3,751 | 12,739,584 | 7,823,489 | public void testTransactions0010() throws Exception {
Connection cx = getConnection();
dropTable("#t0010");
Statement stmt = cx.createStatement();
stmt.executeUpdate("create table #t0010 " + " (i integer not null, " + " s char(10) not null) ");
cx.setAutoCommi... | protected String getPostRequestContent(String urlText, String postParam) throws Exception {
URL url = new URL(urlText);
HttpURLConnection urlcon = (HttpURLConnection) url.openConnection();
String line = null;
try {
urlcon.setRequestMethod("POST");
urlcon.setUs... | false |
3,752 | 9,209,383 | 441,377 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final Map<String, String> fileAttr = new HashMap<String, String>();
boolean download = false;
String dw = req.getParameter("d");
if (StringUtils.isNotEmpty(dw) ... | 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 |
3,753 | 17,477,951 | 3,059,648 | public static void copy(String inputFile, String outputFile) throws Exception {
try {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | public static String sendScripts(Session session) {
Channel channel = null;
String tempDirectory = "";
Logger.getLogger(RsyncHelper.class.getName()).log(Level.INFO, "Start sendScripts.");
try {
{
channel = session.openChannel("exec");
final... | true |
3,754 | 13,521,323 | 20,822,727 | public static void copyFile(final String inFile, final String outFile) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(inFile).getChannel();
out = new FileOutputStream(outFile).getChannel();
in.transferTo(0, in.size(), out);... | private static void copyFile(String fromFile, String toFile) throws Exception {
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
to = new FileOutputStream(toFile);
byte[] buffer = new byte[4096];
... | true |
3,755 | 8,041,989 | 3,253,028 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException {
String requestURI = req.getRequestURI();
logger.info("The requested URI: {}", requestURI);
String parameter = requestURI.substring(requestURI.lastIndexOf(ARXIVID_ENTRY) + ARXIVID_EN... | public static List<String> unTar(File tarFile, File directory) throws IOException {
List<String> result = new ArrayList<String>();
InputStream inputStream = new FileInputStream(tarFile);
TarArchiveInputStream in = new TarArchiveInputStream(inputStream);
TarArchiveEntry entry = in.get... | true |
3,756 | 15,535,344 | 22,537,277 | public void testDoubleNaN() {
double value = 0;
boolean wasEqual = false;
String message = "DB operation completed";
String ddl1 = "DROP TABLE t1 IF EXISTS;" + "CREATE TABLE t1 ( d DECIMAL, f DOUBLE, l BIGINT, i INTEGER, s SMALLINT, t TINYINT, " + "dt DATE DEFAULT CURRENT_DATE, ti TI... | @Test
public void testSQLite() {
log("trying SQLite..");
for (int i = 0; i < 10; i++) {
Connection c = null;
try {
Class.forName("SQLite.JDBCDriver");
c = DriverManager.getConnection("jdbc:sqlite:/C:/Source/SRFSurvey/app/src/org/speakright/... | true |
3,757 | 21,247,844 | 21,266,147 | public static void kopirujSoubor(File vstup, File vystup) throws IOException {
FileChannel sourceChannel = new FileInputStream(vstup).getChannel();
FileChannel destinationChannel = new FileOutputStream(vystup).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel... | public void execute() {
File sourceFile = new File(oarfilePath);
File destinationFile = new File(deploymentDirectory + File.separator + sourceFile.getName());
try {
FileInputStream fis = new FileInputStream(sourceFile);
FileOutputStream fos = new FileOutputStream(dest... | true |
3,758 | 2,608,416 | 14,617,443 | public static Model downloadModel(String url) {
Model model = ModelFactory.createDefaultModel();
try {
URLConnection connection = new URL(url).openConnection();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnectio... | public void reademi(Vector<String> descriptions, Vector<String> links, String linkaddress, String idmap) {
InputStream is = null;
URL url;
ArrayList<String> keys = new ArrayList<String>();
ArrayList<String> names = new ArrayList<String>();
try {
url = new URL(idma... | true |
3,759 | 5,113,796 | 17,477,951 | private BibtexDatabase importInspireEntries(String key, OutputPrinter frame) {
String url = constructUrl(key);
try {
HttpURLConnection conn = (HttpURLConnection) (new URL(url)).openConnection();
conn.setRequestProperty("User-Agent", "Jabref");
InputStream inputStr... | public static void copy(String inputFile, String outputFile) throws Exception {
try {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | false |
3,760 | 5,953,607 | 14,389,765 | public synchronized void write() throws IOException {
ZipOutputStream jar = new ZipOutputStream(new FileOutputStream(jarPath));
int index = className.lastIndexOf('.');
String packageName = className.substring(0, index);
String clazz = className.substring(index + 1);
String di... | private void loadProperties() {
if (properties == null) {
properties = new Properties();
try {
URL url = getClass().getResource(propsFile);
properties.load(url.openStream());
} catch (IOException ioe) {
ioe.printStackTrace()... | false |
3,761 | 20,085,553 | 23,337,132 | public int sftp_connect(HttpServletRequest request) {
Map<String, Object> setting = (Map<String, Object>) request.getAttribute("globalSetting");
int ftpssl = Common.intval(setting.get("ftpssl") + "");
String ftphost = setting.get("ftphost") + "";
int ftpport = Common.intval(setting.g... | @SuppressWarnings("rawtypes")
public static String[] loadAllPropertiesFromClassLoader(Properties properties, String... resourceNames) throws IOException {
List successLoadProperties = new ArrayList();
for (String resourceName : resourceNames) {
URL url = GeneratorProperties.class.get... | false |
3,762 | 9,678,341 | 17,267,601 | public static void copy(Object arg1, Object arg2) {
Writer writer = null;
Reader reader = null;
InputStream inStream = null;
OutputStream outStream = null;
try {
if (arg2 instanceof Writer) {
writer = (Writer) arg2;
if (arg1 instanc... | public void setBckImg(String newPath) {
try {
File inputFile = new File(getPath());
File outputFile = new File(newPath);
if (!inputFile.getCanonicalPath().equals(outputFile.getCanonicalPath())) {
FileInputStream in = new FileInputStream(inputFile);
... | true |
3,763 | 12,089,424 | 19,670,855 | public static Image getPluginImage(Object plugin, String name) {
try {
try {
URL url = getPluginImageURL(plugin, name);
if (m_URLImageMap.containsKey(url)) return m_URLImageMap.get(url);
InputStream is = url.openStream();
Image imag... | 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 |
3,764 | 17,477,957 | 1,455,792 | public static void unzipModel(String filename, String tempdir) throws Exception {
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(filename);
int BUFFER = 2048;
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fi... | public void generate(String rootDir, RootModel root) throws Exception {
IOUtils.copyStream(HTMLGenerator.class.getResourceAsStream("stylesheet.css"), new FileOutputStream(new File(rootDir, "stylesheet.css")));
Velocity.init();
VelocityContext context = new VelocityContext();
context.... | true |
3,765 | 10,265,164 | 2,055,408 | public String getLatestVersion(String website) {
String latestVersion = "";
try {
URL url = new URL(website + "/version");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
String string;
while ((string = buff... | public Document createDocument(String uri) throws IOException {
ParsedURL purl = new ParsedURL(uri);
InputStream is = purl.openStream(MimeTypeConstants.MIME_TYPES_SVG);
InputSource isrc = new InputSource(is);
String contentType = purl.getContentType();
int cindex = -1;
... | false |
3,766 | 23,634,465 | 20,987,164 | private static void zip(File d) throws FileNotFoundException, IOException {
String[] entries = d.list();
byte[] buffer = new byte[4096];
int bytesRead;
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(new File(d.getParent() + File.separator + "dist.zip")));
for ... | public static void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
... | true |
3,767 | 5,751,314 | 3,024,993 | 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.... | @Test
public void testCopy_readerToWriter_nullOut() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
Reader reader = new InputStreamReader(in, "US-ASCII");
try {
IOUtils.copy(reader, (Writer) null);
... | true |
3,768 | 5,777,003 | 22,986,028 | public void testDecodeJTLM_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, ... | private boolean doPost(String content) throws IOException {
logger.debug("Service Registry PutRecordHandler: " + baseurl.toString());
logger.debug("**** Service Registry PutRecord Request ****\n " + content);
HttpURLConnection huc = (HttpURLConnection) (baseurl.openConnection());
huc... | false |
3,769 | 19,063,414 | 2,105,429 | public void readData() throws IOException {
i = 0;
j = 0;
URL url = getClass().getResource("resources/Chrom_623_620.dat");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
s = br... | private byte[] pullMapBytes(String directoryLocation) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
URL url = new URL(directoryLocation);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
InputStream is = httpURL... | false |
3,770 | 2,705,336 | 9,562,033 | private static boolean verifyAppId(String appid) {
try {
String urlstr = "http://" + appid + ".appspot.com";
URL url = new URL(urlstr);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
... | public void run(String srcf, String dst) {
final Path srcPath = new Path("./" + srcf);
final Path desPath = new Path(dst);
try {
Path[] srcs = FileUtil.stat2Paths(hdfs.globStatus(srcPath), srcPath);
OutputStream out = FileSystem.getLocal(conf).create(desPath);
... | false |
3,771 | 10,384,641 | 9,924,413 | protected void setUp() throws Exception {
super.setUp();
bundles = Activator.bundleContext.getBundles();
for (int i = 0; i < bundles.length; ++i) {
if (bundles[i] != null) {
if ((bundles[i].getSymbolicName() == null) || (!bundles[i].getSymbolicName().startsWith(PS... | private void startOpening(final URL url) {
final WebAccessor wa = this;
openerThread = new Thread() {
public void run() {
iStream = null;
try {
tryProxy = false;
URLConnection connection = url.openConnection();
... | false |
3,772 | 15,964,688 | 12,104,132 | public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("LOAD")) {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new JPEGFilter());
chooser.setMultiSelectionEnabled(false);
if (chooser.showOpenDialog(getTopLevelAncestor(... | @Override
public void render(Output output) throws IOException {
output.setStatus(statusCode, statusMessage);
if (headersMap != null) {
Iterator<Entry<String, String>> iterator = headersMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, ... | true |
3,773 | 5,953,607 | 6,568,286 | public synchronized void write() throws IOException {
ZipOutputStream jar = new ZipOutputStream(new FileOutputStream(jarPath));
int index = className.lastIndexOf('.');
String packageName = className.substring(0, index);
String clazz = className.substring(index + 1);
String di... | private void getPicture(String urlPath, String picId) throws Exception {
URL url = new URL(urlPath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(10000);
if (conn.getResponseCode() == 200) {
... | false |
3,774 | 11,090,451 | 22,221,713 | public static String md5(String str) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(str.getBytes());
byte messageDigest[] = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; ... | private void copyFile(String sourceFilename, String targetFilename) throws IOException {
File source = new File(sourceFilename);
File target = new File(targetFilename);
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(target);
byte[] buf =... | false |
3,775 | 22,135,201 | 657,801 | public void testCodingFromFileSmaller() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);... | void copyFile(String from, String to) throws IOException {
File destFile = new File(to);
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
... | true |
3,776 | 2,980,810 | 17,200,624 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url = request.getParameter("proxyurl");
URLConnection conn = new URL(url).openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCac... | public void run() {
runCounter++;
try {
LOGGER.info("Fetching feed [" + runCounter + "] " + _feedInfo);
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
disableSSLCertificateChecking(httpClient)... | false |
3,777 | 6,187,415 | 2,325,202 | protected InputStream acquireInputStream(String filename) throws IOException {
Validate.notEmpty(filename);
File f = new File(filename);
if (f.exists()) {
this.originalFilename = f.getName();
return new FileInputStream(f);
}
URL url = getClass().getCla... | protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionMessages errors = new ActionMessages();
try {
boolean isMultipart = FileUpload.isMultipartContent(request);
Store store... | false |
3,778 | 4,641,591 | 4,140,310 | public static String executePost(String urlStr, Map paramsMap) throws IOException {
StringBuffer result = new StringBuffer();
HttpURLConnection connection = null;
URL url = new URL(urlStr);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
... | public boolean verify(final char[] password, final String encryptedPassword) {
MessageDigest digest = null;
int size = 0;
String base64 = null;
if (encryptedPassword.regionMatches(true, 0, "{SHA}", 0, 5)) {
size = 20;
base64 = encryptedPassword.substring(5);
... | false |
3,779 | 13,988,825 | 6,368,468 | private void setNodekeyInJsonResponse(String service) throws Exception {
String filename = this.baseDirectory + service + ".json";
Scanner s = new Scanner(new File(filename));
PrintWriter fw = new PrintWriter(new File(filename + ".new"));
while (s.hasNextLine()) {
fw.prin... | 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);
... | true |
3,780 | 17,662,157 | 14,390,570 | public static void main(String[] argz) {
int X, Y, Z;
X = 256;
Y = 256;
Z = 256;
try {
String work_folder = "C:\\Documents and Settings\\Entheogen\\My Documents\\school\\jung\\vol_data\\CT_HEAD3";
FileOutputStream out_stream = new FileOutputStream(new ... | public void actionPerformed(ActionEvent e) {
int returnVal = chooser.showSaveDialog(jd);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
String fileName = file.getPath();
String... | true |
3,781 | 9,405,784 | 10,480,049 | public void startImport(ActionEvent evt) {
final PsiExchange psiExchange = PsiExchangeFactory.createPsiExchange(IntactContext.getCurrentInstance().getSpringContext());
for (final URL url : urlsToImport) {
try {
if (log.isInfoEnabled()) log.info("Importing: " + url);
... | public static SearchItem register(String... args) {
SearchItem _return = new SearchItem();
String line = null;
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(URL_REGISTER);
List<NameValuePair> nameValuePairs ... | false |
3,782 | 3,469,470 | 15,113,543 | public static String encrypt(String text) {
char[] toEncrypt = text.toCharArray();
StringBuffer hexString = new StringBuffer();
try {
MessageDigest dig = MessageDigest.getInstance("MD5");
dig.reset();
String pw = "";
for (int i = 0; i < toEncry... | private static void identify(ContentNetwork cn, String str) {
try {
URL url = new URL(str);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
UrlUtils.setBrowserHeaders(con, null);
String key = "cn." + cn.getID() + ".identify.cookie";
... | false |
3,783 | 11,318,551 | 10,005,879 | public static int best(int r, int n, int s) {
if ((n <= 0) || (r < 0) || (r > n) || (s < 0)) return 0;
int[] rolls = new int[n];
for (int i = 0; i < n; i++) rolls[i] = d(s);
boolean found;
do {
found = false;
for (int x = 0; x < n - 1; x++) {
... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
HttpClient client = new DefaultHttpClient();
HttpGet httpGetRequest = new HttpGet("http://www.google.com/");
String line = "", responseString ... | false |
3,784 | 22,642,186 | 13,307,307 | @Override
protected int run(CmdLineParser parser) {
final List<String> args = parser.getRemainingArgs();
if (args.isEmpty()) {
System.err.println("summarysort :: WORKDIR not given.");
return 3;
}
if (args.size() == 1) {
System.err.println("summ... | private static void doCopyFile(FileInputStream in, FileOutputStream out) {
FileChannel inChannel = null, outChannel = null;
try {
inChannel = in.getChannel();
outChannel = out.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IO... | true |
3,785 | 1,854,052 | 9,219,798 | @Before
public void setUp() throws Exception {
configureSslSocketConnector();
SecurityHandler securityHandler = createBasicAuthenticationSecurityHandler();
HandlerList handlerList = new HandlerList();
handlerList.addHandler(securityHandler);
handlerList.addHandler(new Abs... | public static void decryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.DECRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | true |
3,786 | 18,536,907 | 23,537,682 | public static void copyFile(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
... | public static byte[] readResource(Class owningClass, String resourceName) {
final URL url = getResourceUrl(owningClass, resourceName);
if (null == url) {
throw new MissingResourceException(owningClass.toString() + " key '" + resourceName + "'", owningClass.toString(), resourceName);
... | true |
3,787 | 13,456,795 | 12,747,342 | private boolean processar(int iCodProd) {
String sSQL = null;
String sSQLCompra = null;
String sSQLInventario = null;
String sSQLVenda = null;
String sSQLRMA = null;
String sSQLOP = null;
String sSQLOP_SP = null;
String sWhere = null;
String sP... | public void bubbleSort(final int[] s) {
source = s;
if (source.length < 2) return;
boolean go = true;
while (go) {
go = false;
for (int i = 0; i < source.length - 1; i++) {
int temp = source[i];
if (temp > source[i + 1]) {
... | false |
3,788 | 2,831,663 | 8,317,691 | public void onMessage(Message message) {
LOG.debug("onMessage");
DownloadMessage downloadMessage;
try {
downloadMessage = new DownloadMessage(message);
} catch (JMSException e) {
LOG.error("JMS error: " + e.getMessage(), e);
return;
}
... | protected void copyFile(File src, File dest) throws Exception {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel destChannel = new FileOutputStream(dest).getChannel();
long transferred = destChannel.transferFrom(srcChannel, 0, srcChannel.size());
... | true |
3,789 | 13,447,231 | 20,601,754 | public void copy(String pathFileIn, String pathFileOut) {
try {
File inputFile = new File(pathFileIn);
File outputFile = new File(pathFileOut);
FileReader in = new FileReader(inputFile);
File outDir = new File(DirOut);
if (!outDir.exists()) outDir.... | public static File copyFile(File file, String dirName) {
File destDir = new File(dirName);
if (!destDir.exists() || !destDir.isDirectory()) {
destDir.mkdirs();
}
File src = file;
File dest = new File(dirName, src.getName());
try {
if (!dest.exi... | true |
3,790 | 10,426,070 | 10,140,299 | public static long copy(File src, long amount, File dst) {
final int BUFFER_SIZE = 1024;
long amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputS... | protected static byte[] hashPassword(byte[] saltBytes, String plaintextPassword) throws AssertionError {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw (AssertionError) new AssertionError("No MD5 me... | false |
3,791 | 17,954,700 | 14,863,753 | public static String getPasswordHash(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes());
byte[] byteData = md.digest();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < byteDa... | private void generateGuid() throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
StringBuilder stringToDigest = new StringBuilder();
long time = System.currentTimeMillis();
long rand = random.nextLong();
stringToDigest.append(time);
... | true |
3,792 | 1,881,370 | 8,209,783 | public InputStream getFileStream(String filePath) {
if (this.inJar) {
try {
URL url = getClassResourceUrl(this.getClass(), filePath);
if (url != null) {
return url.openStream();
}
} catch (IOException ioe) {
... | List<String> HttpGet(URL url) throws IOException {
List<String> responseList = new ArrayList<String>();
Logger.getInstance().logInfo("HTTP GET: " + url, null, null);
URLConnection con = url.openConnection();
con.setAllowUserInteraction(false);
BufferedReader in = new Buffered... | false |
3,793 | 21,101,965 | 1,044,656 | public String genPass() {
String salto = "Z1mX502qLt2JTcW9MTDTGBBw8VBQQmY2";
String clave = (int) (Math.random() * 10) + "" + (int) (Math.random() * 10) + "" + (int) (Math.random() * 10) + "" + (int) (Math.random() * 10) + "" + (int) (Math.random() * 10) + "" + (int) (Math.random() * 10) + "" + (int... | public void open(String server, String user, String pass, int port, String option) throws Exception {
log.info("Login to FTP: " + server);
this.port = port;
ftp = new FTPClient();
ftp.connect(server, port);
ftp.login(user, pass);
checkReply("FTP server refused connect... | false |
3,794 | 7,177,879 | 13,540,821 | public SM2Client(String umn, String authorizationID, String protocol, String serverName, Map props, CallbackHandler handler) {
super(SM2_MECHANISM + "-" + umn, authorizationID, protocol, serverName, props, handler);
this.umn = umn;
complete = false;
state = 0;
if (sha == null... | private static InputSource getInputSourceFromURI(String uri, String username, String password) throws IOException, ProtocolException, UnsupportedEncodingException {
URL wsdlurl = null;
try {
wsdlurl = new URL(uri);
} catch (MalformedURLException e) {
return new InputS... | false |
3,795 | 20,036,910 | 20,303,339 | public static void copyFile(File srcFile, File dstFile) {
logger.info("Create file : " + dstFile.getPath());
try {
FileChannel srcChannel = new FileInputStream(srcFile).getChannel();
FileChannel dstChannel = new FileOutputStream(dstFile).getChannel();
dstChannel.t... | private void trainDepParser(byte flag, JarArchiveOutputStream zout) throws Exception {
AbstractDepParser parser = null;
OneVsAllDecoder decoder = null;
if (flag == ShiftPopParser.FLAG_TRAIN_LEXICON) {
System.out.println("\n* Save lexica");
if (s_depParser.equals(Abstr... | true |
3,796 | 4,301,327 | 5,713,525 | private String doRawGet(URI uri) throws XdsInternalException {
HttpURLConnection conn = null;
String response = null;
try {
URL url;
try {
url = uri.toURL();
} catch (Exception e) {
throw HttpClient.getException(e, uri.toStr... | private byte[] getFileFromFtp(String remote) throws Exception {
ftp = new FTPClient();
int reply;
ftp.connect(ftpServer);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
throw new Exception("FTP server refused... | false |
3,797 | 3,520,277 | 1,966,311 | private void downloadFile(String directory, String fileName) {
URL url = null;
String urlstr = updateURL + directory + fileName;
int position = 0;
try {
Logger.msg(threadName + "Download new file from " + urlstr);
url = new URL(urlstr);
URLConnecti... | public void run() {
if (_plot == null) {
_plot = newPlot();
}
getContentPane().add(plot(), BorderLayout.NORTH);
int width;
int height;
String widthspec = getParameter("width");
... | false |
3,798 | 21,929,693 | 17,987,049 | private void importUrl(String str) throws Exception {
URL url = new URL(str);
InputStream xmlStream = url.openStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
MessageHolder messages = MessageHolder.getInstance();
DocumentBuilder builder = facto... | private boolean writeResource(PluginProxy eclipseInstallPlugin, ResourceProxy translation, LocaleProxy locale) throws Exception {
String translationResourceName = determineTranslatedResourceName(translation, locale);
String pluginNameInDirFormat = eclipseInstallPlugin.getName().replace(Messages.getS... | false |
3,799 | 22,327,409 | 8,296,360 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter();
} catch (IOException ex) {
... | public static void copiaAnexos(String from, String to, AnexoTO[] anexoTO) {
FileChannel in = null, out = null;
for (int i = 0; i < anexoTO.length; i++) {
try {
in = new FileInputStream(new File((uploadDiretorio.concat(from)).concat(File.separator + anexoTO[i].getNome())))... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.