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 |
|---|---|---|---|---|---|
2,700 | 13,013,560 | 21,224,683 | public static Node carregaModeloJME(String caminho) {
try {
URL urlModelo = ModelUtils.class.getClassLoader().getResource(caminho);
BufferedInputStream leitorBinario = new BufferedInputStream(urlModelo.openStream());
Node modelo = (Node) BinaryImporter.getInstance().load(... | public void delete(String user) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatemen... | false |
2,701 | 13,915,960 | 18,084,457 | protected void copyFile(final String sourceFileName, final File path) throws IOException {
final File source = new File(sourceFileName);
final File destination = new File(path, source.getName());
FileChannel srcChannel = null;
FileChannel dstChannel = null;
FileInputStream fi... | public void run() {
try {
Socket socket = getSocket();
System.out.println("opening socket to " + address + " on " + port);
InputStream in = socket.getInputStream();
for (; ; ) {
FileTransferHeader header = FileTransferHeader.readHeader(in);
... | true |
2,702 | 13,075,309 | 16,099,225 | public static void loginBayFiles() throws Exception {
HttpParams params = new BasicHttpParams();
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
DefaultHttpClient httpclient = new DefaultHttpClient(params);
... | public static String digest(String text, String algorithm, String charsetName) {
try {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(text.getBytes(charsetName), 0, text.length());
return convertToHex(md.digest());
} catch (NoSuchAlgorithmExcep... | false |
2,703 | 5,004,897 | 5,272,426 | private boolean passwordMatches(String user, String plainPassword, String scrambledPassword) {
MessageDigest md;
byte[] temp_digest, pass_digest;
byte[] hex_digest = new byte[35];
byte[] scrambled = scrambledPassword.getBytes();
try {
md = MessageDigest.getInstanc... | public static final String hash(String data) {
MessageDigest digest = null;
if (digest == null) {
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
System.err.println("Failed to load the MD5 MessageDiges... | true |
2,704 | 1,096,936 | 12,985,466 | private static String readJarURL(URL url) throws IOException {
JarURLConnection juc = (JarURLConnection) url.openConnection();
InputStream in = juc.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
int i = in.read();
while (i != -1) {
out.... | @Override
protected Map<String, Definition> loadDefinitionsFromURL(URL url) {
Map<String, Definition> defsMap = null;
try {
URLConnection connection = url.openConnection();
connection.connect();
lastModifiedDates.put(url.toExternalForm(), connection.getLastMod... | false |
2,705 | 14,776,698 | 20,110,295 | 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;
... | public static String getMD5(final String data) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(data.getBytes());
BigInteger bigInt = new BigInteger(1, m.digest());
String hashtext = bigInt.toString(16);
w... | false |
2,706 | 20,696,809 | 15,854,363 | public static boolean insereLicao(final Connection con, Licao lic, Autor aut, Descricao desc) {
try {
con.setAutoCommit(false);
Statement smt = con.createStatement();
if (aut.getCodAutor() == 0) {
GeraID.gerarCodAutor(con, aut);
smt.execute... | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | false |
2,707 | 1,811,744 | 5,706,224 | public void testSimpleHttpPostsWithContentLength() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
rnd... | public void run() {
try {
File outDir = new File(outDirTextField.getText());
if (!outDir.exists()) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(... | false |
2,708 | 10,565,544 | 13,812,091 | public static void copyToFileAndCloseStreams(InputStream istr, File destFile) throws IOException {
OutputStream ostr = null;
try {
ostr = new FileOutputStream(destFile);
IOUtils.copy(istr, ostr);
} finally {
if (ostr != null) ostr.close();
if (... | public static void copyFile(IPath fromFileName, IPath toFileName) throws IOException {
File fromFile = fromFileName.toFile();
File toFile = toFileName.toFile();
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | true |
2,709 | 20,164,979 | 3,239,010 | private void handleUpload(CommonsMultipartFile file, String newFileName, String uploadDir) throws IOException, FileNotFoundException {
File dirPath = new File(uploadDir);
if (!dirPath.exists()) {
dirPath.mkdirs();
}
InputStream stream = file.getInputStream();
Outp... | 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 |
2,710 | 3,474,688 | 8,428,267 | public void connect(final URLConnectAdapter urlAdapter) {
if (this.connectSettings == null) {
throw new IllegalStateException("Invalid Connect Settings (is null)");
}
final HttpURLConnection httpConnection = (HttpURLConnection) urlAdapter.openConnection();
BufferedReader ... | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException nsae) {
nsae.printStackTrace();
}
}
try {
digest.up... | false |
2,711 | 8,250,730 | 5,080,723 | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String uuid = req.getParameterValues(Constants.PARAM_UUID)[0];
String datastream = null;
if (req.getRequestURI().contains(Constants.SERVLET_DOWNLOAD_FOXML_PREFIX)) {
... | public static URL getAuthenticationURL(String apiKey, String permission, String sharedSecret) throws Exception {
String apiSig = sharedSecret + "api_key" + apiKey + "perms" + permission;
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(apiSig.getBytes(), 0, apiSig.length());
... | false |
2,712 | 6,430,125 | 2,736,180 | protected Object openDialogBox(Control cellEditorWindow) {
FileDialog dialog = new FileDialog(parent.getShell(), SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.jpg;*.JPG;*.JPEG;*.gif;*.GIF;*.png;*.PNG", "*.jpg;*.JPG;*.JPEG", "*.gif;*.GIF", "*.png;*.PNG" });
dialog.setFilterNames(new... | public static byte[] getURLContent(String urlPath) {
HttpURLConnection conn = null;
InputStream inStream = null;
byte[] buffer = null;
try {
URL url = new URL(urlPath);
HttpURLConnection.setFollowRedirects(false);
conn = (HttpURLConnection) url.ope... | false |
2,713 | 672,106 | 18,465,677 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public void download(RequestContext ctx) throws IOException {
if (ctx.isRobot()) {
ctx.forbidden();
return;
}
long id = ctx.id();
File bean = File.INSTANCE.Get(id);
if (bean == null) {
ctx.not_found();
return;
}
... | true |
2,714 | 16,023,045 | 8,859,873 | public NodeId generateTopicId(String topicName) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
System.err.println("No SHA support!");
}
md.update(topicName.getBytes());
byte[] dige... | private void mergeOne(String level, char strand, String filename, Path outPath, FileSystem srcFS, FileSystem dstFS, Timer to) throws IOException {
to.start();
final OutputStream outs = dstFS.create(new Path(outPath, filename));
final FileStatus[] parts = srcFS.globStatus(new Path(sorted ? ge... | false |
2,715 | 19,340,788 | 4,420,769 | public void setInput(String input, Component caller, FFMpegProgressReceiver recv) throws IOException {
inputMedium = null;
if (input.contains("youtube")) {
URL url = new URL(input);
InputStreamReader read = new InputStreamReader(url.openStream());
BufferedReader i... | public void _saveWebAsset(ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form, User user, String subcmd) throws WebAssetException, Exception {
long maxsize = 50;
long maxwidth = 3000;
long maxheight = 3000;
long minheight = 10;
ActionRequestImpl reqIm... | false |
2,716 | 13,260,090 | 1,162,514 | public static URL getComponentXmlFileWith(String name) throws Exception {
List<URL> all = getComponentXmlFiles();
for (URL url : all) {
InputStream stream = null;
try {
stream = url.openStream();
Element root = XML.getRootElement(stream);
... | private LSInput resolveResource(String aPublicId, String aSystemId, String aBaseURI, boolean baseUsed) {
LSInput lsInput = new DefaultLSInput();
lsInput.setPublicId(aPublicId);
lsInput.setSystemId(aSystemId);
String base = null;
try {
int baseEndPos = -1;
... | false |
2,717 | 18,972,686 | 9,958,260 | public void jsFunction_addFile(ScriptableFile infile) throws IOException {
if (!infile.jsFunction_exists()) throw new IllegalArgumentException("Cannot add a file that doesn't exists to an archive");
ZipArchiveEntry entry = new ZipArchiveEntry(infile.getName());
entry.setSize(infile.jsFunctio... | public String doAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
UploadFileForm vo = (UploadFileForm) form;
FormFile file = vo.getFile();
String inforId = request.getParameter("inforId");
System.out.println("info... | true |
2,718 | 4,298,180 | 9,456,659 | public static String md5(String texto) {
String resultado;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(texto.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
resultado = hash.toString(16);
if (resul... | public static String getHash(String text) {
if (text == null) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
byte[] hashedTextBytes = md.digest();
BigInteger hashedTextBigInteger = new BigInteger(1, ... | true |
2,719 | 15,596,949 | 916,271 | private static Image tryLoadImageFromFile(String filename, String path, int width, int height) {
Image image = null;
try {
URL url;
url = new URL("file:" + path + pathSeparator + fixFilename(filename));
if (url.openStream() != null) {
image = Toolk... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
2,720 | 17,534,703 | 18,796,914 | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | public String getPloidy(String source) {
StringBuilder ploidyHtml = new StringBuilder();
String hyperdiploidyUrl = customParameters.getHyperdiploidyUrl();
String urlString = hyperdiploidyUrl + "?source=" + source;
URL url = null;
try {
url = new URL(urlString);
... | false |
2,721 | 10,106,969 | 699,719 | public static String md5(String value) throws NoSuchAlgorithmException {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
try {
messageDigest.update(value.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
messageDigest.update(value.getBytes... | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnClear) {
passwordField.setText("");
}
for (int i = 0; i < 10; i++) {
if (e.getSource() == btnNumber[i]) {
String password = new String((p... | true |
2,722 | 6,740,469 | 337,322 | private void copyFile(String sourceFilename, String destDirname) throws BuildException {
log("Copying file " + sourceFilename + " to " + destDirname);
File destFile = getDestFile(sourceFilename, destDirname);
InputStream inStream = null;
OutputStream outStream = null;
try {
... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | true |
2,723 | 3,533,515 | 20,815,980 | public boolean saveVideoXMLOnWebserver(String text) {
boolean error = false;
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(this.getWebserver().getUrl());
System.out.println("Connected to " + this.getWebserver().getUrl() + ".");
... | private void getRandomGUID(boolean secure) throws NoSuchAlgorithmException {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("... | false |
2,724 | 23,188,198 | 22,080,746 | public ProcessorOutput createOutput(String name) {
ProcessorOutput output = new ProcessorImpl.CacheableTransformerOutputImpl(getClass(), name) {
protected void readImpl(org.orbeon.oxf.pipeline.api.PipelineContext context, final ContentHandler contentHandler) {
ProcessorInput i =... | @Test
public void testCarResource() throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
System.out.println("**** CarResource Via @MatrixParam ***");
HttpGet get = new HttpGet("http://localhost:9095/cars/matrix/mercedes/e55;color=black/2006");
HttpResponse respo... | false |
2,725 | 22,948,959 | 4,531,654 | private static void copyFile(File sourceFile, File targetFile) throws FileSaveException {
try {
FileInputStream inputStream = new FileInputStream(sourceFile);
FileOutputStream outputStream = new FileOutputStream(targetFile);
FileChannel readableChannel = inputStream.getCh... | public static byte[] md5raw(String data) {
try {
MessageDigest md = MessageDigest.getInstance(MD);
md.update(data.getBytes(UTF8));
return md.digest();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
| false |
2,726 | 7,999,926 | 2,439,668 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
Object msg = e.getMessage();
if (!(msg instanceof HttpMessage) && !(msg instanceof HttpChunk)) {
ctx.sendUpstream(e);
return;
}
HttpMessage currentMessage =... | public void run() {
try {
textUpdater.start();
int cnt;
byte[] buf = new byte[4096];
File file = null;
ZipInputStream zis = new ZipInputStream(new FileInputStream(new File(filename)));
ZipEntry ze = zis.getNextEntry();
FileO... | true |
2,727 | 16,351,775 | 22,434,268 | 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 in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
sour... | true |
2,728 | 303,331 | 14,058,408 | 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 zipFolder(File folder, ZipOutputStream zipOutputStream, String relativePath) throws IOException {
File[] children = folder.listFiles();
for (int i = 0; i < children.length; i++) {
File child = children[i];
if (child.isFile()) {
String zipEn... | true |
2,729 | 22,625,096 | 8,512,998 | public void run() {
long starttime = (new Date()).getTime();
Matcher m = Pattern.compile("(\\S+);(\\d+)").matcher(Destination);
boolean completed = false;
if (OutFile.length() > IncommingProcessor.MaxPayload) {
logger.warn("Payload is too large!");
close();
... | public boolean updateCalculatedHand(CalculateTransferObject query, BasicStartingHandTransferObject[] hands) throws CalculateDAOException {
boolean retval = false;
Connection connection = null;
Statement statement = null;
PreparedStatement prep = null;
ResultSet result = null;... | false |
2,730 | 10,271,558 | 1,910,796 | private void processBasicContent() {
String[] packageNames = sourceCollector.getPackageNames();
for (int i = 0; i < packageNames.length; i++) {
XdcSource[] sources = sourceCollector.getXdcSources(packageNames[i]);
File dir = new File(outputDir, packageNames[i]);
d... | public void saveToPackage() {
boolean inPackage = false;
String className = IconEditor.className;
if (!checkPackage()) {
JOptionPane.showMessageDialog(this, "No package selected. Aborting.", "Package not selected!", JOptionPane.WARNING_MESSAGE);
return;
}
... | true |
2,731 | 564,191 | 16,961,459 | private void processOrder() {
double neg = 0d;
if (intMode == MODE_CHECKOUT) {
if (round2Places(mBuf.getBufferTotal()) >= round2Places(order.getOrderTotal())) {
double cash, credit, allowedCredit = 0d;
allowedCredit = getStudentCredit();
if... | @Test
public void testConfigurartion() {
try {
Enumeration<URL> assemblersToRegister = this.getClass().getClassLoader().getResources("META-INF/PrintAssemblerFactory.properties");
log.debug("PrintAssemblerFactory " + SimplePrintJobTest.class.getClassLoader().getResource("META-INF/... | false |
2,732 | 21,609,544 | 547,576 | public static JSONObject delete(String uid) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpGet get = new HttpGet(DELETE_URI + "?uid=" + uid);
HttpResponse response = client.execute(get);
if (response.getStatusLine()... | public static void main(String argv[]) {
System.out.println("Starting URL tests");
System.out.println("Test 1: Simple URL test");
try {
URL url = new URL("http", "www.fsf.org", 80, "/");
if (!url.getProtocol().equals("http") || !url.getHost().equals("www.fsf.org") || ... | false |
2,733 | 6,190,168 | 20,192,098 | public void xtest12() throws Exception {
PDFManager manager = new ITextManager();
InputStream pdf = new FileInputStream("/tmp/090237098008f637.pdf");
InputStream page1 = manager.cut(pdf, 36, 36);
OutputStream outputStream = new FileOutputStream("/tmp/090237098008f637-1.pdf");
... | public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException {
if (log.isTraceEnabled()) log.trace("Read input stream with metadata=" + metadata);
Integer resCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
String resMessage = (Strin... | true |
2,734 | 12,754,505 | 6,171,420 | public static final String MD5(String value) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String newValue = hash.toString(16);
return newValue;
}... | public static void copyFile(File sourceFile, File destFile) throws IOException {
log.info("Copying file '" + sourceFile + "' to '" + destFile + "'");
if (!sourceFile.isFile()) {
throw new IllegalArgumentException("The sourceFile '" + sourceFile + "' does not exist or is not a normal file... | false |
2,735 | 14,808,281 | 7,704,003 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public void moveRowUp(int id, int row) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createS... | false |
2,736 | 20,681,844 | 15,831,694 | public void testGetOldVersion() throws ServiceException, IOException, SAXException, ParserConfigurationException {
JCRNodeSource emptySource = loadTestSource();
for (int i = 0; i < 3; i++) {
OutputStream sourceOut = emptySource.getOutputStream();
InputStream contentIn = getCl... | 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 |
2,737 | 12,721,185 | 8,335,944 | public static int fileUpload(long lngFileSize, InputStream inputStream, String strFilePath, String strFileName) throws IOException {
String SEPARATOR = System.getProperty("file.separator");
if (lngFileSize > (10 * 1024 * 1024)) {
return -1;
}
InputStream is = null;
... | public static byte[] sendRequestV1(String url, Map<String, Object> params, String secretCode, String method, Map<String, String> files, String encoding, String signMethod, Map<String, String> headers, String contentType) {
HttpClient client = new HttpClient();
byte[] result = null;
if (metho... | false |
2,738 | 20,009,109 | 21,754,658 | 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 void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new ImageFilter());
fc.setAccessory(new ImagePreview(fc));
int returnVal = fc.showDialog(Administrac... | true |
2,739 | 5,401,999 | 13,433,127 | @Override
protected void setUp() throws Exception {
super.setUp();
FTPConf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
FTPConf.setServerTimeZoneId("GMT");
FTP.configure(FTPConf);
try {
FTP.connect("tgftp.nws.noaa.gov");
FTP.login("anonymous",... | public void save(File selectedFile) throws IOException {
if (storeEntriesInFiles) {
boolean moved = false;
for (int i = 0; i < tempFiles.size(); i++) {
File newFile = new File(selectedFile.getAbsolutePath() + "_" + Integer.toString(i) + ".zettmp");
mov... | false |
2,740 | 17,398,520 | 18,634,052 | public void SendFile(File testfile) {
try {
SocketChannel sock = SocketChannel.open(new InetSocketAddress("127.0.0.1", 1234));
sock.configureBlocking(true);
while (!sock.finishConnect()) {
System.out.println("NOT connected!");
}
Sys... | public static String readRss(String feed, int num) {
InputStream stream = null;
try {
feed = appendParam(feed, "num", "" + num);
System.out.println("feed=" + feed);
URL url = new URL(feed);
URLConnection connection = url.openConnection();
c... | false |
2,741 | 10,586,916 | 17,296,395 | public static void CreateBackupOfDataFile(String _src, String _dest) {
try {
File src = new File(_src);
File dest = new File(_dest);
if (new File(_src).exists()) {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
... | public static File copyToLibDirectory(final File file) throws FileNotFoundException, IOException {
if (file == null || !file.exists()) {
throw new FileNotFoundException();
}
File directory = new File("lib/");
File dest = new File(directory, file.getName());
File p... | true |
2,742 | 4,960,417 | 16,209,101 | public static boolean writeFileByBinary(InputStream pIs, File pFile, boolean pAppend) {
boolean flag = false;
try {
FileOutputStream fos = new FileOutputStream(pFile, pAppend);
IOUtils.copy(pIs, fos);
fos.flush();
fos.close();
pIs.close();
... | 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 |
2,743 | 22,538,273 | 18,967,837 | public void format(File source, File target) {
if (!source.exists()) {
throw new IllegalArgumentException("Source '" + source + " doesn't exist");
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source '" + source + " is not a file");
}
t... | public static String encrypt(String text) {
final char[] HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
String result = "";
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("MD5");
digest.up... | false |
2,744 | 20,603,864 | 20,898,459 | 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();
... | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | false |
2,745 | 23,452,538 | 1,741,432 | private long config(final String options) throws SQLException {
MessageDigest msgDigest = null;
try {
msgDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
}
msgDigest.update(options.getBytes());
... | private boolean performModuleInstallation(Model m) {
String seldir = directoryHandler.getSelectedDirectory();
if (seldir == null) {
MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
box.setText("Cannot install");
box.setMessage("A target directory... | false |
2,746 | 16,752,473 | 10,236,283 | public HttpResponse executeHttp(final HttpUriRequest request, final int expectedCode) throws ClientProtocolException, IOException, HttpException {
final HttpResponse response = httpClient.execute(request);
if (response.getStatusLine().getStatusCode() != expectedCode) {
throw newHttpExcep... | public MultiValueMap<String> queryResource(String resourceName) {
if (resourceName.startsWith("http://dbpedia.org/resource/")) {
resourceName = resourceName.substring(28);
}
try {
resourceName = resourceName.replace(' ', '_');
resourceName = URLEncoder.enc... | false |
2,747 | 17,957,003 | 12,980,532 | private Date getArtifactFileLastUpdate(Artifact artifact) {
URL url = null;
try {
url = new URL(baseUrl + artifact.getOrganisationName().replaceAll("\\.", "/") + "/" + artifact.getName().replaceAll("\\.", "/") + "/" + artifact.getVersion() + "/");
} catch (MalformedURLException e... | public String htmlContentSimple(String urlStr, String charset) {
StringBuffer html = new StringBuffer();
URL url = null;
BufferedReader reader = null;
try {
url = new URL(urlStr);
reader = new BufferedReader(new InputStreamReader(url.openStream(), charset));
... | false |
2,748 | 9,819,955 | 1,607,809 | @Override
public void write(OutputStream output) throws IOException, WebApplicationException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final GZIPOutputStream gzipOs = new GZIPOutputStream(baos);
IOUtils.copy(is, gzipOs);
baos.close();
gzipOs.close(... | public void lock(String oid, String key) throws PersisterException {
String lock = getLock(oid);
if (lock == null) {
throw new PersisterException("Object does not exist: OID = " + oid);
} else if (!NULL.equals(lock) && (!lock.equals(key))) {
throw new PersisterExcepti... | false |
2,749 | 15,088,608 | 23,021,618 | public synchronized String encrypt(String plaintext) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {
noSuchAlgorithmException.printStackTrace();
}
try {
... | public boolean WriteFile(java.io.Serializable inObj, String fileName) throws Exception {
FileOutputStream out;
try {
SecretKey skey = null;
AlgorithmParameterSpec aps;
out = new FileOutputStream(fileName);
cipher = Cipher.getInstance(algorithm);
... | true |
2,750 | 13,028,547 | 13,845,913 | 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 synchronized boolean copyTmpDataFile(String fpath) throws IOException {
if (tmpDataOutput != null) tmpDataOutput.close();
tmpDataOutput = null;
if (tmpDataFile == null) return false;
File nfp = new File(fpath);
if (nfp.exists()) nfp.delete();
FileInputStream sr... | true |
2,751 | 14,577,922 | 5,674,869 | public TwilioRestResponse request(String path, String method, Map<String, String> vars) throws TwilioRestException {
String encoded = "";
if (vars != null) {
for (String key : vars.keySet()) {
try {
encoded += "&" + key + "=" + URLEncoder.encode(vars.g... | public static String getHash(String text) {
if (text == null) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
byte[] hashedTextBytes = md.digest();
BigInteger hashedTextBigInteger = new BigInteger(1, ... | false |
2,752 | 5,951,609 | 10,222,828 | public void testCryptHash() {
Log.v("Test", "[*] testCryptHash()");
String testStr = "Hash me";
byte messageDigest[];
MessageDigest digest = null;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(testStr.getBytes());
... | public static String getMD5Hash(String data) {
MessageDigest digest;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(data.getBytes());
byte[] hash = digest.digest();
StringBuffer hexString = new StringBuffer();
... | true |
2,753 | 11,594,590 | 1,102,936 | public <T extends FetionResponse> T executeAction(FetionAction<T> fetionAction) throws IOException {
URL url = new URL(fetionAction.getProtocol().name().toLowerCase() + "://" + fetionUrl + fetionAction.getRequestData());
URLConnection connection = url.openConnection();
InputStream in = conne... | 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) {
... | false |
2,754 | 10,521,243 | 2,857,623 | public String md5(String phrase) {
MessageDigest m;
String coded = new String();
try {
m = MessageDigest.getInstance("MD5");
m.update(phrase.getBytes(), 0, phrase.length());
coded = (new BigInteger(1, m.digest()).toString(16)).toString();
} catch (... | private void copy(File src, File dest, String name) {
File srcFile = new File(src, name);
File destFile = new File(dest, name);
if (destFile.exists()) {
if (destFile.lastModified() == srcFile.lastModified()) return;
destFile.delete();
}
FileChannel in ... | false |
2,755 | 13,196,323 | 12,980,532 | public void sendMessage(Message msg) {
if (!blackList.contains(msg.getTo())) {
Hashtable<String, String> content = msg.getContent();
Enumeration<String> keys = content.keys();
String key;
String data = "to=" + msg.getTo() + "&from=" + msg.getFrom() + "&";
... | public String htmlContentSimple(String urlStr, String charset) {
StringBuffer html = new StringBuffer();
URL url = null;
BufferedReader reader = null;
try {
url = new URL(urlStr);
reader = new BufferedReader(new InputStreamReader(url.openStream(), charset));
... | true |
2,756 | 9,891,128 | 17,374,912 | private static void readIzvestiyaArticles() throws IOException {
CsvReader reader = new CsvReader(new InputStreamReader(IzvestiyaUtil.class.getClassLoader().getResourceAsStream("mathnet_izvestiya.csv")), ';');
reader.setTrimWhitespace(true);
try {
while (reader.readRecord()) {
... | public void copyTo(File folder) {
if (!isNewFile()) {
return;
}
if (!folder.exists()) {
folder.mkdir();
}
File dest = new File(folder, name);
try {
FileInputStream in = new FileInputStream(cur... | true |
2,757 | 9,219,798 | 9,678,341 | 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... | 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... | true |
2,758 | 17,999,564 | 9,024,096 | public static void decompressFile(File f) throws IOException {
File target = new File(f.toString().substring(0, f.toString().length() - 3));
System.out.print("Decompressing: " + f.getName() + ".. ");
long initialSize = f.length();
GZIPInputStream in = new GZIPInputStream(new FileInpu... | public static final String enCode(String algorithm, String string) {
MessageDigest md;
String result = "";
try {
md = MessageDigest.getInstance(algorithm);
md.update(string.getBytes());
result = binaryToString(md.digest());
} catch (NoSuchAlgorithm... | false |
2,759 | 18,773,070 | 11,958,349 | public static void main(String[] args) {
if (args.length != 2) throw new IllegalArgumentException();
String inFileName = args[0];
String outFileName = args[1];
File fInput = new File(inFileName);
Scanner in = null;
try {
in = new Scanner(fInput);
}... | public static void makeLPKFile(String[] srcFilePath, String makeFilePath, LPKHeader header) {
FileOutputStream os = null;
DataOutputStream dos = null;
try {
LPKTable[] fileTable = new LPKTable[srcFilePath.length];
long fileOffset = outputOffset(header);
fo... | true |
2,760 | 21,386,162 | 557,734 | public void writeToFile(File file, File source) throws IOException {
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(file));
BufferedInputStream bin = new BufferedInputStream(new FileInputStream(source));
bin.skip(header.getHeaderEndingOffset());
for (long i... | public void constructAssociationView() {
String className;
String methodName;
String field;
boolean foundRead = false;
boolean foundWrite = false;
boolean classWritten = false;
try {
AssocView = new BufferedWriter(new FileWriter("InfoFiles/Associat... | true |
2,761 | 181,591 | 7,901,588 | 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 long removePropertyInOpenXMLDocument(String ext, InputStream in, OutputStreamProvider outProvider, String propriete) {
in = new BufferedInputStream(in);
try {
File tempPptx = null;
POIXMLDocument doc;
if (ext.toLowerCase().equals("docx")) {
... | true |
2,762 | 12,863,275 | 859,719 | @Override
protected Integer doInBackground() throws Exception {
int numOfRows = 0;
combinationMap = new HashMap<AnsweredQuestion, Integer>();
combinationMapReverse = new HashMap<Integer, AnsweredQuestion>();
LinkedHashSet<AnsweredQuestion> answeredQuestionSet = new LinkedHashSet<... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
2,763 | 8,670,491 | 6,322,440 | private void impurlActionPerformed(java.awt.event.ActionEvent evt) {
try {
String prevurl = Prefs.getPref(PrefName.LASTIMPURL);
String urlst = JOptionPane.showInputDialog(Resource.getResourceString("enturl"), prevurl);
if (urlst == null || urlst.equals("")) return;
... | public static void copyFile(final File fromFile, File toFile) throws IOException {
try {
if (!fromFile.exists()) {
throw new IOException("FileCopy: " + "no such source file: " + fromFile.getAbsoluteFile());
}
if (!fromFile.isFile()) {
throw... | false |
2,764 | 11,929,030 | 17,431,783 | public T_Result unmarshall(URL url) throws SAXException, ParserConfigurationException, IOException {
XMLReader parser = getParserFactory().newSAXParser().getXMLReader();
parser.setContentHandler(getContentHandler());
parser.setDTDHandler(getContentHandler());
parser.setEntityResolver... | protected void registerClasses() throws PrintException {
if (!init) {
try {
Enumeration<URL> somethingToRegister = this.getClass().getClassLoader().getResources("META-INF/" + getClass().getSimpleName() + ".properties");
while (somethingToRegister.hasMoreElements()... | false |
2,765 | 1,362,126 | 20,085,210 | public InputStream resolve(String uri) throws SAJException {
try {
URI url = new URI(uri);
InputStream stream = url.toURL().openStream();
if (stream == null) throw new SAJException("URI " + uri + " can't be resolved");
return stream;
} catch (SAJExcept... | 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(... | false |
2,766 | 6,015,368 | 11,834,952 | public synchronized String encrypt(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
return (new BASE64Encoder()).encode(raw);
}
| public void downloadTranslationsAndReload() {
File languages = new File(this.translationsFile);
try {
URL languageURL = new URL(languageServer);
InputStream is = languageURL.openStream();
OutputStream os = new FileOutputStream(languages);
byte[] read =... | false |
2,767 | 11,560,551 | 7,169,018 | 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... | private void show(String fileName, HttpServletResponse response) throws IOException {
TelnetInputStream ftpIn = ftpClient_sun.get(fileName);
OutputStream out = null;
try {
out = response.getOutputStream();
IOUtils.copy(ftpIn, out);
} finally {
if (... | true |
2,768 | 16,713,229 | 2,440,999 | public void uploadFile(ActionEvent event) throws IOException {
InputFile inputFile = (InputFile) event.getSource();
synchronized (inputFile) {
ServletContext context = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
String fileNewPath = a... | private static boolean validateSshaPwd(String sSshaPwd, String sUserPwd) {
boolean b = false;
if (sSshaPwd != null && sUserPwd != null) {
if (sSshaPwd.startsWith(SSHA_PREFIX)) {
sSshaPwd = sSshaPwd.substring(SSHA_PREFIX.length());
try {
... | false |
2,769 | 18,695,537 | 8,236,587 | public InputSource resolveEntity(String pPublicId, String pSystemId) throws SAXException, IOException {
try {
URL url = new URL(pSystemId);
String fileName = (String) urlMap.get(url);
if (fileName != null) {
FileInputStream istream ... | public void contextInitialized(ServletContextEvent event) {
try {
String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) {
URL url = new URL("http://localhost/");
URLConnection urlConn = url.openC... | false |
2,770 | 4,886,971 | 19,693,366 | private static void copyFile(String srFile, String dtFile) {
try {
File f1 = new File(srFile);
File f2 = new File(dtFile);
InputStream in = new FileInputStream(f1);
OutputStream out = new FileOutputStream(f2);
byte[] buf = new byte[1024];
... | @Override
public void exec() {
BufferedReader in = null;
try {
URL url = new URL(getUrl());
in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer result = new StringBuffer();
String str;
while ((str = in.readLin... | false |
2,771 | 13,450,574 | 7,214,727 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer(128);
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
}
try {
long time = System.curren... | public byte[] pipeBytes() {
byte ba[] = null;
try {
URL url = new URL(server);
conn = (HttpURLConnection) url.openConnection();
InputStream is = conn.getInputStream();
ByteArrayOutputStream tout = new ByteArrayOutputStream();
int nmax = 100... | false |
2,772 | 17,727,663 | 7,545,001 | private static void copy(String sourceName, String destName) throws IOException {
File source = new File(sourceName);
File dest = new File(destName);
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputSt... | public static Object GET(String url, String[][] props) throws IOException {
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("GET");
for (int i = 0; i < props.length; ++i) {
conn.addRequestProperty(props[i][0], URLEncoder.encode(pr... | false |
2,773 | 3,024,980 | 8,990,219 | @Test
public void testCopy_inputStreamToWriter_Encoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new YellOn... | private boolean getCached(Get g) throws IOException {
boolean ret = false;
File f = getCachedFile(g);
if (f.exists()) {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(f);
os = new FileOutputStr... | true |
2,774 | 18,779,982 | 13,927,065 | private HashSet<String> href(String urlstr) throws IOException {
HashSet<String> hrefs = new HashSet<String>();
URL url = new URL(urlstr);
URLConnection con = url.openConnection();
con.setRequestProperty("Cookie", "_session_id=" + _session_id);
InputStreamReader r = new Input... | void copyFile(File src, File dst) throws IOException {
FileInputStream fis = new FileInputStream(src);
byte[] buf = new byte[10000];
int n;
FileOutputStream fos = new FileOutputStream(dst);
while ((n = fis.read(buf)) > 0) fos.write(buf, 0, n);
fis.close();
fos... | true |
2,775 | 4,525,216 | 186,569 | private static void backupFile(File file) {
FileChannel in = null, out = null;
try {
if (!file.getName().endsWith(".bak")) {
in = new FileInputStream(file).getChannel();
out = new FileOutputStream(new File(file.toString() + ".bak")).getChannel();
... | 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[... | false |
2,776 | 854,534 | 3,021,780 | 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;
... | private Integer getInt(String sequence) throws NoSuchSequenceException {
Connection conn = null;
PreparedStatement read = null;
PreparedStatement write = null;
boolean success = false;
try {
conn = ds.getConnection();
conn.setTransactionIsolation(conn.... | false |
2,777 | 23,658,098 | 10,337,387 | public void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.c... | protected void zipDirectory(File dir, File zipfile) throws IOException, IllegalArgumentException {
if (!dir.isDirectory()) throw new IllegalArgumentException("Compress: not a directory: " + dir);
String[] entries = dir.list();
byte[] buffer = new byte[4096];
int bytes_read;
... | true |
2,778 | 87,685 | 6,218,856 | 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;
... | public static Bitmap loadBitmap(String url) {
try {
final HttpClient httpClient = getHttpClient();
final HttpResponse resp = httpClient.execute(new HttpGet(url));
final HttpEntity entity = resp.getEntity();
final int statusCode = resp.getStatusLine().getStatus... | false |
2,779 | 11,418,746 | 19,532,000 | private String buildShaHashOf(String source) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(source.getBytes());
return new BigInteger(1, md.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
... | static MenuListener openRecentHandler() {
MenuListener handler = new MenuListener() {
public void menuSelected(final MenuEvent event) {
final JMenu menu = (JMenu) event.getSource();
menu.removeAll();
String[] recentURLSpecs = Application.getApp().... | false |
2,780 | 18,236,400 | 21,125,856 | protected URL[][] getImageLinks(final URL url) {
Lexer lexer;
URL[][] ret;
if (null != url) {
try {
lexer = new Lexer(url.openConnection());
ret = extractImageLinks(lexer, url);
} catch (Throwable t) {
System.out.println... | public File createWindow(String pdfUrl) {
URL url;
InputStream is;
try {
int fileLength = 0;
String str;
if (pdfUrl.startsWith("jar:/")) {
str = "file.pdf";
is = this.getClass().getResourceAsStream(pdfUrl.substring(4));
... | false |
2,781 | 13,828,673 | 6,608,439 | protected void find(final String pckgname, final boolean recursive) {
URL url;
String name = pckgname;
name = name.replace('.', '/');
url = ResourceLocatorTool.getClassPathResource(ExampleRunner.class, name);
File directory;
try {
... | public static void main(String[] args) {
FTPClient client = new FTPClient();
try {
File l_file = new File("C:/temp/testLoribel.html");
String l_url = "http://www.loribel.com/index.html";
GB_HttpTools.loadUrlToFile(l_url, l_file, ENCODING.ISO_8859_1);
S... | false |
2,782 | 4,453,922 | 3,542,937 | public static void request() {
try {
URL url = new URL("http://www.nseindia.com/marketinfo/companyinfo/companysearch.jsp?cons=ghcl§ion=7");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
BufferedReader rd = new BufferedReader(new InputS... | public boolean optimize(int coreId) {
try {
URL url = new URL(solrUrl + "/core" + coreId + "/update");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Content-type", "text/xml");
conn.setRequestProperty("... | true |
2,783 | 1,362,134 | 18,921,331 | public void delete(int row) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();... | public void init() {
this.setFormulaCalculationMode(WorkBookHandle.CALCULATE_ALWAYS);
try {
if (memeId < 0) {
} else {
conurl = new URL(ServerURL + "?meme_id=" + memeId);
java.io.InputStream xmlstr = conurl.openStream();
this.re... | false |
2,784 | 13,099,598 | 20,296,792 | public void deleteUser(String userID) throws XregistryException {
try {
userID = Utils.canonicalizeDN(userID);
Connection connection = context.createConnection();
connection.setAutoCommit(false);
try {
PreparedStatement statement1 = connection.... | public void retrieveChallenges(int num) throws MalformedURLException, IOException, FBErrorException, FBConnectionException {
if (num < 1 || num > 100) {
error = true;
FBErrorException fbee = new FBErrorException();
fbee.setErrorCode(-100);
fbee.setErrorText("I... | false |
2,785 | 18,253,220 | 11,078,985 | public boolean downloadFTP(String ipFTP, String loginFTP, String senhaFTP, String diretorioFTP, String diretorioAndroid, String arquivoFTP) throws SocketException, IOException {
boolean retorno = false;
FileOutputStream arqReceber = null;
try {
ftp.connect(ipFTP);
Log... | public void run() {
OutputStream out = null;
InputStream in = null;
boolean success = false;
String absoluteFileName = "";
try {
String fileName = getFileName(softwareLocation);
File downloadFolder = new File(Properties.downloadFolder);
if ... | false |
2,786 | 7,174,662 | 3,239,010 | private void loadInitialDbState() throws IOException {
InputStream in = SchemaAndDataPopulator.class.getClassLoader().getResourceAsStream(resourceName);
StringWriter writer = new StringWriter();
IOUtils.copy(in, writer);
for (String statement : writer.toString().split(SQL_STATEMENT_D... | 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 |
2,787 | 912,653 | 15,416,859 | public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: GUnzip source");
return;
}
String zipname, source;
if (args[0].endsWith(".gz")) {
zipname = args[0];
source = args[0].substring(0, args[0].lengt... | private boolean checkTimestamp(File timestamp, URL url) {
try {
if (timestamp.exists()) {
FileReader reader = null;
Date dateLocal = null;
try {
reader = new FileReader(timestamp);
StringWriter tmp = new Stri... | true |
2,788 | 9,597,888 | 21,461,878 | private void javaToHtml(File source, File destination) throws IOException {
Reader reader = new FileReader(source);
Writer writer = new FileWriter(destination);
JavaUtils.writeJava(reader, writer);
writer.flush();
writer.close();
}
| private 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();
... | false |
2,789 | 2,461,168 | 11,787,058 | 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.... | protected int authenticate(long companyId, String login, String password, String authType, Map headerMap, Map parameterMap) throws PortalException, SystemException {
login = login.trim().toLowerCase();
long userId = GetterUtil.getLong(login);
if (authType.equals(CompanyImpl.AUTH_TYPE_EA)) {
... | false |
2,790 | 21,996,772 | 10,368,839 | public static void copy(final File src, File dst, final boolean overwrite) throws IOException, IllegalArgumentException {
if (!src.isFile() || !src.exists()) {
throw new IllegalArgumentException("Source file '" + src.getAbsolutePath() + "' not found!");
}
if (dst.exists()) {
... | public static void copy(File source, File destination) throws IOException {
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(destination);
byte[] buffer = new byte[1024];
int len;
while ((len = in.read(buffer)) > 0) out.write(buffer, 0, le... | true |
2,791 | 15,796,324 | 21,933,390 | public static List importSymbols(List symbols) throws ImportExportException {
List quotes = new ArrayList();
String URLString = constructURL(symbols);
IDQuoteFilter filter = new YahooIDQuoteFilter();
PreferencesManager.ProxyPreferences proxyPreferences = PreferencesManager.loadProxyS... | public static List<String> getServers() throws Exception {
List<String> servers = new ArrayList<String>();
URL url = new URL("http://tfast.org/en/servers.php");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
while ((line =... | true |
2,792 | 20,352,327 | 91,017 | public XmldbURI createFile(String newName, InputStream is, Long length, String contentType) throws IOException, PermissionDeniedException, CollectionDoesNotExistException {
if (LOG.isDebugEnabled()) LOG.debug("Create '" + newName + "' in '" + xmldbUri + "'");
XmldbURI newNameUri = XmldbURI.create(ne... | 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 |
2,793 | 693,631 | 21,609,539 | public static void adminUpdate(int i_id, double cost, String image, String thumbnail) {
Connection con = null;
try {
tmpAdmin++;
String name = "$tmp_admin" + tmpAdmin;
con = getConnection();
PreparedStatement related1 = con.prepareStatement("CREATE TEM... | public static JSONArray getFriends(long[] uids) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpPost post = new HttpPost(FRIENDS_URI);
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(n... | false |
2,794 | 15,599,613 | 12,577,673 | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | 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());
... | true |
2,795 | 9,100,840 | 13,325,917 | public static String encodeMD5(String value) {
String result = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
BASE64Encoder encoder = new BASE64Encoder();
md.update(value.getBytes());
byte[] raw = md.digest();
result = encod... | 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 |
2,796 | 23,022,778 | 14,667,674 | public void processDeleteHolding(Holding holdingBean, AuthSession authSession) {
if (authSession == null) {
return;
}
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (holdingBean.ge... | @Override
protected FTPClient ftpConnect() throws SocketException, IOException, NoSuchAlgorithmException {
FilePathItem fpi = getFilePathItem();
FTPClient f = new FTPSClient();
f.connect(fpi.getHost());
f.login(fpi.getUsername(), fpi.getPassword());
return f;
}
| false |
2,797 | 17,014,842 | 16,619,660 | private String createDefaultRepoConf() throws IOException {
InputStream confIn = getClass().getResourceAsStream(REPO_CONF_PATH);
File tempConfFile = File.createTempFile("repository", "xml");
tempConfFile.deleteOnExit();
IOUtils.copy(confIn, new FileOutputStream(tempConfFile));
... | public PropertiesImpl(URL url) {
this();
InputStream in = null;
lock.lock();
try {
in = url.openStream();
PropertiesLexer lexer = new PropertiesLexer(in);
lexer.lex();
List<PropertiesToken> list = lexer.getList();
new Proper... | false |
2,798 | 13,825,969 | 10,368,839 | @Override
protected void doFetch(HttpServletRequest request, HttpServletResponse response) throws IOException, GadgetException {
if (request.getHeader("If-Modified-Since") != null) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
String host = ... | public static void copy(File source, File destination) throws IOException {
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(destination);
byte[] buffer = new byte[1024];
int len;
while ((len = in.read(buffer)) > 0) out.write(buffer, 0, le... | true |
2,799 | 19,172,383 | 14,624,031 | public void readEntry(String name, InputStream input) throws Exception {
File file = new File(this.directory, name);
OutputStream output = new BufferedOutputStream(FileUtils.openOutputStream(file));
try {
org.apache.commons.io.IOUtils.copy(input, output);
... | public static void copyFile(File in, File out) throws ObclipseException {
try {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getC... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.