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 |
|---|---|---|---|---|---|
4,800 | 3,282,600 | 22,050,257 | private static void copyFile(String src, String dst) throws InvocationTargetException {
try {
FileChannel srcChannel;
srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel();
dstChannel.transferFrom(s... | private void importSources() {
InputOutput io = IOProvider.getDefault().getIO("Import Sources", false);
io.select();
PrintWriter pw = new PrintWriter(io.getOut());
pw.println("Beginning transaction....");
pw.println("Processing selected files:");
String[][] selectedFi... | true |
4,801 | 20,273,405 | 649,639 | public static void decompress(final File file, final File folder, final boolean deleteZipAfter) throws IOException {
final ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(file.getCanonicalFile())));
ZipEntry ze;
try {
while (null != (ze = zis.g... | 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 |
4,802 | 6,056,798 | 18,241,505 | public static String toMD5(String seed) {
MessageDigest md5 = null;
StringBuffer temp_sb = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(seed.getBytes());
byte[] array = md5.digest();
temp_sb = new StringBuffer();
f... | public static String generateToken(ClientInfo clientInfo) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
Random rand = new Random();
String random = clientInfo.getIpAddress() + ":" + clientInfo.getPort() + ":" + rand.nextInt();
md5.update(random... | true |
4,803 | 15,805,163 | 8,143,636 | @Override
public String encodePassword(String rawPass, Object salt) throws DataAccessException {
try {
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
digest.reset();
digest.update(((String) salt).getBytes("UTF-8"));
return new String(di... | public boolean validatePassword(UserType nameMatch, String password) {
try {
MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM);
md.reset();
md.update(nameMatch.getSalt().getBytes("UTF-8"));
md.update(password.getBytes("UTF-8"));
String e... | true |
4,804 | 10,797,051 | 15,873,054 | private static void copy(File in, File out) throws IOException {
if (!out.getParentFile().isDirectory()) out.getParentFile().mkdirs();
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), oc);
... | public static final long copyFile(final File srcFile, final File dstFile, final long cpySize) throws IOException {
if ((null == srcFile) || (null == dstFile)) return (-1L);
final File dstFolder = dstFile.getParentFile();
if ((!dstFolder.exists()) && (!dstFolder.mkdirs())) throw new IOExcepti... | true |
4,805 | 8,335,460 | 22,843,896 | public static String encrypt(String password, String algorithm, byte[] salt) {
StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented");
} else if ("S... | private NodeList getNodeListForDataFile(String fileName, String dataType) {
NodeList list = null;
try {
URL url = new URL(WEBSITE_PROTOCAL, WEBSITE_HOST, "/" + fileName + ".xml");
InputStream is = url.openStream();
DocumentBuilderFactory dbf = DocumentBuilderFacto... | false |
4,806 | 14,484,136 | 9,233,950 | public void copyJarContent(File jarPath, File targetDir) throws IOException {
log.info("Copying natives from " + jarPath.getName());
JarFile jar = new JarFile(jarPath);
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry file = entr... | 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(... | true |
4,807 | 6,847,452 | 11,513,369 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String act = request.getParameter("act");
if (null == act) {
} else if ("down".equalsIgnoreCase(act)) {
String vest = request.getParam... | private RSSFeed getFeed(String urlToRssFeed) {
try {
URL url = new URL(urlToRssFeed);
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
XMLReader xmlreader = parser.getXMLReader();
RSSHandler theR... | false |
4,808 | 9,062,063 | 10,816,804 | public String setEncryptedPassword(String rawPassword) {
String out = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(rawPassword.getBytes());
byte raw[] = md.digest();
out = new String();
... | public static String md5(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException {
StringBuffer result = new StringBuffer();
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input.getBytes("utf-8"));
byte[] digest = md.digest();
for (byte b :... | true |
4,809 | 9,956,094 | 3,512,882 | public void importNotesFromServer() {
boolean downloaded = true;
try {
makeBackupFile();
File f = new File(UserSettings.getInstance().getNotesFile());
FileOutputStream fos = new FileOutputStream(f);
String urlString = protocol + "://" + UserSettings.ge... | static final void executeUpdate(Collection<String> queries, DBConnector connector) throws IOException {
Connection con = null;
Statement st = null;
try {
con = connector.getDB();
con.setAutoCommit(false);
st = con.createStatement();
for (String... | false |
4,810 | 12,440,169 | 16,208,627 | public String openFileAsText(String resource) throws IOException {
StringWriter wtr = new StringWriter();
InputStreamReader rdr = new InputStreamReader(openFile(resource));
try {
IOUtils.copy(rdr, wtr);
} finally {
IOUtils.closeQuietly(rdr);
}
... | @Override
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
final String url = req.getParameter("url");
if (!isAllowed(url)) {
resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
... | true |
4,811 | 9,068,428 | 11,427,406 | public static String getTextFileFromURL(String urlName) {
try {
StringBuffer textFile = new StringBuffer("");
String line = null;
URL url = new URL(urlName);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
while... | private static String makeLoginRequest(String authenticationUrl, String accountEmail, String accountPassword) throws IOException {
URL url = new URL(authenticationUrl);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("POST");
... | false |
4,812 | 17,366,812 | 411,631 | public String tranportRemoteUnitToLocalTempFile(String urlStr) throws UnitTransportException {
InputStream input = null;
BufferedOutputStream bos = null;
File tempUnit = null;
try {
URL url = null;
int total = 0;
try {
url = new URL... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
4,813 | 14,794,142 | 5,665,159 | public boolean consolidateCrossrefGet(BiblioItem bib, ArrayList<BiblioItem> bib2) throws Exception {
boolean result = false;
String doi = bib.getDOI();
String aut = bib.getFirstAuthorSurname();
String title = bib.getTitle();
String firstPage = null;
String pageRange =... | private String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
System... | false |
4,814 | 497,400 | 7,976,872 | public TVRageShowInfo(String xmlShowName) {
String[] tmp, tmp2;
String line = "";
this.usrShowName = xmlShowName;
try {
URL url = new URL("http://www.tvrage.com/quickinfo.php?show=" + xmlShowName.replaceAll(" ", "%20"));
BufferedReader in = new BufferedReader(... | public static void copy_file(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.is... | false |
4,815 | 18,076,450 | 1,045,723 | public void fetch(URL url, HTTPMethod method, String payload, WithResponse wr) throws IOException {
System.out.println("fetchin' " + url.toString() + " with GAE fetch service");
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
... | @Override
public void handlePeerEvent(PeerEvent event) {
if (event.geteventInfo() instanceof EventServiceInfo) {
EventServiceInfo info = (EventServiceInfo) event.geteventInfo();
if (info.getServiceState() != ServiceState.Deployed) return;
long bid = info.getBundleId()... | false |
4,816 | 3,975,166 | 1,410,953 | public void applyTo(File source, File target) throws IOException {
boolean failed = true;
FileInputStream fin = new FileInputStream(source);
try {
FileChannel in = fin.getChannel();
FileOutputStream fos = new FileOutputStream(target);
... | public IOCacheArray(final File file, int capacity, final IIOCacheArrayObjectMaker iomaker, int chunkSize, String name) {
super(capacity, null, chunkSize, name);
generator = new ICacheArrayObjectMaker() {
FileOutputStream outStream;
FileInputStream inStream;
Fil... | true |
4,817 | 13,716,732 | 12,971,450 | public void adjustPadding(File file, int paddingSize, long audioStart) throws FileNotFoundException, IOException {
logger.finer("Need to move audio file to accomodate tag");
FileChannel fcIn = null;
FileChannel fcOut;
ByteBuffer paddingBuffer = ByteBuffer.wrap(new byte[paddingSize]);... | public static void copy(FileInputStream in, File destination) throws IOException {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
srcChannel = in.getChannel();
dstChannel = new FileOutputStream(destination).getChannel();
dstChannel.tra... | true |
4,818 | 3,445,364 | 12,074,282 | public Reader getReader() throws Exception {
if (url_base == null) {
return new FileReader(file);
} else {
URL url = new URL(url_base + file.getName());
return new InputStreamReader(url.openConnection().getInputStream());
}
}
| public void postData(Reader data, Writer output) {
HttpURLConnection urlc = null;
try {
urlc = (HttpURLConnection) solrUrl.openConnection();
try {
urlc.setRequestMethod("POST");
} catch (ProtocolException e) {
throw new PostExceptio... | false |
4,819 | 1,235,581 | 3,904,948 | public Object process(Atom oAtm) throws IOException {
File oFile;
FileReader oFileRead;
String sPathHTML;
char cBuffer[];
Object oReplaced;
final String sSep = System.getProperty("file.separator");
if (DebugFile.trace) {
DebugFile.writeln("Begin Fi... | public ManageUsers() {
if (System.getProperty("user.home") != null) {
dataFile = new File(System.getProperty("user.home") + File.separator + "MyRx" + File.separator + "MyRx.dat");
File dataFileDir = new File(System.getProperty("user.home") + File.separator + "MyRx");
data... | true |
4,820 | 23,162,862 | 1,162,904 | public static NSImage getImage(URL url) {
InputStream in = null;
try {
in = url.openStream();
} catch (IOException e) {
Log.error(e.getMessage(), e);
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buff = new byte[10 * 1024];
... | public byte[] computeMD5(String plainText) throws VHException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw new VHException("The MD5 hash algorithm is not available.", ex);
}
try {... | false |
4,821 | 8,565,955 | 11,358,121 | private static String webService(String strUrl) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(strUrl);
InputStream input = url.openStream();
String sCurrentLine = "";
InputStreamReader read = new InputStreamReader(input, "utf-8");... | public void run() {
try {
putEvent(new DebugEvent("about to place HTTP request"));
HttpGet req = new HttpGet(requestURL);
req.addHeader("Connection", "close");
HttpResponse httpResponse = httpClient.execute(req);
putEven... | false |
4,822 | 22,416,749 | 22,328,842 | private int getRootNodeId(DataSource dataSource) throws SQLException {
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String query = null;
try {
conn = dataSource.getConnection();
st = conn.createStatement();
query = "sel... | protected void doBackupOrganizeType() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strSelQuery = "SELECT organize_type_id,organize_type_name,width " + "FROM " + Common.ORGANIZE_TYPE_TABLE;
String strInsQuery = "INSERT ... | true |
4,823 | 21,246,898 | 16,604,588 | public static void main(String[] args) throws ParseException, FileNotFoundException, IOException {
InputStream input = new BufferedInputStream(UpdateLanguages.class.getResourceAsStream("definition_template"));
Translator t = new Translator(input, "UTF8");
Node template = Translator.Start();
... | public static AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
InputStream inputStream = null;
if (useragent != null) {
URLConnection myCon = url.openConnection();
myCon.setUseCaches(false);
myCon.setDoInput(true);
... | false |
4,824 | 23,069,799 | 10,395,759 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | public void run() {
btnReintentar.setEnabled(false);
try {
lblEstado.setText("Conectando con servidor...");
escribir("\nConectando con servidor...");
URL url = new URL("http://apeiron.sourceforge.net/version.php");
lblEstado.setText("Obteniendo informa... | false |
4,825 | 16,809,623 | 923,861 | public boolean parseResults(URL url, String analysis_type, CurationI curation, Date analysis_date, String regexp) throws OutputMalFormatException {
boolean parsed = false;
try {
InputStream data_stream = url.openStream();
parsed = parseResults(data_stream, analysis_type, cura... | public static void main(String args[]) {
InputStream input = System.in;
OutputStream output = System.out;
if (args.length > 0) {
try {
input = new FileInputStream(args[0]);
} catch (FileNotFoundException e) {
System.err.println("Unable ... | false |
4,826 | 10,524,166 | 2,057,786 | public static void copyURLToFile(URL source, File destination) throws IOException {
InputStream input = source.openStream();
try {
FileOutputStream output = openOutputStream(destination);
try {
IOUtils.copy(input, output);
} finally {
... | public static String sendGetRequest(String urlStr) {
String result = null;
try {
URL url = new URL(urlStr);
System.out.println(urlStr);
URLConnection conn = url.openConnection();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInpu... | false |
4,827 | 15,301,114 | 4,975,452 | public void updateFailedStatus(THLEventStatus failedEvent, ArrayList<THLEventStatus> events) throws THLException {
Timestamp now = new Timestamp(System.currentTimeMillis());
Statement stmt = null;
PreparedStatement pstmt = null;
try {
conn.setAutoCommit(false);
... | private InputStream openStream(URL url, ProgressListener listener, int minProgress, int maxProgress) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoInput(true);
con.setDoOutput(false);
String lengthStr = con.getHeaderField("Content-Len... | false |
4,828 | 15,718,136 | 922,476 | protected URLConnection getConnection(String uri, String data) throws MalformedURLException, IOException {
URL url = new URL(uri);
URLConnection conn = url.openConnection();
conn.setConnectTimeout((int) MINUTE / 2);
conn.setReadTimeout((int) MINUTE / 2);
return conn;
}
| 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... | false |
4,829 | 19,197,300 | 5,195,056 | private void writeStatsToDatabase(long transferJobAIPCount, long reprocessingJobAIPCount, long transferJobAIPVolume, long reprocessingJobAIPVolume, long overallBinaryAIPCount, Map<String, AIPStatistics> mimeTypeRegister) throws SQLException {
int nextAIPStatsID;
long nextMimetypeStatsID;
Sta... | public String getData() throws ValueFormatException, RepositoryException, IOException {
InputStream is = getStream();
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
IOUtils.closeQuietly(is);
return sw.toString();
}
| false |
4,830 | 19,926,877 | 3,768,628 | @Override
public void createCopy(File sourceFile, File destinnationFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destinnationFil... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
4,831 | 15,506,300 | 4,588,203 | @SuppressWarnings("static-access")
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter(... | public String copyImages(Document doc, String sXML, String newPath, String tagName, String itemName) {
NodeList nl = null;
Node n = null;
NamedNodeMap nnp = null;
Node nsrc = null;
URL url = null;
String sFilename = "";
String sNewPath = "";
int index;... | true |
4,832 | 23,188,868 | 22,327,409 | public void run(IProgressMonitor runnerMonitor) throws CoreException {
try {
Map<String, File> projectFiles = new HashMap<String, File>();
IPath basePath = new Path("/");
for (File nextLocation : filesToZip) {
... | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter();
} catch (IOException ex) {
... | true |
4,833 | 13,703,886 | 21,857,917 | public static String encriptarContrasena(String contrasena) throws NoSuchAlgorithmException, UnsupportedEncodingException {
StringBuffer sb = new StringBuffer();
MessageDigest md = MessageDigest.getInstance("SHA-512");
md.update(contrasena.getBytes("UTF-8"));
byte[] digestBytes = md.... | public static String makeMD5(String pin) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(pin.getBytes());
byte[] hash = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < h... | true |
4,834 | 21,405,565 | 22,502,712 | public String getSHA1(String input) {
byte[] output = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA1");
md.update(input.getBytes());
output = md.digest();
} catch (Exception e) {
System.out.println("Exception: " + e);
}
... | public static String crypt(String passwd, boolean pad) {
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.update(passwd.getBytes());
String c = new String(sha.digest());
return toNumeric(c, pad, true);
} catch (java.security.NoSuchAlgo... | true |
4,835 | 303,078 | 13,496,394 | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | @Override
protected ResourceHandler doGet(final URI resourceUri) throws ResourceException {
if (resourceUri.getHost() == null) {
throw new IllegalStateException(InternalBundleHelper.StoreMessageBundle.getMessage("store.uri.ftp.illegal", resourceUri.toString()));
}
try {
... | false |
4,836 | 22,556,551 | 10,713,685 | private void copyOneFile(String oldPath, String newPath) {
File copiedFile = new File(newPath);
try {
FileInputStream source = new FileInputStream(oldPath);
FileOutputStream destination = new FileOutputStream(copiedFile);
FileChannel sourceFileChannel = source.get... | public static boolean unzip_and_merge(String infile, String outfile) {
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(infile);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
FileOutputStream fos = new ... | true |
4,837 | 9,530,015 | 23,400,216 | public static void main(String[] args) throws Throwable {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("cas", "cas file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("o", "output directory").longName("outputDir").isRequired(tru... | public void add(Channel channel) throws Exception {
String sqlStr = null;
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
sqlStr = "insert into t_ip_channel (id,name,descri... | false |
4,838 | 17,019,840 | 7,292,917 | public Set<Plugin<?>> loadPluginImplementationMetaData() throws PluginRegistryException {
try {
final Enumeration<URL> urls = JavaSystemHelper.getResources(pluginImplementationMetaInfPath);
pluginImplsSet.clear();
if (urls != null) {
while (urls.hasMoreEle... | public String get(String s) {
s = s.replaceAll("[^a-z0-9_]", "");
StringBuilder sb = new StringBuilder();
try {
String result = null;
URL url = new URL("http://docs.google.com/Doc?id=" + URLEncoder.encode(s, "UTF-8"));
URLConnection connection = url.openCo... | true |
4,839 | 606,859 | 17,597,670 | 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... | @Deprecated
public boolean backupLuceneIndex(int indexLocation, int backupLocation) {
boolean result = false;
try {
System.out.println("lucene backup started");
String indexPath = this.getIndexFolderPath(indexLocation);
String backupPath = this.getIndexFolderP... | true |
4,840 | 20,836,129 | 23,574,720 | public void addUser(String strUserName, String strPass) {
String datetime = Function.getSysTime().toString();
String time = datetime.substring(0, 4) + datetime.substring(5, 7) + datetime.substring(8, 10) + datetime.substring(11, 13) + datetime.substring(14, 16) + datetime.substring(17, 19) + datetim... | 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 |
4,841 | 14,776,145 | 5,337,582 | private void addPNMLFileToLibrary(File selected) {
try {
FileChannel srcChannel = new FileInputStream(selected.getAbsolutePath()).getChannel();
FileChannel dstChannel = new FileOutputStream(new File(matchingOrderXML).getParent() + "/" + selected.getName()).getChannel();
d... | public List execute(ComClient comClient) throws Exception {
ArrayList outStrings = new ArrayList();
SearchResult sr = Util.getSearchResultByIDAndNum(SearchManager.getInstance(), qID, dwNum);
for (int i = 0; i < checkerUrls.length; i++) {
String parametrizedURL = checkerUrls[i];
... | false |
4,842 | 3,180,675 | 7,464,993 | public void copyDependancyFiles() {
for (String[] depStrings : getDependancyFiles()) {
String source = depStrings[0];
String target = depStrings[1];
try {
File sourceFile = PluginManager.getFile(source);
IOUtils.copyEverything(sourceFile, n... | @Override
public void alterar(QuestaoDiscursiva q) throws Exception {
System.out.println("ALTERAR " + q.getIdQuestao());
PreparedStatement stmt = null;
String sql = "UPDATE questao SET id_disciplina=?, enunciado=?, grau_dificuldade=? WHERE id_questao=?";
try {
stmt = ... | false |
4,843 | 22,807,014 | 6,291,471 | @Test
public void test() throws JDOMException, IOException {
InputStream is = this.getClass().getResourceAsStream("putRegularVehicle.xml");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
IOUtils.copy(is, byteArrayOutputStream);
TrafficModelDefinition d... | private void copyFile(File f) throws IOException {
File newFile = new File(destdir + "/" + f.getName());
newFile.createNewFile();
FileInputStream fin = new FileInputStream(f);
FileOutputStream fout = new FileOutputStream(newFile);
int c;
while ((c = fin.read()) != -1)... | true |
4,844 | 15,821,341 | 16,966,539 | public void update() {
try {
String passwordMD5 = new String();
if (this.password != null && this.password.length() > 0) {
MessageDigest md = MessageDigest.getInstance("md5");
md.update(this.password.getBytes());
byte[] digest = md.dige... | public String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | true |
4,845 | 1,293,659 | 10,905,999 | public void delete(int id) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
... | protected int insertRecord(PutMetadataRequest request, PutMetadataInfo info) throws ImsServiceException, SQLException {
Connection con = null;
boolean autoCommit = true;
PreparedStatement st = null;
ResultSet rs = null;
int nRows = 0;
String sXml = info.getXml();
... | true |
4,846 | 11,940,679 | 1,197,703 | public ActionForward uploadFile(ActionMapping mapping, ActionForm actForm, HttpServletRequest request, HttpServletResponse in_response) {
ActionMessages errors = new ActionMessages();
ActionMessages messages = new ActionMessages();
String returnPage = "submitPocketSampleInformationPage";
... | public static String digest(String algorithm, String text) {
MessageDigest mDigest = null;
try {
mDigest = MessageDigest.getInstance(algorithm);
mDigest.update(text.getBytes(ENCODING));
} catch (NoSuchAlgorithmException nsae) {
_log.error(nsae, nsae);
... | false |
4,847 | 14,856,221 | 15,286,502 | public static String encodeByMd5(String str) {
try {
if (str == null) {
str = "";
}
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(str.getBytes("utf-8"));
byte[] b = md5.digest();
int i;
Str... | public static String md5(String senha) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Ocorreu NoSuchAlgorithmException");
}
md.update(senha.getBytes());
byte[] ... | true |
4,848 | 4,519,452 | 9,713,536 | private void copyFile(File s, File d) throws IOException {
d.getParentFile().mkdirs();
FileChannel inChannel = new FileInputStream(s).getChannel();
FileChannel outChannel = new FileOutputStream(d).getChannel();
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inCh... | @SuppressWarnings("unchecked")
private void doService(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final String url = request.getRequestURL().toString();
if (url.endsWith("/favicon.ico")) {
response.setStatus(HttpServlet... | true |
4,849 | 12,909,291 | 14,033,995 | public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType(s_contentType);
response.setHeader("Cache-control", "no-cache");
InputStream graphStream = getGraphStream(request);
OutputStream out = getOutputStream(re... | public void migrate(InputMetadata meta, InputStream input, OutputCreator outputCreator) throws IOException, ResourceMigrationException {
RestartInputStream restartInput = new RestartInputStream(input);
Match match = resourceIdentifier.identifyResource(meta, restartInput);
restartInput.restar... | true |
4,850 | 7,760,801 | 10,220,823 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | @Test
public void testCopy() throws IOException {
final byte[] input = { 0x00, 0x01, 0x7F, 0x03, 0x40 };
final byte[] verification = input.clone();
Assert.assertNotSame("Expecting verification to be a new array.", input, verification);
final ByteArrayInputStream in = new ByteArra... | true |
4,851 | 12,082,140 | 20,453,777 | public static Set<Street> getVias(String pURL) {
Set<Street> result = new HashSet<Street>();
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String iniDesErr = "<des>";
String finDesErr = "</des>";
String iniVia = "<calle>";
String finVia = "</calle... | private static List retrieveQuotes(Report report, Symbol symbol, TradingDate startDate, TradingDate endDate) throws ImportExportException {
List quotes = new ArrayList();
String URLString = constructURL(symbol, startDate, endDate);
EODQuoteFilter filter = new YahooEODQuoteFilter(symbol);
... | true |
4,852 | 20,680,657 | 3,872,093 | protected void sort(int a) {
int[] masiv = new int[a + 1];
Random fff = new Random();
for (int i = 0; i <= a; i++) {
masiv[i] = fff.nextInt(9);
}
int d;
for (int j = 0; j < a; j++) {
for (int i = 0; i < a; i++) {
if (masiv[i] < ... | private ArrayList<Stock> fetchStockData(Stock[] stocks) throws IOException {
Log.d(TAG, "Fetching stock data from Yahoo");
ArrayList<Stock> newStocks = new ArrayList<Stock>(stocks.length);
if (stocks.length > 0) {
StringBuilder sb = new StringBuilder();
for (Stock sto... | false |
4,853 | 14,778,878 | 7,015,918 | public void copyFile(String oldPathFile, String newPathFile) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPathFile);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPathFile);
FileO... | public static void copy(File srcDir, File dstDir) throws IOException {
if (srcDir.isDirectory()) {
if (!dstDir.exists()) dstDir.mkdir();
String[] children = srcDir.list();
for (int i = 0; i < children.length; i++) copy(new File(srcDir, children[i]), new File(dstDir, child... | true |
4,854 | 7,500,669 | 19,717,905 | public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.err.println("Usage: java SOAPClient4XG " + "http://soapURL soapEnvelopefile.xml" + " [SOAPAction]");
System.err.println("SOAPAction is optional.");
System.exit(1);
}
S... | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Usage: java JMEImpl inputfile");
System.exit(0);
}
JME jme = null;
try {
URL url = new URL(Util.makeAbsoluteURL(args[0]));
BufferedReader bReader = new... | false |
4,855 | 10,916,692 | 1,123,203 | public GetMyDocuments() {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetMyDocuments";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "mydocuments.xml";
try {
String urldata = urlString + "?username=" + URLEncoder.e... | public TextureData newTextureData(GLProfile glp, URL url, int internalFormat, int pixelFormat, boolean mipmap, String fileSuffix) throws IOException {
InputStream stream = new BufferedInputStream(url.openStream());
try {
return newTextureData(glp, stream, internalFormat, ... | false |
4,856 | 3,447,266 | 16,031,757 | @SuppressWarnings("unchecked")
@Override
public synchronized void drop(DropTargetDropEvent arg0) {
Helper.log().debug("Dropped");
Transferable t = arg0.getTransferable();
try {
arg0.acceptDrop(arg0.getDropAction());
List<File> filelist = (List<File>) t.getTran... | private void createProject(IProgressMonitor monitor, boolean launchNewTestWizard) {
try {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(namePage.getProjectName());
IProjectDescription description = ResourcesPlugin.getWo... | false |
4,857 | 1,655,163 | 213,301 | public boolean delwuliao(String pid) {
boolean flag = false;
Connection conn = null;
PreparedStatement pm = null;
try {
conn = Pool.getConnection();
conn.setAutoCommit(false);
pm = conn.prepareStatement("delete from addwuliao where pid=?");
... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
4,858 | 11,992,308 | 10,242,903 | public static String generateStringSHA256(String content) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ScannerChecksum.class.getName()).log(Level.SEVERE, null, ex);
}
... | private List<Feature> getFeatures(String source, EntryPoint e) throws MalformedURLException, SAXException, IOException, ParserConfigurationException, URISyntaxException {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
FeatureParser featp = new FeatureParser();
parser.parse... | false |
4,859 | 19,040,459 | 12,194,196 | public static String getMD5(final String text) {
if (null == text) return null;
final MessageDigest algorithm;
try {
algorithm = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
algorithm... | @Test
public void testHandleMessageInvalidSignature() throws Exception {
KeyPair keyPair = MiscTestUtils.generateKeyPair();
DateTime notBefore = new DateTime();
DateTime notAfter = notBefore.plusYears(1);
X509Certificate certificate = MiscTestUtils.generateCertificate(keyPair.get... | true |
4,860 | 13,028,547 | 17,573,144 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public void dispatch(com.sun.star.util.URL aURL, com.sun.star.beans.PropertyValue[] aArguments) {
if (aURL.Protocol.compareTo("org.openoffice.oosvn.oosvn:") == 0) {
OoDocProperty docProperty = getProperty();
settings.setCancelFired(false);
if (aURL.Path.compareTo("svnUpda... | true |
4,861 | 21,704,695 | 22,262,998 | public String hmacSHA256(String message, byte[] key) {
MessageDigest sha256 = null;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new java.lang.AssertionError(this.getClass().getName() + ".hmacSHA256(): SHA-256 algor... | public static String SHA512(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-512");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("UTF-8"), 0, text.length());
sha1hash = md.digest();
... | true |
4,862 | 23,248,619 | 22,884,065 | public static void main(String[] args) {
try {
Transaction transaction = session.beginTransaction();
URL url1 = new URL("http://www.cs.huji.ac.il/~keren_ha/J2EE/keren.jpg");
HttpURLConnection conn1 = (HttpURLConnection) url1.openConnection();
conn1.connect();
... | public void testFidelity() throws ParserException, IOException {
Lexer lexer;
Node node;
int position;
StringBuffer buffer;
String string;
char[] ref;
char[] test;
URL url = new URL("http://sourceforge.net");
lexer = new Lexer(url.openConnectio... | false |
4,863 | 15,471,169 | 489,862 | public static String getMD5(String value) {
if (StringUtils.isBlank(value)) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes("UTF-8"));
return toHexString(md.digest());
} catch (Throwable e) {
ret... | public static void main(String[] args) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
String text = "YUMyfj";
md.update(text.getBytes(), 0, text.length());
System.out.println(new BigInteger(1, md.digest()).toString(16).toString());
}
| true |
4,864 | 7,110,836 | 635,006 | private void copyFile(File dir, File fileToAdd) {
try {
byte[] readBuffer = new byte[1024];
File file = new File(dir.getCanonicalPath() + File.separatorChar + fileToAdd.getName());
if (file.createNewFile()) {
FileInputStream fis = new FileInputStream(fileT... | public static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("FileCopy: no such source file: " + from_name);
if (!from_file.isFile()) abort("FileCopy: can't copy d... | true |
4,865 | 369,844 | 6,914,912 | private boolean enregistreToi() {
PrintWriter lEcrivain;
String laDest = "./img_types/" + sonImage;
if (!new File("./img_types").exists()) {
new File("./img_types").mkdirs();
}
try {
FileChannel leFicSource = new FileInputStream(sonFichier).getChannel(... | public static void main(String[] a) throws Exception {
HashMap<String, Integer> numberOfOccurencesOfThisComboe = new HashMap<String, Integer>();
HashMap<String, String> fileToCATHMapping = new HashMap<String, String>();
ArrayList<String> allFilesToBeCopied = new ArrayList<String>();
... | true |
4,866 | 12,115,248 | 23,267,978 | public void actionPerformed(ActionEvent evt) {
try {
File tempFile = new File("/tmp/controler.xml");
File f = new File("/tmp/controler-temp.xml");
BufferedInputStream copySource = new BufferedInputStream(new FileInputStream(tempFile));
... | public static boolean copy(InputStream is, File file) {
try {
IOUtils.copy(is, new FileOutputStream(file));
return true;
} catch (Exception e) {
logger.severe(e.getMessage());
return false;
}
}
| true |
4,867 | 15,958,994 | 10,535,319 | public String loadURLString(java.net.URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String s = "";
while (br.ready() && s != null) {
s = br.readLine();
... | private static Collection<String> createTopLevelFiles(Configuration configuration, Collections collections, Sets sets) throws FlickrException, SAXException, IOException, JDOMException, TransformerException {
Collection<String> createdFiles = new HashSet<String>();
File toplevelXmlFilename = getTople... | false |
4,868 | 7,752,928 | 7,005,223 | public InputStream getInputStream(IProgressMonitor monitor) throws IOException, CoreException {
if (in == null && url != null) {
if (connection == null) connection = url.openConnection();
if (monitor != null) {
this.in = openStreamWithCancel(connection, monitor);
... | public void checkFilesAndCopyValid(String filename) {
downloadResults();
loadResults();
File tmpFolderF = new File(tmpFolder);
deleteFileFromTMPFolder(tmpFolderF);
ZipReader zr = new ZipReader();
zr.UnzipFile(filename);
try {
LogManager.getInstance... | false |
4,869 | 19,147,300 | 11,213,172 | public boolean ponerColorxRonda(int idJugadorDiv, int idRonda, int dato) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET color = " + dato + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRonda;
try {
connecti... | 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(... | false |
4,870 | 13,529,502 | 22,095,678 | private Component createLicensePane(String propertyKey) {
if (licesePane == null) {
String licenseText = "";
BufferedReader in = null;
try {
String filename = "conf/LICENSE.txt";
java.net.URL url = FileUtil.toURL(filename);
... | public static String deleteTag(String tag_id) {
String so = OctopusErrorMessages.UNKNOWN_ERROR;
if (tag_id == null || tag_id.trim().equals("")) {
return OctopusErrorMessages.TAG_ID_CANT_BE_EMPTY;
}
DBConnection theConnection = null;
try {
theConnection... | false |
4,871 | 10,158,740 | 1,831,677 | public void delete(String language, String tag, int row) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
String sql = "delete from LanguageMorphologies " + "where LanguageName = '" + language + "' and MorphologyTag... | public int delete(BusinessObject o) throws DAOException {
int delete = 0;
Account acc = (Account) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("DELETE_ACCOUNT"));
pst.setInt(1, acc.getId());
delete = pst.executeUpdate()... | true |
4,872 | 6,357,972 | 17,495,579 | private void loadImage(URL url) {
ImageData imageData;
Image artworkImage = null;
InputStream artworkStream = null;
try {
artworkStream = new BufferedInputStream(url.openStream());
imageData = new ImageLoader().load(artworkStream)[0... | public Document transform(URL url) throws IOException {
Document doc = null;
try {
InputStream in = url.openStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Tidy tidy = new Tidy();
tidy.setShowWarnings(false);
tidy.setXml... | false |
4,873 | 22,122,895 | 7,219,016 | protected String getHashCode(String value) {
if (log.isDebugEnabled()) log.debug("getHashCode(...) -> begin");
String retVal = null;
try {
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(value.getBytes());
byte[] digest = m... | public static String getMD5(String... list) {
if (list.length == 0) return null;
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
md.reset();
for (Str... | true |
4,874 | 5,271,061 | 18,748,953 | private void createJarArchive(File archiveFile, List<File> filesToBeJared, File base) throws Exception {
FileOutputStream stream = new FileOutputStream(archiveFile);
JarOutputStream out = new JarOutputStream(stream);
for (File tobeJared : filesToBeJared) {
if (tobeJared == null |... | private static String appletLoad(String file, Output OUT) {
if (!urlpath.endsWith("/")) {
urlpath += '/';
}
if (!urlpath.startsWith("http://")) {
urlpath = "http://" + urlpath;
}
String url = "";
if (file.equals("languages.txt")) {
... | false |
4,875 | 22,327,409 | 6,396,264 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter();
} catch (IOException ex) {
... | private static void addFromResource(String resource, OutputStream out) {
URL url = OpenOfficeDocumentCreator.class.getResource(resource);
try {
InputStream in = url.openStream();
byte[] buffer = new byte[256];
synchronized (in) {
synchronized (out)... | false |
4,876 | 21,518,266 | 665,978 | public void initGet() throws Exception {
cl = new DefaultHttpClient();
GetAuthPromter hp = new GetAuthPromter();
cl.setCredentialsProvider(hp);
get = new HttpGet(getURL());
get.setHeader("User-Agent", "test");
get.setHeader("Accept", "*/*");
get.setHeader("Ran... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
4,877 | 17,586,130 | 6,333,737 | protected N save(String sql, Object[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
pstmt = conn.prepareStatement(sql, Statement.RETURN_GENERA... | public static IProject createEMFProject(IPath javaSource, URI projectLocationURI, List<IProject> referencedProjects, Monitor monitor, int style, List<?> pluginVariables) {
IProgressMonitor progressMonitor = BasicMonitor.toIProgressMonitor(monitor);
String projectName = javaSource.segment... | false |
4,878 | 6,680,022 | 15,607,084 | public ResourceMigratorBuilder createResourceMigratorBuilder(NotificationReporter reporter) {
return new ResourceMigratorBuilder() {
public ResourceMigrator getCompletedResourceMigrator() {
return new ResourceMigrator() {
public void migr... | protected void copyFile(String inputFilePath, String outputFilePath) throws GenerationException {
String from = getTemplateDir() + inputFilePath;
try {
logger.debug("Copying from " + from + " to " + outputFilePath);
InputStream inputStream = Thread.currentThread().getContextC... | true |
4,879 | 11,101,252 | 6,320,837 | @Override
public void handler(Map<String, Match> result, TargetPage target) {
List<String> lines = new LinkedList<String>();
List<String> page = new LinkedList<String>();
try {
URL url = new URL(target.getUrl());
BufferedReader reader = new BufferedReader(new Inpu... | public String getDocumentAt(String urlString) {
StringBuffer document = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
... | true |
4,880 | 16,845,107 | 23,031,483 | public boolean copyFile(File destinationFolder, File fromFile) {
boolean result = false;
String toFileName = destinationFolder.getAbsolutePath() + "/" + fromFile.getName();
File toFile = new File(toFileName);
FileInputStream from = null;
FileOutputStream to = null;
tr... | private static void copy(File source, File target, byte[] buffer) throws FileNotFoundException, IOException {
InputStream in = new FileInputStream(source);
File parent = target.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
if (target.isDirectory()) {... | true |
4,881 | 23,677,114 | 20,336,463 | public static void copyFile1(File srcFile, File destFile) throws IOException {
if(!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream fis = new FileInputStream(srcFile);
FileOutputStream fos = new FileOutputStream(destFile);
FileChannel source = fis.getChannel();
FileChannel destinat... | private static void prepare() {
System.err.println("PREPARING-----------------------------------------");
deleteHome();
InputStream configStream = null;
FileOutputStream tempStream = null;
try {
configStream = AllTests.class.getClassLoader().getResourceAsStream("n... | true |
4,882 | 9,183,056 | 978,930 | public void testHandler() throws MalformedURLException, IOException {
assertTrue("This test can only be run once in a single JVM", imageHasNotBeenInstalledInThisJVM);
URL url;
Handler.installImageUrlHandler((ImageSource) new ClassPathXmlApplicationContext("org/springframework/richclient/imag... | public static String encode(String arg) {
if (arg == null) {
arg = "";
}
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(arg.getBytes(JavaCenterHome.JCH_CHARSET));
} catch (Exception e) {
e.pri... | false |
4,883 | 22,530,929 | 12,730,349 | public static String md5Encode(String pass) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pass.getBytes());
byte[] result = md.digest();
return bytes2hexStr(result);
} catch (NoSuchAlgorithmException e) {
throw new ... | public static String do_checksum(String data) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
StringBuffer strbuf = new StringBuffer();
md5.update(data.getBytes(), 0, data.length());
byte[] digest = md5.digest();
for (int i = 0; i < dig... | true |
4,884 | 14,137,256 | 4,385,640 | private final void copyTargetFileToSourceFile(File sourceFile, File targetFile) throws MJProcessorException {
if (!targetFile.exists()) {
targetFile.getParentFile().mkdirs();
try {
if (!targetFile.exists()) {
targetFile.createNewFile();
... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
4,885 | 5,505,848 | 16,833,560 | public void testResponseTimeout() throws Exception {
server.enqueue(new MockResponse().setBody("ABC").clearHeaders().addHeader("Content-Length: 4"));
server.enqueue(new MockResponse().setBody("DEF"));
server.play();
URLConnection urlConnection = server.getUrl("/").openConnection();
... | public byte[] loadClassFirst(final String className) {
if (className.equals("com.sun.sgs.impl.kernel.AppKernelAppContext")) {
final URL url = Thread.currentThread().getContextClassLoader().getResource("com/sun/sgs/impl/kernel/AppKernelAppContext.0.9.5.1.class.bin");
if (url != null) ... | false |
4,886 | 8,788,331 | 1,008,325 | private void copyFromStdin(Path dst, FileSystem dstFs) throws IOException {
if (dstFs.isDirectory(dst)) {
throw new IOException("When source is stdin, destination must be a file.");
}
if (dstFs.exists(dst)) {
throw new IOException("Target " + dst.toString() + " alread... | public long copyDirAllFilesToDirectory(String baseDirStr, String destDirStr) throws Exception {
long plussQuotaSize = 0;
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.endsWith(sep)) {
destDirStr... | true |
4,887 | 18,722,984 | 6,023,157 | private void checkChartsyRegistration(String username, String password) {
HttpPost post = new HttpPost(NbBundle.getMessage(RegisterPanel.class, "RegisterPanel.chartsyRegisterURL"));
String message = "";
try {
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
... | private FTPClient getFTPConnection(String strUser, String strPassword, String strServer, boolean binaryTransfer, String connectionNote) {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(strServer);
ResourcePool.LogMessage(this, ResourcePool.INFO_MESS... | false |
4,888 | 14,832,930 | 5,933,080 | private static String format(String check) throws NoSuchAlgorithmException, UnsupportedEncodingException {
check = check.replaceAll(" ", "");
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(check.getBytes("ISO-8859-1"));
byte[] end = md5.digest();
String dige... | 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()... | true |
4,889 | 13,395,834 | 14,782,656 | TreeMap<Integer, Integer> initProperties(URL propurl) {
String zoneFileName = null;
String costFileName = null;
String homesFileName = null;
String jobsFileName = null;
Properties props = new Properties();
try {
props.loadFromXML(propurl.openStream());
... | private static Long statusSWGCraftTime() {
long current = System.currentTimeMillis() / 1000L;
if (current < (previousStatusCheck + SWGCraft.STATUS_CHECK_DELAY)) return previousStatusTime;
URL url = null;
try {
synchronized (previousStatusTime) {
if (curren... | false |
4,890 | 12,800,568 | 22,424,633 | public void exportFile() {
String expfolder = PropertyHandler.getInstance().getProperty(PropertyHandler.KINDLE_EXPORT_FOLDER_KEY);
File out = new File(expfolder + File.separator + previewInfo.getTitle() + ".prc");
File f = new File(absPath);
try {
FileOutputStream fout = ... | public static void copyFile(String input, String output) {
try {
FileChannel srcChannel = new FileInputStream("srcFilename").getChannel();
FileChannel dstChannel = new FileOutputStream("dstFilename").getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());... | true |
4,891 | 970,144 | 4,045,277 | 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 void execute() throws BuildException {
Project proj = getProject();
if (templateFile == null) throw new BuildException("Template file not set");
if (targetFile == null) throw new BuildException("Target file not set");
try {
File template = new File(templateFile);
... | true |
4,892 | 9,106,740 | 8,009,241 | public String sendXml(URL url, String xmlMessage, boolean isResponseExpected) throws IOException {
if (url == null) {
throw new IllegalArgumentException("url == null");
}
if (xmlMessage == null) {
throw new IllegalArgumentException("xmlMessage == null");
}
... | public static final synchronized String md5(final String data) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
md.update(data.getBytes());
final byte[] b = md.digest();
return toHexString(b);
} catch (final Exception e) {
}
... | false |
4,893 | 23,677,119 | 12,448,713 | public static void copyFile6(File srcFile, File destFile) throws FileNotFoundException {
Scanner s = new Scanner(srcFile);
PrintWriter pw = new PrintWriter(destFile);
while(s.hasNextLine()) {
pw.println(s.nextLine());
}
pw.close();
s.close();
}
| private void writeGif(String filename, String outputFile) throws IOException {
File file = new File(filename);
InputStream in = new FileInputStream(file);
FileOutputStream fout = new FileOutputStream(outputFile);
int totalRead = 0;
int readBytes = 0;
int blockSize = 6... | true |
4,894 | 418,257 | 11,433,309 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | public File extractID3v2TagDataIntoFile(File outputFile) throws TagNotFoundException, IOException {
int startByte = (int) ((MP3AudioHeader) audioHeader).getMp3StartByte();
if (startByte >= 0) {
FileInputStream fis = new FileInputStream(file);
FileChannel fc = fis.getChannel()... | true |
4,895 | 2,602,107 | 10,249,398 | public OutputStream getAsOutputStream() throws IOException {
OutputStream out;
if (contentStream != null) {
File tmp = File.createTempFile(getId(), null);
out = new FileOutputStream(tmp);
IOUtils.copy(contentStream, out);
} else {
out = new Byt... | public String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | false |
4,896 | 9,837,783 | 11,825,739 | private void fileCopier(String filenameFrom, String filenameTo) {
FileInputStream fromStream = null;
FileOutputStream toStream = null;
try {
fromStream = new FileInputStream(new File(filenameFrom));
if (new File(filenameTo).exists()) {
new File(filenam... | public static void copyFile(String from, String to, boolean append) throws IOException {
FileChannel in = new FileInputStream(from).getChannel();
FileChannel out = new FileOutputStream(to, append).getChannel();
ByteBuffer buffer = ByteBuffer.allocate(BSIZE);
while (in.read(buffer) !=... | true |
4,897 | 14,510,383 | 4,047,586 | @Override
public void copyFile2File(final File src, final File dest, final boolean force) throws C4JException {
if (dest.exists()) if (force && !dest.delete()) throw new C4JException(format("Copying ‘%s’ to ‘%s’ failed; cannot overwrite existing file.", src.getPath(), dest.getPath()));
FileChann... | public static void toValueSAX(Property property, Value value, int valueType, ContentHandler contentHandler, AttributesImpl na, Context context) throws SAXException, RepositoryException {
na.clear();
String _value = null;
switch(valueType) {
case PropertyType.DATE:
... | true |
4,898 | 13,825,969 | 13,716,732 | @Override
protected void doFetch(HttpServletRequest request, HttpServletResponse response) throws IOException, GadgetException {
if (request.getHeader("If-Modified-Since") != null) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
String host = ... | public void adjustPadding(File file, int paddingSize, long audioStart) throws FileNotFoundException, IOException {
logger.finer("Need to move audio file to accomodate tag");
FileChannel fcIn = null;
FileChannel fcOut;
ByteBuffer paddingBuffer = ByteBuffer.wrap(new byte[paddingSize]);... | true |
4,899 | 12,940,372 | 14,650,349 | private String encryptPassword(String password) {
String result = password;
if (password != null) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(password.getBytes());
BigInteger hash = ... | private ArrayList<XSPFTrackInfo> getPlaylist() {
try {
Log.d(TAG, "Getting playlist started");
String urlString = "http://" + mBaseURL + "/xspf.php?sk=" + mSession + "&discovery=0&desktop=1.4.1.57486";
if (mAlternateConn) {
urlString += "&api_key=9d1bbaef3... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.