func1 stringlengths 254 2.93k | func2 stringlengths 254 2.97k | label int64 0 1 |
|---|---|---|
public static void main(String[] args) throws IOException {
PostParameter a1 = new PostParameter("v", Utils.encode("1.0"));
PostParameter a2 = new PostParameter("api_key", Utils.encode(RenRenConstant.apiKey));
PostParameter a3 = new PostParameter("method", Utils.encode("feed.publishTemplatiz... | public Wget2(URL url, File f) throws IOException {
System.out.println("bajando: " + url);
if (f == null) {
by = new ByteArrayOutputStream();
} else {
by = new FileOutputStream(f);
}
URLConnection uc = url.openConnection();
if (uc instanceof Htt... | 0 |
@Override
public Content getContent(Object principal, ContentPath path, Version version, Map<String, Object> properties) throws ContentException {
String uniqueName = path.getBaseName();
URL url = buildURL(uniqueName);
URLContent content = new URLContent(url, this.getName(), uniqueName);... | 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... | 0 |
public static String uncompress(String readPath, boolean mkdir) throws Exception {
ZipArchiveInputStream arcInputStream = new ZipArchiveInputStream(new FileInputStream(readPath));
BufferedInputStream bis = new BufferedInputStream(arcInputStream);
File baseDir = new File(readPath).getParentFi... | public static MessageService getMessageService(String fileId) {
MessageService ms = null;
if (serviceCache == null) init();
if (serviceCache.containsKey(fileId)) return serviceCache.get(fileId);
Properties p = new Properties();
try {
URL url = I18nPlugin.getFileUR... | 0 |
public static ArrayList<RoleName> importRoles(String urlString) {
ArrayList<RoleName> results = new ArrayList<RoleName>();
try {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buff = new ... | public static void copyTo(File source, File dest) {
if (source.isHidden()) ; else if (source.isDirectory()) {
File temp = new File(dest.getPath() + "/" + source.getName());
temp.mkdir();
for (File sel : source.listFiles()) copyTo(sel, temp);
} else {
t... | 0 |
private static Properties loadPropertiesFromClasspath(String path) {
Enumeration<URL> locations;
Properties props = new Properties();
try {
locations = Thread.currentThread().getContextClassLoader().getResources(path);
while (locations.hasMoreElements()) {
... | static String calculateProfileDiffDigest(String profileDiff, boolean normaliseWhitespace) throws Exception {
if (normaliseWhitespace) {
profileDiff = removeWhitespaces(profileDiff);
}
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(profileDiff.getBytes());
... | 0 |
public final void navigate(final URL url) {
try {
EncogLogging.log(EncogLogging.LEVEL_INFO, "Navigating to page:" + url);
final URLConnection connection = url.openConnection();
final InputStream is = connection.getInputStream();
navigate(url, is);
... | public static String retrieveData(URL url) throws IOException {
URLConnection connection = url.openConnection();
connection.setRequestProperty("User-agent", "MZmine 2");
InputStream is = connection.getInputStream();
if (is == null) {
throw new IOException("Could not estab... | 0 |
public void insertJobLog(String userId, String[] checkId, String checkType, String objType) throws Exception {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preStm = null;
String sql = "insert into COFFICE_JOBLOG_CHECKAUTH (USER_ID,CHECK_ID,CHECK_TYPE,OBJ_TY... | static HttpURLConnection connect(String url, String method, String contentType, String content, int timeoutMillis) throws ProtocolException, IOException, MalformedURLException, UnsupportedEncodingException {
HttpURLConnection conn = (HttpURLConnection) (new URL(url).openConnection());
conn.setReques... | 0 |
public static String fromHtml(URL url, String defaultEncoding, boolean overrideEncoding) throws IOException, BadDocumentException {
URLConnection conn = url.openConnection();
String contentType = conn.getContentType();
String encoding = conn.getContentEncoding();
if (encoding == null... | public static ArrayList<RoleName> importRoles(String urlString) {
ArrayList<RoleName> results = new ArrayList<RoleName>();
try {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buff = new ... | 0 |
private String encode(String plaintext) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
return (new BASE64Encoder()).encode(raw);
} catch (NoSuchAlgorithmException e) {
... | 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... | 0 |
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 testHttpsConnection() throws Throwable {
setUpStoreProperties();
try {
SSLContext ctx = getContext();
ServerSocket ss = ctx.getServerSocketFactory().createServerSocket(0);
TestHostnameVerifier hnv = new TestHostnameVerifier();
HttpsURLConne... | 0 |
private JButton getButtonSonido() {
if (buttonSonido == null) {
buttonSonido = new JButton();
buttonSonido.setText(Messages.getString("gui.AdministracionResorces.15"));
buttonSonido.setIcon(new ImageIcon(getClass().getResource("/es/unizar/cps/tecnoDiscap/data/icons/view_s... | @Override
public void export(final Library lib) throws PluginException {
try {
new Thread(new Runnable() {
public void run() {
formatter.format(lib, writer);
writer.flush();
writer.close();
}
... | 0 |
public AsciiParser(String systemID) throws GridBagException {
String id = systemID;
if (id.endsWith(".xml")) {
id = StringUtils.replace(id, ".xml", ".gbc");
}
ClassLoader loader = this.getClass().getClassLoader();
URL url = loader.getResource(id);
if (url ... | public static String getFileContentFromPlugin(String path) {
URL url = getURLFromPlugin(path);
StringBuffer sb = new StringBuffer();
try {
Scanner scanner = new Scanner(url.openStream());
while (scanner.hasNextLine()) {
String line = scanner.nextLine()... | 0 |
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException {
String name = metadata.get(Metadata.RESOURCE_NAME_KEY);
if (name != null && wanted.containsKey(name)) {
FileOutputStream out = new File... | 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);
}
... | 0 |
public boolean actualizarDatosFinal(int idJugadorDiv, int idRonda, jugadorxDivxRonda unjxdxr) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET resultado = ?, puntajeRonda = ? " + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRon... | public boolean register(Object o) {
String passwordAsText;
if (o == null) throw new IllegalArgumentException("object cannot be null");
if (!(o instanceof User)) {
throw new IllegalArgumentException("passed argument is not an instance of the User class");
}
User ne... | 0 |
private static InputStream getCMSResultAsStream(String rqlQuery) throws RQLException {
OutputStreamWriter osr = null;
try {
URL url = new URL("http", HOST, FILE);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
osr = new OutputStream... | public APIResponse delete(String id) throws Exception {
APIResponse response = new APIResponse();
connection = (HttpURLConnection) new URL(url + "/api/variable/delete/" + id).openConnection();
connection.setRequestMethod("DELETE");
connection.setConnectTimeout(TIMEOUT);
conne... | 0 |
public void run() {
try {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setDoInput(true);
byte[] encodedPassword = (username + ":" + password).getBytes();
BASE64Encode... | public static void copyFile(File in, File out) {
try {
FileChannel inChannel = null, outChannel = null;
try {
out.getParentFile().mkdirs();
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getChan... | 0 |
public static boolean copy(FileSystem srcFS, Path src, File dst, boolean deleteSource, Configuration conf) throws IOException {
if (srcFS.getFileStatus(src).isDir()) {
if (!dst.mkdirs()) {
return false;
}
FileStatus contents[] = srcFS.listStatus(src);
... | public void sendTextFile(String filename) throws IOException {
Checker.checkEmpty(filename, "filename");
URL url = _getFile(filename);
PrintWriter out = getWriter();
Streams.copy(new InputStreamReader(url.openStream()), out);
out.close();
}
| 0 |
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException {
String name = metadata.get(Metadata.RESOURCE_NAME_KEY);
if (name != null && wanted.containsKey(name)) {
FileOutputStream out = new File... | public int create(BusinessObject o) throws DAOException {
int insert = 0;
int id = 0;
Item item = (Item) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("INSERT_ITEM"));
pst.setString(1, item.getDescription());
pst... | 0 |
public void get() {
try {
int cnt;
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(false);
InputStream is = conn.getInputStream();
String filename = new File(url.... | public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: GZip source");
return;
}
String zipname = args[0] + ".gz";
GZIPOutputStream zipout;
try {
FileOutputStream out = new FileOutputStream(zipname);
... | 0 |
protected static final byte[] digest(String s) {
byte[] ret = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes());
ret = md.digest();
} catch (NoSuchAlgorithmException e) {
System.err.println("no message dig... | public FileParse(String fileStr, String type) throws MalformedURLException, IOException {
this.inFile = fileStr;
this.type = type;
System.out.println("File str " + fileStr);
if (fileStr.indexOf("http://") == 0) {
URL url = new URL(fileStr);
urlconn = url.openC... | 0 |
protected Document getRawResults(String urlString, Map args) throws Exception {
int count = 0;
Iterator keys = args.keySet().iterator();
while (keys.hasNext()) {
String sep = count++ == 0 ? "?" : "&";
String name = (String) keys.next();
if (args.get(name) ... | public static String md5(String str) {
if (logger.isDebugEnabled()) {
logger.debug("md5(String) - start");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] b = md.digest();
StringBuffer ... | 0 |
public boolean submit(String uri) throws java.io.IOException, Exception {
if (getUserInfo()) {
String encodedrdf = URLEncoder.encode(rdfpayload, "UTF-8");
URL url = new URL(uri);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
... | public static void saveFileData(File file, File destination, java.io.File newDataFile) throws Exception {
String fileName = file.getFileName();
String assetsPath = FileFactory.getRealAssetsRootPath();
new java.io.File(assetsPath).mkdir();
java.io.File workingFile = getAssetIOFile(fil... | 0 |
public static void save(String packageName, ArrayList<byte[]> fileContents, ArrayList<String> fileNames) throws Exception {
String dirBase = Util.JAVA_DIR + File.separator + packageName;
File packageDir = new File(dirBase);
if (!packageDir.exists()) {
boolean created = packageDir... | public String uploadFile(String url, int port, String uname, String upass, InputStream input) {
String serverPath = config.getServerPath() + DateUtil.getSysmonth();
FTPClient ftp = new FTPClient();
try {
int replyCode;
ftp.connect(url, port);
ftp.login(una... | 0 |
public void run(String[] args) throws Throwable {
FileInputStream input = new FileInputStream(args[0]);
FileOutputStream output = new FileOutputStream(args[0] + ".out");
Reader reader = $(Reader.class, $declass(input));
Writer writer = $(Writer.class, $declass(output));
Pump ... | private boolean saveNodeMeta(NodeInfo info, int properties) {
boolean rCode = false;
String query = mServer + "save.php" + ("?id=" + info.getId());
try {
URL url = new URL(query);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
byte[] bo... | 0 |
public static String getMD5Hash(String original) {
StringBuffer sb = new StringBuffer();
try {
StringReader sr = null;
int crypt_byte = 0;
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(original.getBytes());
... | public void googleImageSearch(String search, String start) {
try {
String u = "http://images.google.com/images?q=" + search + start;
if (u.contains(" ")) {
u = u.replace(" ", "+");
}
URL url = new URL(u);
HttpURLConnection httpcon =... | 0 |
private InputStream sendRequest(SequenceI seq) throws UnsupportedEncodingException, IOException {
StringBuilder putBuf = new StringBuilder();
processOptions(putBuf);
putBuf.append("INPUT_SEQUENCE=");
putBuf.append(URLEncoder.encode(">" + seq.getName() + "\n", ENCODING));
putB... | private String digest(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[64];
md.update(input.getBytes("iso-8859-1"), 0, input.length());
md5hash = md.digest();
return th... | 0 |
public static Object loadXmlFromUrl(URL url, int timeout, XML_TYPE xmlType) throws IOException {
URLConnection connection = url.openConnection();
connection.setConnectTimeout(timeout);
connection.setReadTimeout(timeout);
BufferedInputStream buffInputStream = new BufferedInputStream(c... | private static void loadDefaultSettings(final String configFileName) {
InputStream in = null;
OutputStream out = null;
try {
in = Thread.currentThread().getContextClassLoader().getResourceAsStream(META_INF_DEFAULT_CONFIG_PROPERTIES);
out = new FileOutputStream(configF... | 0 |
private boolean checkHashBack(Facade facade, HttpServletRequest req) {
String txtTransactionID = req.getParameter("txtTransactionID");
String txtOrderTotal = req.getParameter("txtOrderTotal");
String txtShopId = facade.getSystemParameter(GlobalParameter.yellowPayMDMasterShopID);
Stri... | public void sendTextFile(String filename) throws IOException {
Checker.checkEmpty(filename, "filename");
URL url = _getFile(filename);
PrintWriter out = getWriter();
Streams.copy(new InputStreamReader(url.openStream()), out);
out.close();
}
| 0 |
private final String createMD5(String pwd) throws Exception {
MessageDigest md = (MessageDigest) MessageDigest.getInstance("MD5").clone();
md.update(pwd.getBytes("UTF-8"));
byte[] pd = md.digest();
StringBuffer app = new StringBuffer();
for (int i = 0; i < pd.length; i++) {
... | private String copyImageFile(String urlString, String filePath) {
FileOutputStream destination = null;
File destination_file = null;
String inLine;
String dest_name = "";
byte[] buffer;
int bytes_read;
int last_offset = 0;
int offset = 0;
Input... | 0 |
@Test
public void test30_passwordAging() throws Exception {
Db db = DbConnection.defaultCieDbRW();
try {
db.begin();
Config.setProperty(db, "com.entelience.esis.security.passwordAge", "5", 1);
PreparedStatement pst = db.prepareStatement("UPDATE e_people SET la... | @Test
public void returnsEnclosedResponseOnUnsuccessfulException() throws Exception {
Exception e = new UnsuccessfulResponseException(resp);
expect(mockBackend.execute(host, req, ctx)).andThrow(e);
replay(mockBackend);
HttpResponse result = impl.execute(host, req, ctx);
v... | 0 |
public static String connRemote(JSONObject jsonObject, String OPCode) {
String retSrc = "";
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(AZConstants.validateURL);
HttpParams httpParams = new BasicHttpParams();
... | private void loadBinaryStream(String streamName, InputStream streamToLoad, long sz, HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType(getContentType(req, streamName));
resp.setHeader("Content-Disposition", "inline;filename=" + streamName);
... | 0 |
public void testJPEGRaster() throws MalformedURLException, IOException {
System.out.println("JPEGCodec RasterImage:");
long start = Calendar.getInstance().getTimeInMillis();
for (int i = 0; i < images.length; i++) {
String url = Constants.getDefaultURIMediaConnectorBasePath() + "... | public UserFunction loadMFileViaWeb(URL codeBase, String directoryAndFile, String mFileName) {
String code = "";
UserFunction function = null;
ErrorLogger.debugLine("MFileLoader: loading >" + mFileName + ".m<");
try {
URL url = new URL(codeBase, directoryAndFile);
... | 0 |
private void CopyTo(File dest) throws IOException {
FileReader in = null;
FileWriter out = null;
int c;
try {
in = new FileReader(image);
out = new FileWriter(dest);
while ((c = in.read()) != -1) out.write(c);
} finally {
if (in... | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | 0 |
public int updateuser(User u) {
int i = 0;
Connection conn = null;
PreparedStatement pm = null;
try {
conn = Pool.getConnection();
conn.setAutoCommit(false);
pm = conn.prepareStatement("update user set username=?,passwd=?,existstate=?,management=? ... | public static void saveFileData(File file, File destination, java.io.File newDataFile) throws Exception {
String fileName = file.getFileName();
String assetsPath = FileFactory.getRealAssetsRootPath();
new java.io.File(assetsPath).mkdir();
java.io.File workingFile = getAssetIOFile(fil... | 0 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String senha = "";
String email = request.getParameter("EmailLogin");
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDi... | private String File2String(String directory, String filename) {
String line;
InputStream in = null;
try {
File f = new File(filename);
System.out.println("File On:>>>>>>>>>> " + f.getCanonicalPath());
in = new FileInputStream(f);
} catch (FileNotFo... | 0 |
public static void copy(File src, File dest) throws FileNotFoundException, IOException {
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
try {
byte[] buf = new byte[1024];
int c = -1;
while ((c = in.read(bu... | private void update(String statement, SyrupConnection con, boolean do_log) throws Exception {
Statement s = null;
try {
s = con.createStatement();
s.executeUpdate(statement);
con.commit();
} catch (Throwable e) {
if (do_log) {
l... | 0 |
private static byte[] baseHash(String name, String password) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.reset();
digest.update(name.toLowerCase().getBytes());
digest.update(password.getBytes());
return digest.digest();
... | 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... | 0 |
public InputStream retrieveStream(String url) {
HttpGet getRequest = new HttpGet(url);
try {
HttpResponse getResponse = getClient().execute(getRequest);
final int statusCode = getResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
... | private 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;
try {
sr... | 0 |
private String cookieString(String url, String ip) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
md.update((url + "&&" + ip + "&&" + salt.toString()).getBytes());
java.math.BigInteger hash = new java.math.BigInteger(1, md.digest());
... | public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: URLDumper <URL> <file>");
System.exit(1);
}
String location = args[0];
String file = args[1];
URL url = new URL(location);
FileOutputS... | 0 |
public static Object loadXmlFromUrl(URL url, int timeout, XML_TYPE xmlType) throws IOException {
URLConnection connection = url.openConnection();
connection.setConnectTimeout(timeout);
connection.setReadTimeout(timeout);
BufferedInputStream buffInputStream = new BufferedInputStream(c... | public static void loginBitShare() 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);
... | 0 |
public static String getFileContentFromPlugin(String path) {
URL url = getURLFromPlugin(path);
StringBuffer sb = new StringBuffer();
try {
Scanner scanner = new Scanner(url.openStream());
while (scanner.hasNextLine()) {
String line = scanner.nextLine()... | private VelocityEngine newVelocityEngine() {
VelocityEngine velocityEngine = null;
InputStream is = null;
try {
URL url = ClassPathUtils.getResource(VELOCITY_PROPS_FILE);
is = url.openStream();
Properties props = new Properties();
props.load(is... | 0 |
public static byte[] loadURLToBuffer(URL url) throws IOException {
byte[] buf = new byte[4096];
byte[] data = null;
byte[] temp = null;
int iCount = 0;
int iTotal = 0;
BufferedInputStream in = new BufferedInputStream(url.openStream(), 20480);
while ((iCount = ... | public void makeRead(String user, long databaseID, long time) throws SQLException {
String query = "replace into fs.read_post (post, user, read_date) values (?, ?, ?)";
ensureConnection();
PreparedStatement statement = m_connection.prepareStatement(query);
try {
statement... | 0 |
public static void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
... | private ByteArrayInputStream fetchUrl(String urlString, Exception[] outException) {
URL url;
try {
url = new URL(urlString);
InputStream is = null;
int inc = 65536;
int curr = 0;
byte[] result = new byte[inc];
try {
... | 0 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String senha = "";
String email = request.getParameter("EmailLogin");
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDi... | @Test
public void test30_passwordAging() throws Exception {
Db db = DbConnection.defaultCieDbRW();
try {
db.begin();
Config.setProperty(db, "com.entelience.esis.security.passwordAge", "5", 1);
PreparedStatement pst = db.prepareStatement("UPDATE e_people SET la... | 0 |
public HttpResponseExchange execute() throws Exception {
HttpResponseExchange forwardResponse = null;
int fetchSizeLimit = Config.getInstance().getFetchLimitSize();
while (null != lastContentRange) {
forwardRequest.setBody(new byte[0]);
Content... | public static void main(String args[]) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(args[0]));
Writer out = new FileWriter(args[1]);
out = new WrapFilter(new BufferedWriter(out), 40);
out = new TitleCaseFilter(out);
String line;
while ((l... | 0 |
public UserFunction loadMFileViaWeb(URL codeBase, String directoryAndFile, String mFileName) {
String code = "";
UserFunction function = null;
ErrorLogger.debugLine("MFileLoader: loading >" + mFileName + ".m<");
try {
URL url = new URL(codeBase, directoryAndFile);
... | public String digest(String message) throws NoSuchAlgorithmException, EncoderException {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(message.getBytes());
byte[] raw = messageDigest.digest();
byte[] chars = new Base64().encode(raw);
... | 0 |
@Test(expected = GadgetException.class)
public void malformedGadgetSpecIsCachedAndThrows() throws Exception {
HttpRequest request = createCacheableRequest();
expect(pipeline.execute(request)).andReturn(new HttpResponse("malformed junk")).once();
replay(pipeline);
try {
... | @Test
public void test01_ok_failed_500_no_logo() throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
try {
HttpPost post = new HttpPost(xlsURL);
HttpResponse response = client.execute(post);
assertEquals("failed code for ", 500, response.get... | 0 |
public Bitmap retrieveBitmap(String urlString) {
Log.d(Constants.LOG_TAG, "making HTTP trip for image:" + urlString);
Bitmap bitmap = null;
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
conn.setConnectTimeout(3000);
... | public static Model downloadModel(String url) {
Model model = ModelFactory.createDefaultModel();
try {
URLConnection connection = new URL(url).openConnection();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnectio... | 0 |
public static void main(String[] args) throws Exception {
int result = 20;
if (args.length == 1) {
StringBuffer urlString = new StringBuffer(args[0]);
if (urlString.lastIndexOf("/") != urlString.length() - 1) {
urlString.append('/');
}
... | public boolean update(String dbName, Query[] queries) throws ServiceException {
Connection con = null;
PreparedStatement pstmt = null;
int rows = 0;
try {
con = getDbConnection().getConnection(dbName);
con.setAutoCommit(false);
for (int i = 0; i < ... | 0 |
protected String downloadURLtoString(URL url) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer sb = new StringBuffer(100 * 1024);
String str;
while ((str = in.readLine()) != null) {
sb.append(str);
... | @Test
public void testSpeedyShareUpload() throws Exception {
request.setUrl("http://www.speedyshare.com/upload.php");
request.setFile("fileup0", file);
HttpResponse response = httpClient.execute(request);
assertTrue(response.is2xxSuccess());
assertTrue(response.getRespons... | 0 |
private boolean getWave(String url, String Word) {
try {
File FF = new File(f.getParent() + "/" + f.getName() + "pron");
FF.mkdir();
URL url2 = new URL(url);
BufferedReader stream = new BufferedReader(new InputStreamReader(url2.openStream()));
File... | public String transformByMD5(String password) throws XSServiceException {
MessageDigest md5;
byte[] output;
StringBuffer bufferPass;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.warn("DataAccessException t... | 0 |
@Test
public void test30_passwordAging() throws Exception {
Db db = DbConnection.defaultCieDbRW();
try {
db.begin();
Config.setProperty(db, "com.entelience.esis.security.passwordAge", "5", 1);
PreparedStatement pst = db.prepareStatement("UPDATE e_people SET la... | public void seeURLConnection() throws Exception {
URL url = new URL("http://wantmeet.iptime.org");
URLConnection uc = url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String s = null;
StringBuffer sb = new StringBuffer(... | 0 |
public static void copyFile(File from, File to) throws IOException {
assert (from != null);
assert (to != null);
if (!to.exists()) {
File parentDir = to.getParentFile();
if (!parentDir.exists()) parentDir.mkdirs();
to.createNewFile();
}
Fil... | public int updateuser(User u) {
int i = 0;
Connection conn = null;
PreparedStatement pm = null;
try {
conn = Pool.getConnection();
conn.setAutoCommit(false);
pm = conn.prepareStatement("update user set username=?,passwd=?,existstate=?,management=? ... | 0 |
public static SVNConfiguracion load(URL urlConfiguracion) {
SVNConfiguracion configuracion = null;
try {
XMLDecoder xenc = new XMLDecoder(urlConfiguracion.openStream());
configuracion = (SVNConfiguracion) xenc.readObject();
configuracion.setFicheroConfiguracion(ur... | private VelocityEngine newVelocityEngine() {
VelocityEngine velocityEngine = null;
InputStream is = null;
try {
URL url = ClassPathUtils.getResource(VELOCITY_PROPS_FILE);
is = url.openStream();
Properties props = new Properties();
props.load(is... | 0 |
@Override
public EntrySet read(EntrySet set) throws ReadFailedException {
if (!SourceCache.contains(url)) {
SSL.certify(url);
try {
super.setParser(Parser.detectParser(url.openStream()));
final PipedInputStream in = new PipedInputStream();
... | private void reload() {
if (xml != null) {
try {
String currentDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
if (currentDate.equalsIgnoreCase(exchangeRateDate)) {
return;
}
} catch (Exception e) {
... | 0 |
public static URL[] getDirectoryListing(URL url) throws IOException, CancelledOperationException {
FileSystem.logger.log(Level.FINER, "listing {0}", url);
String file = url.getFile();
if (file.charAt(file.length() - 1) != '/') {
url = new URL(url.toString() + '/');
}
... | public void googleImageSearch() {
if (artist.compareToIgnoreCase(previousArtist) != 0) {
MusicBoxView.googleImageLocation = 0;
try {
String u = "http://images.google.com/images?q=" + currentTrack.getArtist() + " - " + currentTrack.getAlbum() + "&sa=N&start=0&ndsp=21";... | 0 |
public void serialize(OutputStream out) throws IOException, BadIMSCPException {
ensureParsed();
ZipFilePackageParser parser = utils.getIMSCPParserFactory().createParser();
parser.setContentPackage(cp);
if (on_disk != null) on_disk.delete();
on_disk = createTemporaryFile();
... | public void updateUser(final User user) throws IOException {
try {
Connection conn = null;
boolean autoCommit = false;
try {
conn = pool.getConnection();
autoCommit = conn.getAutoCommit();
conn.setAutoCommit(false);
... | 0 |
private static void copyFile(String src, String target) throws IOException {
FileChannel ic = new FileInputStream(src).getChannel();
FileChannel oc = new FileOutputStream(target).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
}
| public boolean actEstadoEnBD(int idRonda) {
int intResult = 0;
String sql = "UPDATE ronda " + " SET estado = 1" + " WHERE numeroRonda = " + idRonda;
try {
connection = conexionBD.getConnection();
connection.setAutoCommit(false);
ps = connection.prepareStat... | 0 |
public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | private void extractZipFile(String filename, JTextPane progressText) throws IOException {
String destinationname = "";
byte[] buf = new byte[1024];
ZipInputStream zipinputstream = null;
ZipEntry zipentry;
zipinputstream = new ZipInputStream(new FileInputStream(filename));
... | 0 |
private static Properties loadPropertiesFromClasspath(String path) {
Enumeration<URL> locations;
Properties props = new Properties();
try {
locations = Thread.currentThread().getContextClassLoader().getResources(path);
while (locations.hasMoreElements()) {
... | public boolean update(String dbName, Query[] queries) throws ServiceException {
Connection con = null;
PreparedStatement pstmt = null;
int rows = 0;
try {
con = getDbConnection().getConnection(dbName);
con.setAutoCommit(false);
for (int i = 0; i < ... | 0 |
private static HttpURLConnection sendPost(String reqUrl, Map<String, String> parameters) {
HttpURLConnection urlConn = null;
try {
String params = generatorParamString(parameters);
URL url = new URL(reqUrl);
urlConn = (HttpURLConnection) url.openConnection();
... | private void doImageProcess(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("image/" + type + "");
Point imgSize = null;
if (width > 0 || height > 0) {
imgSize = new Point(width, height);
}
if (fmt != null && ... | 0 |
public void parse() throws ParserConfigurationException, SAXException, IOException {
DefaultHttpClient httpclient = initialise();
HttpResponse result = httpclient.execute(new HttpGet(urlString));
SAXParserFactory spf = SAXParserFactory.newInstance();
if (spf != null) {
SA... | 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... | 0 |
private void updateFile(File file) throws FileNotFoundException, IOException {
File destFile = new File(file.getPath().replace(URL_UNZIPPED_PREFIX + latestVersion, ""));
FileChannel in = null;
FileChannel out = null;
try {
if (!destFile.exists()) {
destFil... | String fetch_pls(String pls) {
InputStream pstream = null;
if (pls.startsWith("http://")) {
try {
URL url = null;
if (running_as_applet) {
url = new URL(getCodeBase(), pls);
} else {
url = new URL(pls... | 0 |
public InputStream retrieveStream(String url) {
HttpGet getRequest = new HttpGet(url);
try {
HttpResponse getResponse = getClient().execute(getRequest);
final int statusCode = getResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
... | public static String fromHtml(URL url, String defaultEncoding, boolean overrideEncoding) throws IOException, BadDocumentException {
URLConnection conn = url.openConnection();
String contentType = conn.getContentType();
String encoding = conn.getContentEncoding();
if (encoding == null... | 0 |
public static byte[] encrypt(String x) throws Exception {
java.security.MessageDigest d = null;
d = java.security.MessageDigest.getInstance("SHA-1");
d.reset();
d.update(x.getBytes());
return d.digest();
}
| private String getFullScreenUrl() {
progressDown.setIndeterminate(true);
System.out.println("Har: " + ytUrl);
String u = ytUrl;
URLConnection conn = null;
String line = null;
String data = "";
String fullUrl = "";
try {
URL url = new URL(u)... | 0 |
private InputStream sendRequest(SequenceI seq) throws UnsupportedEncodingException, IOException {
StringBuilder putBuf = new StringBuilder();
processOptions(putBuf);
putBuf.append("INPUT_SEQUENCE=");
putBuf.append(URLEncoder.encode(">" + seq.getName() + "\n", ENCODING));
putB... | private synchronized void loadDDL() throws IOException {
try {
conn.createStatement().executeQuery("SELECT * FROM non_generic_favs").close();
} catch (SQLException e) {
Statement stmt = null;
if (!e.getMessage().matches(ERR_MISSING_TABLE)) {
e.prin... | 0 |
public static String SHA1(String text) {
byte[] sha1hash = new byte[40];
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
} catch (UnsupportedEncodingException ex... | public static ArrayList<String> loadURLToStrings(URL url, int maxLines, String userAgent, int timeout) throws IOException {
URLConnection connection = url.openConnection();
if (userAgent != null && userAgent.trim().length() > 0) {
connection.setRequestProperty("User-Agent", userAgent);
... | 0 |
private void copy(File inputFile, File outputFile) throws Exception {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
... | public boolean actEstadoEnBD(int idRonda) {
int intResult = 0;
String sql = "UPDATE ronda " + " SET estado = 1" + " WHERE numeroRonda = " + idRonda;
try {
connection = conexionBD.getConnection();
connection.setAutoCommit(false);
ps = connection.prepareStat... | 0 |
public void open(Input input) throws IOException, ResolverException {
if (!input.isUriDefinitive()) return;
URI uri;
try {
uri = new URI(input.getUri());
} catch (URISyntaxException e) {
throw new ResolverException(e);
}... | private String md5(String uri) throws ConnoteaRuntimeException {
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(uri.getBytes());
byte[] bytes = messageDigest.digest();
StringBuffer stringBuffer = new StringBuffer();
... | 0 |
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == EventType.ACTIVATED) {
try {
URL url = e.getURL();
InputStream stream = url.openStream();
try {
StringWriter writer = new StringWriter();
... | public static String getUniqueKey() {
String digest = "";
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
final String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
try {
localHost = InetAddres... | 0 |
public static void copyFile(File src, File dest, int bufSize, boolean force) throws IOException {
if (dest.exists()) if (force) dest.delete(); else throw new IOException("Cannot overwrite existing file: " + dest.getName());
byte[] buffer = new byte[bufSize];
int read = 0;
InputStream... | private void generateDeviceUUID() {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(deviceType.getBytes());
md5.update(internalId.getBytes());
md5.update(bindAddress.getHostName().getBytes());
StringBuffer hexString = new Str... | 0 |
private void readIntoList(URL url, Map<String, JMenuItem> list) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
int commandNameBegin = inputLine.indexO... | public static InputStream getFileInputStream(String path) throws IOException {
InputStream is = null;
File file = new File(path);
if (file.exists()) is = new BufferedInputStream(new FileInputStream(file));
if (is == null) {
URL url = FileUtils.class.getClassLoader().getRe... | 0 |
public static String encrypt(String text) throws NoSuchAlgorithmException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
try {
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (UnsupportedEncodingExceptio... | public Vector<String> getNetworkServersIPs(String netaddress) {
Vector<String> result = new Vector<String>();
boolean serverline = false;
String line;
String[] splitline;
try {
URL url = new URL(netaddress);
URLConnection connection = url.openConnectio... | 0 |
@Test
public void testLoadHttpGzipped() throws Exception {
String url = HTTP_GZIPPED;
LoadingInfo loadingInfo = Utils.openFileObject(fsManager.resolveFile(url));
InputStream contentInputStream = loadingInfo.getContentInputStream();
byte[] actual = IOUtils.toByteArray(contentInput... | public void setImg() {
JFileChooser jFileChooser1 = new JFileChooser();
String separator = "";
if (JFileChooser.APPROVE_OPTION == jFileChooser1.showOpenDialog(this.getFatherFrame())) {
setPath(jFileChooser1.getSelectedFile().getPath());
separator = jFileChooser1.getSe... | 0 |
private void updateFile(File file) throws FileNotFoundException, IOException {
File destFile = new File(file.getPath().replace(URL_UNZIPPED_PREFIX + latestVersion, ""));
FileChannel in = null;
FileChannel out = null;
try {
if (!destFile.exists()) {
destFil... | public void update(String channelPath, String dataField, String fatherDocId) {
String sqlInitial = "select uri from t_ip_doc_res where doc_id = '" + fatherDocId + "' and type=" + " '" + ces.platform.infoplat.core.DocResource.DOC_MAGAZINE_TYPE + "' ";
String sqlsortURL = "update t_ip_doc_res set uri ... | 0 |
public static String getDigest(String user, String realm, String password, String method, String uri, String nonce) {
String digest1 = user + ":" + realm + ":" + password;
String digest2 = method + ":" + uri;
try {
MessageDigest digestOne = MessageDigest.getInstance("md5");
... | public static void copyFromTo(File srcFile, File destFile) {
FileChannel in = null, out = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(srcFile);
} catch (FileNotFoundException fnfe) {
System.out.println... | 0 |
public boolean deleteRoleType(int id, int namespaceId, boolean removeReferencesInRoleTypes, DTSPermission permit) throws SQLException, PermissionException, DTSValidationException {
checkPermission(permit, String.valueOf(namespaceId));
boolean exist = isRoleTypeUsed(namespaceId, id);
if (exis... | public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: URLDumper <URL> <file>");
System.exit(1);
}
String location = args[0];
String file = args[1];
URL url = new URL(location);
FileOutputS... | 0 |
public static String doPost(String URL, List<NameValuePair> params) {
try {
OauthUtil util = new OauthUtil();
URI uri = new URI(URL);
HttpClient httpclient = util.getNewHttpClient();
HttpPost postMethod = new HttpPost(uri);
StringBuffer paramString... | public String transformByMD5(String password) throws XSServiceException {
MessageDigest md5;
byte[] output;
StringBuffer bufferPass;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.warn("DataAccessException t... | 0 |
public static void main(String[] args) throws IOException {
String urltext = "http://www.vogella.de";
URL url = new URL(urltext);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
... | public DataRecord addRecord(InputStream input) throws DataStoreException {
File temporary = null;
try {
temporary = newTemporaryFile();
DataIdentifier tempId = new DataIdentifier(temporary.getName());
usesIdentifier(tempId);
long length = 0;
... | 0 |
public static byte[] hash(final byte[] saltBefore, final String content, final byte[] saltAfter, final int repeatedHashingCount) throws NoSuchAlgorithmException, UnsupportedEncodingException {
if (content == null) return null;
final MessageDigest digest = MessageDigest.getInstance(DIGEST);
i... | private static void loadDefaultPreferences() {
try {
URL url = ClassLoader.getSystemResource("OpenDarkRoom.defaults.properties");
preferences.load(url.openStream());
} catch (FileNotFoundException e) {
log.error("Default preferences file not found");
} cat... | 0 |
public void testJPEGRaster() throws MalformedURLException, IOException {
System.out.println("JPEGCodec RasterImage:");
long start = Calendar.getInstance().getTimeInMillis();
for (int i = 0; i < images.length; i++) {
String url = Constants.getDefaultURIMediaConnectorBasePath() + "... | public static String getMD5Hash(String original) {
StringBuffer sb = new StringBuffer();
try {
StringReader sr = null;
int crypt_byte = 0;
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(original.getBytes());
... | 0 |
public List<RTTicket> getTicketsForQueue(final String queueName, long limit) {
getSession();
final List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("query", "Queue='" + queueName + "' AND Status='open'"));
params.add(new BasicNameValuePai... | public FileParse(String fileStr, String type) throws MalformedURLException, IOException {
this.inFile = fileStr;
this.type = type;
System.out.println("File str " + fileStr);
if (fileStr.indexOf("http://") == 0) {
URL url = new URL(fileStr);
urlconn = url.openC... | 0 |
public static void main(String[] args) throws FileNotFoundException {
if (args.length < 2) throw new IllegalArgumentException();
String fnOut = args[args.length - 1];
PrintWriter writer = new PrintWriter(fnOut);
for (int i = 0; i < args.length - 1; i++) {
File fInput = ne... | public ArrayList<String> showTopLetters() {
int[] tempArray = new int[engCountLetters.length];
char[] tempArrayLetters = new char[abcEng.length];
ArrayList<String> resultTopFiveLetters = new ArrayList<String>();
tempArray = engCountLetters.clone();
tempArrayLetters = abcEng.c... | 0 |
public void testJPEGRaster() throws MalformedURLException, IOException {
System.out.println("JPEGCodec RasterImage:");
long start = Calendar.getInstance().getTimeInMillis();
for (int i = 0; i < images.length; i++) {
String url = Constants.getDefaultURIMediaConnectorBasePath() + "... | public String get(String url) {
try {
HttpGet get = new HttpGet(url);
HttpResponse response = this.getHttpClient().execute(get);
HttpEntity entity = response.getEntity();
if (entity == null) {
throw new RuntimeException("response body was empty... | 0 |
public static URL addToArchive(Pod pod, ZipOutputStream podArchiveOutputStream, String filename, InputStream source) throws IOException {
ZipEntry entry = new ZipEntry(filename);
podArchiveOutputStream.putNextEntry(entry);
IOUtils.copy(source, podArchiveOutputStream);
podArchiveOutpu... | @Override
public byte[] download(URI uri) throws NetworkException {
log.info("download: " + uri);
HttpGet httpGet = new HttpGet(uri.toString());
try {
HttpResponse httpResponse = httpClient.execute(httpGet);
return EntityUtils.toByteArray(httpResponse.getEntity())... | 0 |
public void run() {
BufferedReader reader = null;
String message = null;
int messageStyle = SWT.ICON_WARNING;
try {
URL url = new URL(Version.LATEST_VERSION_URL);
URLConnection... | public static String getMD5Hash(String in) {
StringBuffer result = new StringBuffer(32);
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(in.getBytes());
Formatter f = new Formatter(result);
for (byte b : md5.digest()) {
... | 0 |
public void testJPEGRaster() throws MalformedURLException, IOException {
System.out.println("JPEGCodec RasterImage:");
long start = Calendar.getInstance().getTimeInMillis();
for (int i = 0; i < images.length; i++) {
String url = Constants.getDefaultURIMediaConnectorBasePath() + "... | public void testCodingEmptyFile() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
... | 0 |
private InputStream getInputStream(String item) {
InputStream is = null;
URLConnection urlc = null;
try {
URL url = new URL(item);
urlc = url.openConnection();
is = urlc.getInputStream();
current_source = url.getProtocol() + "://" + url.getHost... | public static void copyFileByNIO(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | 0 |
public static int[] sortAscending(float 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]) {
f... | public void load(URL url) throws IOException {
ResourceLocator locator = null;
try {
locator = new RelativeResourceLocator(url);
} catch (URISyntaxException use) {
throw new IllegalArgumentException("Bad URL: " + use);
}
ResourceLocatorTool.addResource... | 0 |
public static long getFileSize(String address) {
URL url = null;
try {
url = new URL(address);
System.err.println("Indirizzo valido - " + url.toString().substring(0, 10) + "...");
} catch (MalformedURLException ex) {
System.err.println("Indirizzo non valid... | public static boolean loadContentFromURL(String fromURL, String toFile) {
try {
URL url = new URL("http://bible-desktop.com/xml" + fromURL);
File file = new File(toFile);
URLConnection ucon = url.openConnection();
InputStream is = ucon.getInputStream();
... | 0 |
public String readRemoteFile() throws IOException {
String response = "";
boolean eof = false;
URL url = new URL(StaticData.remoteFile);
InputStream is = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String s;
s = br.read... | public InputStream openInput(Fragment path) throws IOException {
int len = path.words().size();
String p = Util.combine("/", path.words().subList(1, len));
URL url = new URL("http", path.words().get(0), p);
InputStream result = url.openStream();
return result;
}
| 0 |
@Test
public void test01_ok_failed_500_no_logo() throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
try {
HttpPost post = new HttpPost(xlsURL);
HttpResponse response = client.execute(post);
assertEquals("failed code for ", 500, response.get... | public static void copy(File source, File destination) throws FileNotFoundException, IOException {
if (source == null) throw new NullPointerException("The source may not be null.");
if (destination == null) throw new NullPointerException("The destination may not be null.");
FileInputStream s... | 0 |
public static String installOvalDefinitions(final String xml_location) {
InputStream in_stream = null;
try {
URL url = _toURL(xml_location);
if (url == null) {
in_stream = new FileInputStream(xml_location);
} else {
in_stream = url.... | public Resource createNew(String name, InputStream in, Long length, String contentType) throws IOException {
File dest = new File(this.getRealFile(), name);
LOGGER.debug("PUT?? - real file: " + this.getRealFile() + ",name: " + name);
if (isOwner) {
if (!".request".equals(name) &&... | 0 |
public static MessageService getMessageService(String fileId) {
MessageService ms = null;
if (serviceCache == null) init();
if (serviceCache.containsKey(fileId)) return serviceCache.get(fileId);
Properties p = new Properties();
try {
URL url = I18nPlugin.getFileUR... | public String new2Password(String passwd) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
String clearPassword = passwd;
md.update(clearPassword.getBytes());
byte[] digestedPassword = md.digest();
return new String(digestedPassword);... | 0 |
public static boolean dump(File source, File target) {
boolean done = false;
try {
InputStream is = new BufferedInputStream(new FileInputStream(source));
OutputStream os = new BufferedOutputStream(new FileOutputStream(target));
while (is.available() > 0) {
... | public static String getSHADigest(String password) {
String digest = null;
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA-1");
sha.reset();
sha.update(password.getBytes());
byte[] pwhash = sha.digest();
digest ... | 0 |
private void runGetAppListing() {
DataStorage.clearAppListings();
GenericUrl url = new GoogleUrl(EnterpriseMarketplaceUrl.generateAppListingUrl() + DataStorage.getVendorProfile().vendorId);
AppListingList appListingList;
try {
HttpRequest request = requestFactory.buildGet... | public static void copyFile(File srcFile, File destFile) throws IOException {
logger.debug("copyFile(srcFile={}, destFile={}) - start", srcFile, destFile);
FileChannel srcChannel = new FileInputStream(srcFile).getChannel();
FileChannel dstChannel = new FileOutputStream(destFile).getChannel()... | 0 |
private VelocityEngine newVelocityEngine() {
VelocityEngine velocityEngine = null;
InputStream is = null;
try {
URL url = ClassPathUtils.getResource(VELOCITY_PROPS_FILE);
is = url.openStream();
Properties props = new Properties();
props.load(is... | 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... | 0 |
private void loadBinaryStream(String streamName, InputStream streamToLoad, long sz, HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType(getContentType(req, streamName));
resp.setHeader("Content-Disposition", "inline;filename=" + streamName);
... | private String executePost(String targetURL, String urlParameters) {
URL url;
HttpURLConnection connection = null;
try {
url = new URL(targetURL);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
conne... | 0 |
public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | public static byte[] getSystemStateHash() {
MessageDigest sha1;
try {
sha1 = MessageDigest.getInstance("SHA1");
} catch (Exception e) {
throw new Error("Error in RandomSeed, no sha1 hash");
}
sha1.update((byte) System.currentTimeMillis());
sha1... | 0 |
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 static void loadMappings(Configuration cfg) {
try {
Enumeration en = LoadingUtils.getResources(MAPPINGS_FILE);
while (en.hasMoreElements()) {
URL url = (URL) en.nextElement();
logger.info("Found mapping module " + url.toExternalForm());
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.