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 |
|---|---|---|---|---|---|
898,800 | 17,999,460 | 15,759,378 | public static long toFile(final DigitalObject object, final File file) {
try {
FileOutputStream fOut = new FileOutputStream(file);
long bytesCopied = IOUtils.copyLarge(object.getContent().getInputStream(), fOut);
fOut.close();
return bytesCopied;
} cat... | public static String email_get_public_hash(String email) {
try {
if (email != null) {
email = email.trim().toLowerCase();
CRC32 crc32 = new CRC32();
crc32.reset();
crc32.update(email.getBytes());
MessageDigest md5 = ... | false |
898,801 | 4,396,970 | 6,045,800 | public HttpURLConnection proxiedURLConnection(URL url, String serverName) throws IOException, PussycatException {
if (this.httpProxy == null || this.httpProxy.equals("") || PussycatUtils.isLocalURL(url.toString()) || url.toString().contains(serverName)) {
System.getProperties().put("proxySet", "... | private void announce(String trackerURL, byte[] hash, byte[] peerId, int port) {
try {
String strUrl = trackerURL + "?info_hash=" + URLEncoder.encode(new String(hash, Constants.BYTE_ENCODING), Constants.BYTE_ENCODING).replaceAll("\\+", "%20") + "&peer_id=" + URLEncoder.encode(new String(peerId, ... | false |
898,802 | 15,537,156 | 20,822,727 | private void copy(String inputPath, String outputPath, String name) {
try {
FileReader in = new FileReader(inputPath + name);
FileWriter out = new FileWriter(outputPath + name);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | private static void copyFile(String fromFile, String toFile) throws Exception {
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
to = new FileOutputStream(toFile);
byte[] buffer = new byte[4096];
... | true |
898,803 | 5,933,080 | 388,884 | public void addUser(String username, String password, String filename) {
String data = "";
try {
open(filename);
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(password.getBytes());
byte[] digest = mdAlgorithm.digest()... | public static void downloadFileFromHTTP(String address) {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
int lastSlashIndex = address.lastIndexOf('/');
if (!(lastSlashIndex >= 0 && lastSlashIndex < address.length() - 1)) {
System.err.pr... | false |
898,804 | 15,760,850 | 15,988,780 | public static void main(String[] args) {
File container = new File(ArchiveFeature.class.getProtectionDomain().getCodeSource().getLocation().toURI());
if (container == null) {
throw new RuntimeException("this use-case isn't being invoked from the executable jar");
}
JarFil... | private void serveCGI(TinyCGI script) throws IOException, TinyWebThreadException {
parseHTTPHeaders();
OutputStream cgiOut = null;
File tempFile = null;
try {
if (script == null) sendError(500, "Internal Error", "Couldn't load script.");
... | true |
898,805 | 10,106,969 | 5,321,947 | 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... | public static String SHA1(String text) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes());
byte byteData[] = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
... | true |
898,806 | 5,493,644 | 447,509 | public synchronized void run() {
logger.info("SEARCH STARTED");
JSONObject json = null;
logger.info("Opening urlConnection");
URLConnection connection = null;
try {
connection = url.openConnection();
connection.addRequestProperty("Referer", HTTP_REFERE... | 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;
... | false |
898,807 | 3,778,980 | 14,440,577 | public void update() {
Vector invalids = new Vector();
for (int i = 0; i < urls.size(); i++) {
URL url = null;
try {
url = new URL((String) urls.elementAt(i));
InputStream stream = url.openStream();
stream.close();
}... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String cacheName = req.getParameter("cacheName");
if (cacheName == null || cacheName.equals("")) {
resp.getWriter().println("parameter cacheName required");
... | false |
898,808 | 9,913,187 | 18,451,906 | protected static String encodePassword(String raw_password) throws DatabaseException {
String clean_password = validatePassword(raw_password);
try {
MessageDigest md = MessageDigest.getInstance(DEFAULT_PASSWORD_DIGEST);
md.update(clean_password.getBytes(DEFAULT_PASSWORD_ENCOD... | public static String encrypt(String value) {
MessageDigest messageDigest;
byte[] raw = null;
try {
messageDigest = MessageDigest.getInstance("SHA");
messageDigest.update(((String) value).getBytes("UTF-8"));
raw = messageDigest.digest();
} catch (No... | true |
898,809 | 1,024,884 | 19,795,307 | @Override
protected URLConnection openConnection(URL url) throws IOException {
try {
final HttpServlet servlet;
String path = url.getPath();
if (path.matches("reg:.+")) {
String registerName = path.replaceAll("reg:([^/]*)/.*", "$1");
se... | public void doRecurringPayment(Subscription subscription) {
int amount = Math.round(subscription.getTotalCostWithDiscounts() * 100.0f);
String currency = subscription.getCurrency();
String aliasCC = subscription.getAliasCC();
String expm = subscription.getLastCardExpm();
Stri... | false |
898,810 | 18,170,211 | 11,352,932 | static List<String> readZipFilesOftypeToFolder(String zipFileLocation, String outputDir, String fileType) {
List<String> list = new ArrayList<String>();
ZipFile zipFile = readZipFile(zipFileLocation);
FileOutputStream output = null;
InputStream inputStream = null;
Enumeration... | public String generateFilename() {
MessageDigest md;
byte[] sha1hash = new byte[40];
Random r = new Random();
String fileName = "";
String token = "";
while (true) {
token = Long.toString(Math.abs(r.nextLong()), 36) + Long.toString(System.currentTimeMillis... | false |
898,811 | 16,518,661 | 10,413,153 | public String quebraLink(String link) throws StringIndexOutOfBoundsException {
link = link.replace(".url", "");
int cod = 0;
final String linkInit = link.replace("#", "");
boolean estado = false;
char letra;
String linkOrig;
String newlink = "";
linkOr... | public static JuneClass loadClass(Map<String, Entity> globals, String packageName, String baseClassName) {
try {
JuneClass $class = null;
String resourceName = (packageName.length() > 0 ? packageName.replace('.', '/') + "/" : "") + baseClassName.replace('.', '$') + ".class";
... | false |
898,812 | 6,032,985 | 13,930,320 | private byte[] md5Digest(String pPassword) {
if (pPassword == null) {
throw new NullPointerException("input null text for hashing");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pPassword.getBytes());
return md.digest(... | private boolean CheckConnection() {
boolean b = false;
String host = "" + Settings.getHost();
String user = "" + Settings.getUser();
String pass = "" + Settings.getPass();
int port = Settings.getPort();
if (!ftp.isConnected()) {
try {
int r... | false |
898,813 | 6,867,571 | 13,969,472 | public void run() {
synchronized (stateLock) {
if (started) {
return;
} else {
started = true;
running = true;
}
}
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
BufferedRead... | protected void readLockssConfigFile(URL url, List<String> peers) {
PrintWriter out = null;
try {
out = new PrintWriter(new OutputStreamWriter(System.out, "utf8"), true);
out.println("unicode-output-ready");
} catch (UnsupportedEncodingException ex) {
Syste... | false |
898,814 | 16,810,590 | 17,726,029 | 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);
}
... | private String getRandomGUID(final boolean secure) {
MessageDigest md5 = null;
final StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
... | true |
898,815 | 23,658,098 | 9,492,898 | 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... | public static Object getInputStream(String name, boolean showMsg, URL appletDocumentBase, String appletProxy) {
String errorMessage = null;
int iurlPrefix;
for (iurlPrefix = urlPrefixes.length; --iurlPrefix >= 0; ) if (name.startsWith(urlPrefixes[iurlPrefix])) break;
boolean isURL = ... | false |
898,816 | 15,597,101 | 19,602,043 | public void actionPerformed(ActionEvent e) {
if (path.compareTo("") != 0) {
imageName = (path.substring(path.lastIndexOf(File.separator) + 1, path.length()));
String name = imageName.substring(0, imageName.lastIndexOf('.'));
String extension = imageName.substring(imageNam... | public RSClassLoader(Map<String, byte[]> classes, URL source) {
try {
CodeSource codeSource = new CodeSource(source, (CodeSigner[]) null);
domain = new ProtectionDomain(codeSource, getPermissions());
this.classes = classes;
String s = getClass().getResource("R... | false |
898,817 | 8,167,634 | 11,519,124 | @Test
public void testAuthorizedMirror() throws IOException {
final URL url = new URL("http://127.0.0.1:" + testPort + "/mirror?version=5&direction=just+right");
final HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Authorization", "Basic QWxhZGR... | protected static void copyFile(File in, File out) throws IOException {
java.io.FileWriter filewriter = null;
java.io.FileReader filereader = null;
try {
filewriter = new java.io.FileWriter(out);
filereader = new java.io.FileReader(in);
char[] buf = new cha... | false |
898,818 | 20,037,616 | 23,531,658 | private void serializeWithClass(Class theClass, int count, String comment) {
for (int c = 0; c < 10; c++) {
if (c == 9) {
beginAction(1, "persistence write/read", count, comment);
}
String tempFile = ".tmp.archive";
SerializeClassInterface theI... | public void objectParserAssesmentItem(int file, int currentquestion, Resource resTemp) {
NodeList nl = null;
Node n = null;
NamedNodeMap nnp = null;
Node nsrc = null;
URL url = null;
String sFilename = "";
String sNewPath = "";
int indexLastSeparator;
... | true |
898,819 | 4,647,738 | 14,789,933 | private static void tryToMerge(String url) {
if ("none".equalsIgnoreCase(url)) return;
Properties nullProps = new Properties();
FileProperties propsIn = new FileProperties(nullProps, nullProps);
try {
propsIn.load(new URL(url).openStream());
} catch (Exception e) ... | public static String stringToHash(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Shoul... | false |
898,820 | 8,292,552 | 11,941,957 | public void run() {
BufferedReader inp = null;
try {
String urlString = "http://www.hubtracker.com/query.php?action=add&username=" + user + "&password=" + pass + "&email=" + e_mail + "&address=" + Vars.Hub_Host;
URL url = new URL(urlString);
URLConnection conn;
... | String openUrlAsString(String address, int maxLines) {
StringBuffer sb;
try {
URL url = new URL(address);
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
sb = new StringBuffer();
int cou... | true |
898,821 | 20,708,362 | 10,836,108 | public void updateChecksum() {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
List<Parameter> sortedKeys = new ArrayList<Parameter>(parameter_instances.keySet());
for (Parameter p : sortedKeys) {
if (parameter_instances.get(p) != null && !(para... | public static void main(String[] args) {
LogFrame.getInstance();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.trim().startsWith(DEBUG_PARAMETER_NAME + "=")) {
properties.put(DEBUG_PARAMETER_NAME, arg.trim().substring(DEBUG_PARAMETER_NA... | false |
898,822 | 8,401,358 | 5,102,752 | public void run() {
FileInputStream src;
try {
src = new FileInputStream(srcName);
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
}
FileOutputStream dest;
FileChannel srcC = src.getChannel();
ByteBuffer buf... | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| true |
898,823 | 6,304,371 | 16,223,923 | public static String getImportFileBody(String fileName, HttpSession session) {
FTPClient ftp = new FTPClient();
CofaxToolsUser user = (CofaxToolsUser) session.getAttribute("user");
String fileTransferFolder = CofaxToolsServlet.fileTransferFolder;
String importFTPServer = (String) use... | public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
InputStream urlStream = url.openStream();
AudioFileFormat fileFormat = null;
try {
fileFormat = getFMT(urlStream, false);
} finally {
if (fileFormat == nul... | false |
898,824 | 16,548,896 | 17,477,951 | private String generateHash(String key, String data) throws ChiropteraException {
try {
MessageDigest md = MessageDigest.getInstance(Constants.Connection.Auth.MD5);
md.update(key.getBytes());
byte[] raw = md.digest();
String s = toHexString(raw);
S... | public static void copy(String inputFile, String outputFile) throws Exception {
try {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | false |
898,825 | 7,635,628 | 19,100,902 | private void bubbleSort(int values[]) {
int len = values.length - 1;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len - i; j++) {
if (values[j] > values[j + 1]) {
int tmp = values[j];
values[j] = values[j + 1];
... | public static void saveURL(URL url, Writer writer) throws IOException {
BufferedInputStream in = new BufferedInputStream(url.openStream());
for (int c = in.read(); c != -1; c = in.read()) {
writer.write(c);
}
}
| false |
898,826 | 23,291,433 | 14,475,614 | public static String sendRequest(String urlstring) {
URL url;
String line;
Log.i("DVBMonitor", "Please wait while receiving data from dvb...");
try {
url = new URL(urlstring);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
... | @SuppressWarnings("unchecked")
public static <T extends Class> Collection<T> listServices(T serviceType, ClassLoader classLoader) throws IOException, ClassNotFoundException {
final Collection<T> result = new LinkedHashSet<T>();
final Enumeration<URL> resouces = classLoader.getResources("META-INF... | true |
898,827 | 5,893,532 | 13,822,269 | public static void upload(FTPDetails ftpDetails) {
FTPClient ftp = new FTPClient();
try {
String host = ftpDetails.getHost();
logger.info("Connecting to ftp host: " + host);
ftp.connect(host);
logger.info("Received reply from ftp :" + ftp.getReplyStrin... | public static String md5(String password) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);
} catch (NoSuchAlgorithmException ex) ... | false |
898,828 | 19,657,659 | 1,831,863 | public Download(URL url, int segs) {
this.url = url;
Mediator.register(this);
status = "Starting...";
try {
totalSize = url.openConnection().getContentLength();
name = url.getPath().substring(url.getPath().lastIndexOf('/') + 1);
if (name.isEmpty())... | public Document searchRelease(String id) throws Exception {
Document doc = null;
URL url = new URL("http://" + disgogsUrl + "/release/" + id + "?f=xml&api_key=" + apiKey[0]);
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.addRequestProperty("Accept-Encoding", "gz... | false |
898,829 | 8,023,601 | 7,135,601 | protected static List<Pattern> getBotPatterns() {
List<Pattern> patterns = new ArrayList<Pattern>();
try {
Enumeration<URL> urls = AbstractPustefixRequestHandler.class.getClassLoader().getResources("META-INF/org/pustefixframework/http/bot-user-agents.txt");
while (urls.hasMor... | public static String upload(File tmpFile, URL url) throws IOException {
StringBuffer reply = new StringBuffer();
URLConnection uc = url.openConnection();
ClientHttpRequest request = new ClientHttpRequest(uc);
String file = "file";
String filename = tmpFile.getName();
... | true |
898,830 | 19,344,016 | 16,063,556 | public static synchronized String encrypt(String plaintext) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BAS... | public static String md(String passwd) {
MessageDigest md5 = null;
String digest = passwd;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(passwd.getBytes());
byte[] digestData = md5.digest();
digest = byteArrayToHex(digestData);
... | true |
898,831 | 7,209,394 | 14,885,369 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inChan... | public File copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
copyChannel(inChannel, outChannel);
return out;
}
| true |
898,832 | 401,685 | 23,574,720 | public void elimina(Pedido pe) throws errorSQL, errorConexionBD {
System.out.println("GestorPedido.elimina()");
int id = pe.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM pedido WHERE id=" + id;
System.out.... | public void insertProfile() throws ClassNotFoundException, SQLException {
Connection connection = null;
PreparedStatement ps1 = null;
PreparedStatement ps2 = null;
PreparedStatement ps3 = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection =... | true |
898,833 | 6,185,786 | 14,311,145 | protected void copyFile(File from, File to) throws IOException {
to.getParentFile().mkdirs();
InputStream in = new FileInputStream(from);
try {
OutputStream out = new FileOutputStream(to);
try {
byte[] buf = new byte[1024];
int readLeng... | public static void copyFile(File src, File dst) throws IOException {
LogUtil.d(TAG, "Copying file %s to %s", src, dst);
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(src).getChannel();
outChannel = new FileO... | true |
898,834 | 17,477,957 | 1,983,098 | public static void unzipModel(String filename, String tempdir) throws Exception {
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(filename);
int BUFFER = 2048;
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fi... | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | true |
898,835 | 5,859,133 | 17,682,090 | protected int sendData(String submitName, String submitValue) throws HttpException, IOException, SAXException {
PostMethod postMethod = null;
try {
postMethod = new PostMethod(getDocumentBase().toString());
postMethod.getParams().setCookiePolicy(org.apache.commons.httpclient.... | public Reader transform(Reader reader, Map<String, Object> parameterMap) {
try {
File file = File.createTempFile("srx2", ".srx");
file.deleteOnExit();
Writer writer = getWriter(getFileOutputStream(file.getAbsolutePath()));
transform(reader, writer, parameterMa... | true |
898,836 | 5,483,488 | 20,059,162 | public static void loadPackage1(String ycCode) {
InputStream input = null;
try {
TrustManager[] trustAllCerts = new TrustManager[] { new FakeTrustManager() };
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRando... | public boolean excuteBackup(String backupOrginlDrctry, String targetFileNm, String archiveFormat) throws JobExecutionException {
File targetFile = new File(targetFileNm);
File srcFile = new File(backupOrginlDrctry);
if (!srcFile.exists()) {
log.error("백업원본디렉토리[" + srcFile.getAbso... | false |
898,837 | 1,528,296 | 20,002,564 | public static Hashtable DefaultLoginValues(String firstName, String lastName, String password, String mac, String startLocation, int major, int minor, int patch, int build, String platform, String viewerDigest, String userAgent, String author) throws Exception {
Hashtable values = new Hashtable();
M... | public synchronized String encrypt(String password) {
try {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA-1");
md.update(password.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
... | true |
898,838 | 3,573,409 | 2,557,142 | public synchronized void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
CacheEntry entry = null;
Tenant tenant = null;
if (!tenantInfo.getTenants().isEmpty()) {
tenant = tenantInfo.getMatchingTenant(request);
... | public void login(LoginData loginData) throws ConnectionEstablishException, AccessDeniedException {
try {
int reply;
this.ftpClient.connect(loginData.getFtpServer());
reply = this.ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
... | false |
898,839 | 4,238,332 | 14,540,145 | public static void cpdir(File src, File dest) throws BrutException {
dest.mkdirs();
File[] files = src.listFiles();
for (int i = 0; i < files.length; i++) {
File file = files[i];
File destFile = new File(dest.getPath() + File.separatorChar + file.getName());
... | public void copyFile(String source_name, String dest_name) throws IOException {
File source_file = new File(source_name);
File destination_file = new File(dest_name);
Reader source = null;
Writer destination = null;
char[] buffer;
int bytes_read;
try {
... | true |
898,840 | 4,697,213 | 15,417,277 | protected void downloadJar(URL downloadURL, File jarFile, IProgressListener pl) {
BufferedOutputStream out = null;
InputStream in = null;
URLConnection urlConnection = null;
try {
urlConnection = downloadURL.openConnection();
out = new BufferedOutputStream(new... | static Object loadPersistentRepresentationFromFile(URL url) throws PersistenceException {
PersistenceManager.persistenceURL.get().addFirst(url);
ObjectInputStream ois = null;
HierarchicalStreamReader reader = null;
XStream xstream = null;
try {
Reader inputReader ... | false |
898,841 | 8,232,814 | 10,140,299 | public ChatClient registerPlayer(int playerId, String playerLogin) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.reset();
md.update(playerLogin.getBytes("UTF-8"), 0, playerLogin.length());
byte[] accountTok... | protected static byte[] hashPassword(byte[] saltBytes, String plaintextPassword) throws AssertionError {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw (AssertionError) new AssertionError("No MD5 me... | true |
898,842 | 970,144 | 951,388 | public Logging() throws Exception {
File home = new File(System.getProperty("user.home"), ".jorgan");
if (!home.exists()) {
home.mkdirs();
}
File logging = new File(home, "logging.properties");
if (!logging.exists()) {
InputStream input = getClass().ge... | public static void zipFile(String file, String entry) throws IOException {
FileInputStream in = new FileInputStream(file);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file + ".zip"));
out.putNextEntry(new ZipEntry(entry));
byte[] buffer = new byte[4096];
in... | true |
898,843 | 2,873,508 | 1,113,238 | PackageFileImpl(PackageDirectoryImpl dir, String name, InputStream data) throws IOException {
this.dir = dir;
this.name = name;
this.updates = dir.getUpdates();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
IOUtils.copy(data, stream);
updates.setNewData(... | public ResourceMigrator createDefaultResourceMigrator(NotificationReporter reporter, boolean strictMode) throws ResourceMigrationException {
return new ResourceMigrator() {
public void migrate(InputMetadata meta, InputStream inputStream, OutputCreator outputCreator) throws IOExcepti... | true |
898,844 | 22,066,329 | 20,898,459 | protected final void loadLogFile(String filename) throws IOException {
cleanUp(true, false);
InputStream is = null;
OutputStream os = null;
File f = File.createTempFile("log", null);
try {
is = getClass().getResourceAsStream(filename);
Assert.isTrue(is... | 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(... | true |
898,845 | 3,533,700 | 20,587,078 | public Object next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
this.currentGafFilePath = this.url;
try {
if (this.httpURL != null) {
LOG.info("Reading URL :" + httpURL);
InputStream is = this.httpURL.openStream()... | public static void main(String[] a) {
ArrayList<String> allFilesToBeCopied = new ArrayList<String>();
new File(outputDir).mkdirs();
try {
FileReader fis = new FileReader(completeFileWithDirToCathFileList);
BufferedReader bis = new BufferedReader(fis);
Stri... | true |
898,846 | 20,898,459 | 746,929 | 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 static void main(String[] args) throws Exception {
String localSrc = args[0];
String dst = args[1];
InputStream in = new BufferedInputStream(new FileInputStream(localSrc));
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(dst), conf);... | true |
898,847 | 5,659,863 | 689,011 | public static FileChannel newFileChannel(File file, String rw, boolean enableException) throws IOException {
if (file == null) return null;
if (rw == null || rw.length() == 0) {
return null;
}
rw = rw.toLowerCase();
if (rw.equals(MODE_READ)) {
if (File... | 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 |
898,848 | 9,756,057 | 13,365,065 | public void writeToFile(File out) throws IOException, DocumentException {
FileChannel inChannel = new FileInputStream(pdf_file).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} ca... | public Object downloadFile(File destinationFile, URL[] urls, DownloadListener listener, Object checksum, long length, PRIORITY priority) throws DownloadException {
URL url = urls[0];
if (!url.getProtocol().equalsIgnoreCase("http")) {
throw new DownloadException(" Only HTTP is supported i... | true |
898,849 | 18,600,879 | 14,770,729 | public static void copyFile(File input, File output) throws Exception {
FileReader in = new FileReader(input);
FileWriter out = new FileWriter(output);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| public static boolean joinFiles(File dest, Collection<File> sources) {
FileInputStream fis = null;
FileOutputStream fos = null;
boolean rv = false;
byte[] buf = new byte[1000000];
int bytesRead = 0;
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
... | true |
898,850 | 18,029,937 | 2,659,798 | private void buildCache() {
cache = new HashMap<String, byte[]>();
JarInputStream jis = null;
BufferedInputStream bis = null;
URL[] urls = getURLs();
for (URL url : urls) {
try {
if (url.getPath().endsWith(".jar")) {
jis = new J... | private void duplicateTable(Connection scon, Connection dcon, String table) {
logger.debug("Duplicating table " + table);
Statement creTab, stmt;
ResultSet tuples, columns, keys;
int c;
String insert = "";
PreparedStatement insTup;
try {
columns = ... | false |
898,851 | 16,227,459 | 23,099,329 | public CmsSetupTestResult execute(CmsSetupBean setupBean) {
CmsSetupTestResult testResult = new CmsSetupTestResult(this);
String basePath = setupBean.getWebAppRfsPath();
if (!basePath.endsWith(File.separator)) {
basePath += File.separator;
}
File file1;
Ra... | @Override
public void close() throws IOException {
super.close();
byte[] signatureData = toByteArray();
ZipOutputStream zipOutputStream = new ZipOutputStream(this.targetOutputStream);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(this.originalZipFile));
... | true |
898,852 | 16,002,376 | 13,987,172 | protected HttpURLConnection frndTrySend(HttpURLConnection h) throws OAIException {
HttpURLConnection http = h;
boolean done = false;
GregorianCalendar sendTime = new GregorianCalendar();
GregorianCalendar testTime = new GregorianCalendar();
GregorianCalendar retryTime = null;... | public void sendMessageToServer(String msg, Map<String, String> args, StringCallback cb, URLConstructor ctor) {
try {
int tmpPort = port;
for (; tmpPort < port + 10; tmpPort++) {
Socket tmpSock;
try {
tmpSock = socketsManager.connec... | false |
898,853 | 7,556,871 | 22,899,270 | private static byte[] createMD5(String seed) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(seed.getBytes("UTF-8"));
return md5.digest();
}
| public static String md5hash(String input) {
try {
MessageDigest sha1Digest = MessageDigest.getInstance("MD5");
sha1Digest.update(input.getBytes());
return byteArrayToString(sha1Digest.digest());
} catch (Exception e) {
logger.error(e.getMessage(), e);... | true |
898,854 | 18,733,556 | 8,452,564 | public static Map<String, File> extractFiles(String input, File tempDirectory) throws IOException {
byte data[] = new byte[BUFFER];
BufferedOutputStream out = null;
FileInputStream src = new FileInputStream(input);
BufferedInputStream in = new BufferedInputStream(src);
ZipInp... | public void run() {
try {
HttpPost httpPostRequest = new HttpPost(Feesh.device_URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValueP... | false |
898,855 | 17,562,349 | 1,269,271 | public String digestResponse() {
String digest = null;
if (null == nonce) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes());
md.update(":".getBytes());
md.update(realm.getBytes());
... | public Scene load(URL url) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException {
BufferedReader reader;
if (baseUrl == null) setBaseUrlFromUrl(url);
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (IOException ... | false |
898,856 | 21,008,917 | 20,177,224 | private String determineGuardedHtml() {
StringBuffer buf = new StringBuffer();
if (m_guardedButtonPresent) {
buf.append("\n<span id='" + getHtmlIdPrefix() + PUSH_PAGE_SUFFIX + "' style='display:none'>\n");
String location = m_guardedHtmlLocation != null ? m_guardedHtmlLocatio... | public static String encryptPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
byte[] hash = md.digest();
int hashLength = hash.length;
StringBuffer hashStringBuf = new StringBuffe... | false |
898,857 | 11,751,886 | 19,125,824 | public void run() {
waiting(200);
try {
URL url = new URL(urlAddress);
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
... | public HttpURLConnection openConnection() throws IOException {
URL url = new URL("http", host, request);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(method);
connection.setRequestProperty("Host", host);
for (Map.Entry<S... | false |
898,858 | 11,103,539 | 20,691,303 | public void compressFile(String filePath) {
String outPut = filePath + ".zip";
try {
FileInputStream in = new FileInputStream(filePath);
GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(outPut));
byte[] buffer = new byte[4096];
int byte... | public static String encrypt(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("String to encript cannot be null or zero length");
}
StringBuffer hexString = new StringBuffer();
MessageDigest md = null;
try {
md =... | false |
898,859 | 17,787,699 | 15,057,561 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.debug("Random GUID error: " + e.getMessage())... | 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... | true |
898,860 | 11,188,585 | 14,231,450 | public static void initStaticStuff() {
Enumeration<URL> urls = null;
try {
urls = Play.class.getClassLoader().getResources("play.static");
} catch (Exception e) {
}
while (urls != null && urls.hasMoreElements()) {
URL url = urls.nextElement();
... | public byte[] download(URL url, OutputStream out) throws IOException {
boolean returnByByteArray = (out == null);
ByteArrayOutputStream helper = null;
if (returnByByteArray) {
helper = new ByteArrayOutputStream();
}
String s = url.toExternalForm();
URLConn... | false |
898,861 | 5,553,144 | 19,710,610 | private void initStreams() throws IOException {
if (audio != null) {
audio.close();
}
if (url != null) {
audio = new OggInputStream(url.openStream());
} else {
audio = new OggInputStream(ResourceLoader.getResourceAsStream(ref));
}
}
| public void copyImage(String from, String to) {
File inputFile = new File(from);
File outputFile = new File(to);
try {
if (inputFile.canRead()) {
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outpu... | false |
898,862 | 23,284,463 | 9,834,214 | public static DownloadedContent downloadContent(final InputStream is) throws IOException {
if (is == null) {
return new DownloadedContent.InMemory(new byte[] {});
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final byte[] buffer = new byte[1024];
... | void loadSVG(String svgFileURL) {
try {
URL url = new URL(svgFileURL);
URLConnection c = url.openConnection();
c.setRequestProperty("Accept-Encoding", "gzip");
InputStream is = c.getInputStream();
String encoding = c.getContentEncoding();
... | false |
898,863 | 18,820,147 | 1,175,821 | public static String MD5(String text) {
byte[] md5hash = new byte[32];
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
} catch (NoSuchAlgorithmExcep... | public static String criptografar(String senha) {
if (senha == null) {
return null;
}
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
retur... | true |
898,864 | 44,823 | 2,459,067 | 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... | @Provides
@Singleton
Properties provideCfg() {
InputStream propStream = null;
URL url = Thread.currentThread().getContextClassLoader().getResource(PROPERTY_FILE);
Properties cfg = new Properties();
if (url != null) {
try {
log.info("Loading app con... | false |
898,865 | 4,760,427 | 21,426,410 | public void connect() throws IOException {
try {
URL url = new URL(pluginUrl);
connection = (HttpURLConnection) url.openConnection();
sendNotification(DownloadState.CONNECTION_ESTABLISHED);
contentLength = connection.getContentLength();
sendNotific... | public String parse(String queryText) throws ParseException {
try {
StringBuilder sb = new StringBuilder();
queryText = Val.chkStr(queryText);
if (queryText.length() > 0) {
URL url = new URL(getUrl(queryText));
InputStream in = url.openStre... | false |
898,866 | 3,319,146 | 2,941,113 | public void create(Session session) {
Connection conn = session.getConnection(this);
Statement stat = null;
StringBuilder out = new StringBuilder(256);
Appendable sql = out;
List<MetaTable> tables = new ArrayList<MetaTable>();
List<MetaColumn> newColumns = new ArrayLi... | private void download(URL url, File outFile) throws IOException {
System.out.println("Trying to download: " + url);
InputStream in = null;
OutputStream out = null;
try {
URLConnection conn = url.openConnection();
in = conn.getInputStream();
out = n... | false |
898,867 | 11,818,436 | 4,381,116 | public void zip_compressFiles() throws Exception {
FileInputStream in = null;
File f1 = new File("C:\\WINDOWS\\regedit.exe");
File f2 = new File("C:\\WINDOWS\\win.ini");
File file = new File("C:\\" + NTUtil.class.getName() + ".zip");
ZipOutputStream out = new ZipOutputStream(... | private void importUrl() throws ExtractaException {
UITools.changeCursor(UITools.WAIT_CURSOR, this);
try {
m_sUrlString = m_urlTF.getText();
URL url = new URL(m_sUrlString);
Document document = DomHelper.parseHtml(url.openStream());
m_inputPanel.setDoc... | false |
898,868 | 15,478,448 | 5,021,563 | @Override
public void aggregate() {
Connection connection = null;
PreparedStatement prestm = null;
try {
if (logger.isInfoEnabled()) logger.info("aggregate table <" + origin + "> start...");
Class.forName(driver);
connection = DriverManager.getConnecti... | private String AddAction(ResultSet node, String modo) throws SQLException {
Connection cn = null;
Connection cndef = null;
String schema = boRepository.getDefaultSchemaName(boApplication.getDefaultApplication()).toLowerCase();
try {
cn = this.getRepositoryConnection(p_ctx... | true |
898,869 | 982,157 | 22,358,005 | private InputStream getDomainMap() {
String domainMap = Configuration.getString(MAPPING_KEY);
InputStream is = new StringBufferInputStream(domainMap);
if ("".equals(domainMap)) {
try {
URL url = getClass().getResource(XML_FILE_NAME).toURI().toURL();
... | @Override
public InputStream getInputStream() throws IOException {
if (dfos == null) {
int deferredOutputStreamThreshold = Config.getInstance().getDeferredOutputStreamThreshold();
dfos = new DeferredFileOutputStream(deferredOutputStreamThreshold, Definitions.PROJECT_NAME, "." + D... | false |
898,870 | 23,614,264 | 12,994,590 | private static void copyFile(File sourceFile, File destFile) throws IOException {
System.out.println(sourceFile.getAbsolutePath());
System.out.println(destFile.getAbsolutePath());
FileChannel source = new FileInputStream(sourceFile).getChannel();
try {
FileChannel destina... | @HttpAction(name = "map.saveOrUpdate", method = { HttpAction.Method.post }, responseType = "text/plain")
@HttpAuthentication(method = { HttpAuthentication.Method.WSSE })
public String saveOrUpdate(FileItem file, User user, MapOriginal map) throws HttpRpcException {
File tmpFile;
GenericDAO<M... | true |
898,871 | 13,848,422 | 817,948 | public static byte[] generatePasswordHash(String s) {
byte[] password = { 00 };
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(s.getBytes());
password = md5.digest();
return password;
} catch (NoSuchAlgorithmException e)... | private boolean keysMatch(String keyNMinusOne, String keyN) {
boolean match = false;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(keyNMinusOne.getBytes());
byte[] hashedBytes = digest.digest();
... | true |
898,872 | 8,561,747 | 11,103,539 | public static boolean copyFile(File source, File dest) throws IOException {
int answer = JOptionPane.YES_OPTION;
if (dest.exists()) {
answer = JOptionPane.showConfirmDialog(null, "File " + dest.getAbsolutePath() + "\n already exists. Overwrite?", "Warning", JOptionPane.YES_NO_OPTION);
... | public void compressFile(String filePath) {
String outPut = filePath + ".zip";
try {
FileInputStream in = new FileInputStream(filePath);
GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(outPut));
byte[] buffer = new byte[4096];
int byte... | true |
898,873 | 8,833,167 | 7,129,106 | @SuppressWarnings("unchecked")
private final D loadMeta(URL url) throws IOException {
SAXParser saxParser;
try {
saxParser = SAX_PARSER_FACTORY.newSAXParser();
} catch (ParserConfigurationException e) {
throw new Error(e);
} catch (SAXException e) {
... | protected void downloadCacheFile(File file) throws Exception {
ApplicationProperties app = ApplicationProperties.getInstance();
String address = app.getProperty(JabberConstants.PROPERTY_JABBER_SERVERLIST, DEFAULT_SERVER_URL);
URL url = new URL(address);
file.createNewFile();
... | false |
898,874 | 5,914,388 | 347,631 | 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) {
... | private static String getDocumentAt(String urlString) {
StringBuffer html_text = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream... | true |
898,875 | 5,807,569 | 21,652,268 | @RequestMapping("/import")
public String importPicture(@ModelAttribute PictureImportCommand command) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
URL url = command.getUrl();
IOUtils.copy(url.openStream(), baos);
byte[] imageData = imageFilterServ... | private final synchronized Vector<Class<?>> findSubclasses(URL location, String packageName, Class<?> superClass) {
Map<Class<?>, URL> thisResult = new TreeMap<Class<?>, URL>(CLASS_COMPARATOR);
Vector<Class<?>> v = new Vector<Class<?>>();
String fqcn = searchClass.getName();
List<URL... | false |
898,876 | 2,980,810 | 22,426,232 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url = request.getParameter("proxyurl");
URLConnection conn = new URL(url).openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCac... | public Element rootFromURL(URL url) throws org.jdom.JDOMException, java.io.IOException {
Element e;
try {
InputStream stream = new BufferedInputStream(url.openConnection().getInputStream());
return getRootViaURI(verify, stream);
} catch (org.jdom.input.JDOMParseExcept... | false |
898,877 | 17,119,759 | 8,093,202 | public void testReaderWriterUC2() throws Exception {
String inFile = "test_data/mri.png";
String outFile = "test_output/mri__smooth_testReaderWriter.png";
itkImageFileReaderUC2_Pointer reader = itkImageFileReaderUC2.itkImageFileReaderUC2_New();
itkImageFileWriterUC2_Pointer writer = ... | private Properties loadDefaultProperties() throws IOException {
Properties merged = new Properties();
try {
merged.setProperty("user", System.getProperty("user.name"));
} catch (java.lang.SecurityException se) {
}
ClassLoader cl = getClass().getClassLoader();
... | false |
898,878 | 161,844 | 3,253,024 | 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 recurseFiles(File root, File file, TarArchiveOutputStream taos, boolean absolute) throws IOException {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File file2 : files) {
recurseFiles(root, file2, taos, absolute);
}
... | true |
898,879 | 22,022,886 | 7,531,800 | public static String fetchURL(final String u) {
String retStr = "";
try {
final URL url = new URL(u);
final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
... | public List<DemandeChargement> getArtistToLoadFromWiki() throws Exception {
URL fileURL = new URL("http://beastchild.free.fr/wiki/doku.php?id=music");
URLConnection urlConnection = fileURL.openConnection();
InputStream httpStream = urlConnection.getInputStream();
BufferedReader br = ... | true |
898,880 | 19,274,388 | 6,095,507 | public static String generateHash(String string, String algoritmo) {
try {
MessageDigest md = MessageDigest.getInstance(algoritmo);
md.update(string.getBytes());
byte[] result = md.digest();
int firstPart;
int lastPart;
StringBuilder sB... | private StringBuffer hashPassword(StringBuffer password, String mode) {
MessageDigest m = null;
StringBuffer hash = new StringBuffer();
try {
m = MessageDigest.getInstance(mode);
m.update(password.toString().getBytes("UTF8"));
} catch (NoSuchAlgorithmException... | true |
898,881 | 18,519,248 | 21,431,680 | public String fetchContent(PathObject file) throws NetworkException {
if (file.isFetched()) {
return file.getContent();
}
if (!"f".equals(file.getType())) {
return null;
}
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(... | public static Vector getVectorForm(String u, String usr, String pwd) {
Vector response = new Vector();
logger.debug("Attempting to call: " + u);
logger.debug("Creating Authenticator: usr=" + usr + ", pwd=" + pwd);
Authenticator.setDefault(new CustomAuthenticator(usr, pwd));
t... | false |
898,882 | 12,907,074 | 14,900,316 | public static int sendButton(String url, String id, String command) throws ClientProtocolException, IOException {
String connectString = url + "/rest/button/" + id + "/" + command;
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(connectString);
HttpResponse ... | @Override
public User createUser(User bean) throws SitoolsException {
checkUser();
if (!User.isValid(bean)) {
throw new SitoolsException("CREATE_USER_MALFORMED");
}
Connection cx = null;
try {
cx = ds.getConnection();
cx.setAutoCommit(f... | false |
898,883 | 9,233,950 | 11,834,952 | public static void copyFile(File src, File dest) throws IOException {
if (!src.exists()) throw new IOException("File not found '" + src.getAbsolutePath() + "'");
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
BufferedInputStream in = new BufferedInputStream(... | 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 =... | true |
898,884 | 19,147,293 | 11,081,583 | public boolean limpiarContrincantexRonda(jugadorxDivxRonda unjxdxr) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET idPareoRival = 0 " + " WHERE idJugxDivxRnd = " + unjxdxr.getIdJugxDivxRnd();
try {
connection = conexionBD.getConnection();
connec... | public void rename(String virtualWiki, String oldTopicName, String newTopicName) throws Exception {
Connection conn = DatabaseConnection.getConnection();
try {
boolean commit = false;
conn.setAutoCommit(false);
try {
PreparedStatement pstm = conn.p... | true |
898,885 | 11,213,172 | 17,477,953 | public static void copyFile(File src, File dest) throws IOException {
log.debug("Copying file: '" + src + "' to '" + dest + "'");
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFrom(... | public static void createModelZip(String filename, String tempdir, boolean overwrite) throws Exception {
FileTools.checkOutput(filename, overwrite);
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(filename);
ZipOutputStream out = new ZipOutputStream(ne... | true |
898,886 | 6,146,145 | 18,665,067 | public void testSystemPropertyConnector() throws Exception {
final String rootFolderPath = "test/ConnectorTest/fs/".toLowerCase();
final Connector connector = new SystemPropertyConnector();
final ContentResolver contentResolver = new UnionContentResolver();
final FSContentResolver fs... | public void actionPerformed(ActionEvent e) {
if (path.compareTo("") != 0) {
imageName = (path.substring(path.lastIndexOf(imageFile.separator) + 1, path.length()));
File imageFile = new File(path);
directoryPath = "Images" + imageFile.separator + imageName.substring(0, 1).... | true |
898,887 | 22,504,904 | 11,305,841 | private void parseUrl() {
URLLexer lexer;
URLParser parser;
if (this.parent != null) {
this.hops = ((HTTPFile) this.parent).hops - 1;
}
if (this.searchFilter.accept(this.url.getPath())) {
if (!visited.contains(this.url.t... | public boolean setDeleteCliente(int IDcliente) {
boolean delete = false;
try {
stm = conexion.prepareStatement("delete clientes where IDcliente='" + IDcliente + "'");
stm.executeUpdate();
conexion.commit();
delete = true;
} catch (SQLException ... | false |
898,888 | 8,093,202 | 15,289,245 | private Properties loadDefaultProperties() throws IOException {
Properties merged = new Properties();
try {
merged.setProperty("user", System.getProperty("user.name"));
} catch (java.lang.SecurityException se) {
}
ClassLoader cl = getClass().getClassLoader();
... | public boolean checkTypeChange(Class<?> clazz, File buildDir, File refFile) throws MojoExecutionException {
if (!clazz.isPrimitive()) {
ClassLoader cl = clazz.getClassLoader();
if (cl == loader) {
if (clazz.isArray()) return checkTypeChange(getArrayType(clazz), buildD... | false |
898,889 | 7,713,594 | 14,667,831 | private static void copyFile(File source, File dest, boolean visibleFilesOnly) throws IOException {
if (visibleFilesOnly && isHiddenOrDotFile(source)) {
return;
}
if (dest.exists()) {
System.err.println("Destination File Already Exists: " + dest);
}
Fi... | public void concatFiles() throws IOException {
Writer writer = null;
try {
final File targetFile = new File(getTargetDirectory(), getTargetFile());
targetFile.getParentFile().mkdirs();
if (null != getEncoding()) {
getLog().info("Writing aggregated ... | true |
898,890 | 16,926,520 | 111,060 | public int extractDocumentsInternal(DocumentHolder holder, DocumentFactory docFactory) {
FTPClient client = new FTPClient();
try {
client.connect(site, port == 0 ? 21 : port);
client.login(user, password);
visitDirectory(client, "", path, holder, docFactory);
... | public void load(URL urlin) throws IOException {
index = hs.getDoIndex();
loaded = false;
url = urlin;
int c, i;
htmlDocLength = 0;
HtmlReader in = new HtmlReader(new InputStreamReader(url.openStream(), charset));
try {
if (debug >= 2) System.out.p... | false |
898,891 | 9,270,406 | 716,706 | public void downSync(Vector v) throws SQLException {
try {
con = allocateConnection(tableName);
PreparedStatement update = con.prepareStatement("update cal_Event set owner=?,subject=?,text=?,place=?," + "contactperson=?,startdate=?,enddate=?,starttime=?,endtime=?,allday=?," + "syncst... | public void delUser(User user) throws SQLException, IOException, ClassNotFoundException {
String dbUserID;
String stockSymbol;
Statement stmt = con.createStatement();
try {
con.setAutoCommit(false);
dbUserID = user.getUserID();
if (getUser(dbUserID... | true |
898,892 | 8,601,875 | 4,530,695 | public void init() throws Exception {
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
int code = conn.getResponseCode();
if (code != 200) throw new IOException("Error fetching robots.txt; respose code is " + code);
BufferedReader reader = new BufferedReader(new Inp... | private String doExecute(AbortableHttpRequest method) throws Throwable {
HttpClient client = CLIENT.newInstance();
HttpResponse rsp = client.execute((HttpUriRequest) method);
HttpEntity entity = rsp.getEntity();
if (entity == null) throw new RequestError("No entity in method");
... | true |
898,893 | 9,581,835 | 8,805,648 | public static void main(String[] args) {
String WTKdir = null;
String sourceFile = null;
String instrFile = null;
String outFile = null;
String jadFile = null;
Manifest mnf;
if (args.length == 0) {
usage();
return;
}
int... | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| true |
898,894 | 4,461,832 | 21,754,657 | @Test
public void testXMLDBURLStreamHandler() {
System.out.println("testXMLDBURLStreamHandler");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
URL url = new URL(XMLDB_URL_1);
InputStream is = url.openStream();
copyDocument(is, baos);
... | private JButton getButtonImagen() {
if (buttonImagen == null) {
buttonImagen = new JButton();
buttonImagen.setText(Messages.getString("gui.AdministracionResorces.6"));
buttonImagen.setIcon(new ImageIcon(getClass().getResource("/es/unizar/cps/tecnoDiscap/data/icons/view_si... | false |
898,895 | 2,453,985 | 13,950,884 | @Override
public void login() {
loginsuccessful = false;
try {
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 httpclien... | public Texture loadTexture(String file) throws IOException {
URL imageUrl = urlFactory.makeUrl(file);
Texture cached = textureLoader.getImageFromCache(imageUrl);
if (cached != null) return cached;
Image image;
if (zip) {
ZipInputStream zis = new ZipInputStream(url... | false |
898,896 | 23,677,118 | 11,142,914 | public static void copyFile5(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
IOUtils.copyLarge(in, out);
in.close();
out.close();
}
| private boolean copyAvecProgressNIO(File sRC2, File dEST2, JProgressBar progressEnCours) throws IOException {
boolean resultat = false;
FileInputStream fis = new FileInputStream(sRC2);
FileOutputStream fos = new FileOutputStream(dEST2);
java.nio.channels.FileChannel channelSrc = fis.... | true |
898,897 | 4,491,957 | 8,250,731 | public void copyToCurrentDir(File _copyFile, String _fileName) throws IOException {
File outputFile = new File(getCurrentPath() + File.separator + _fileName);
FileReader in;
FileWriter out;
if (!outputFile.exists()) {
outputFile.createNewFile();
}
in = new... | @Override
protected void doGet(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)) {
... | true |
898,898 | 8,708,601 | 6,959,224 | public void testReadNormal() throws Exception {
archiveFileManager.executeWith(new TemporaryFileExecutor() {
public void execute(File temporaryFile) throws Exception {
ZipArchive archive = new ZipArchive(temporaryFile.getPath());
InputStream input = archive.getIn... | public static void copy(File source, File dest) throws java.io.IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer ... | true |
898,899 | 16,721,518 | 13,583,203 | void openTextFile(String urlString, boolean install) {
StringBuffer sb = null;
try {
URL url = new URL(urlString);
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
sb = new StringBuffer();
... | public void sendMail() throws Exception {
try {
if (param.length > 0) {
System.setProperty("mail.host", param[0].trim());
URL url = new URL("mailto:" + param[1].trim());
URLConnection conn = url.openConnection();
PrintWriter out = n... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.