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 |
|---|---|---|---|---|---|
897,700 | 555,513 | 10,337,386 | 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... | protected void zipFile(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(to));
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = in.read(buffer)) != -1) ou... | true |
897,701 | 11,838,691 | 10,819,149 | private void externalizeFiles(Document doc, File out) throws IOException {
File[] files = doc.getImages();
if (files.length > 0) {
File dir = new File(out.getParentFile(), out.getName() + ".images");
if (!dir.mkdirs()) throw new IOException("cannot create directory " + dir);
... | public String insertBuilding() {
homeMap = homeMapDao.getHomeMapById(homeMap.getId());
homeBuilding.setHomeMap(homeMap);
Integer id = homeBuildingDao.saveHomeBuilding(homeBuilding);
String dir = "E:\\ganymede_workspace\\training01\\web\\user_buildings\\";
FileOutputStream fos... | true |
897,702 | 14,864,066 | 3,672,328 | protected boolean downloadFile(TestThread thread, ActionResult result) {
result.setRequestString("download file " + remoteFile);
InputStream input = null;
OutputStream output = null;
OutputStream target = null;
boolean status = false;
ftpClient.enterLocalPassiveMode()... | public static void copy(String sourceFile, String targetFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel();
FileChannel targetChannel = new FileOutputStream(targetFile).getChannel();
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.s... | true |
897,703 | 19,040,459 | 4,617,220 | 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... | public String postFileRequest(String fileName, String internalFileName) throws Exception {
status = STATUS_INIT;
String responseString = null;
String requestStringPostFix = new String("");
if (isThreadStopped) {
return "";
}
... | false |
897,704 | 709,584 | 21,361,961 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private void transform(CommandLine commandLine) throws IOException {
Reader reader;
if (commandLine.hasOption('i')) {
reader = createFileReader(commandLine.getOptionValue('i'));
} else {
reader = createStandardInputReader();
}
Writer writer;
if... | true |
897,705 | 12,312,913 | 13,574,318 | public static void rewrite(String[] args) throws IOException, CodeCheckException {
ClassWriter writer = new ClassWriter();
writer.readClass(new FileInputStream(args[0]));
for (Iterator i = writer.getMethods().iterator(); i.hasNext(); ) {
MethodInfo method = (MethodInfo) i.next();... | public void actionPerformed(ActionEvent e) {
if (saveForWebChooser == null) {
ExtensionFileFilter fileFilter = new ExtensionFileFilter("HTML files");
fileFilter.addExtension("html");
saveForWebChooser = new JFileChooser();
saveForWebCho... | true |
897,706 | 1,655,163 | 12,935,678 | 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 String makeMD5(String str) {
byte[] bytes = new byte[32];
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes("iso-8859-1"), 0, str.length());
bytes = md.digest();
} catch (Exception e) {
return null... | false |
897,707 | 19,875,963 | 1,607,807 | @Override
public void remove(int disciplinaId) {
try {
this.criaConexao(false);
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PostgresqlDisciplinaDAO.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
j... | public void save(String oid, String key, Serializable obj) throws PersisterException {
String lock = getLock(oid);
if (lock == null) {
throw new PersisterException("Object does not exist: OID = " + oid);
} else if (!NULL.equals(lock) && (!lock.equals(key))) {
throw ne... | true |
897,708 | 7,380,001 | 19,825,038 | private static void generateFile(String inputFilename, String outputFilename) throws Exception {
File inputFile = new File(inputFilename);
if (inputFile.exists() == false) {
throw new Exception(Messages.getString("ScriptDocToBinary.Input_File_Does_Not_Exist") + inputFilename);
}
... | public static byte[] post(String path, Map<String, String> params, String encode) throws Exception {
StringBuilder parambuilder = new StringBuilder("");
if (params != null && !params.isEmpty()) {
for (Map.Entry<String, String> entry : params.entrySet()) {
parambuilder.app... | false |
897,709 | 3,861,343 | 949,221 | protected void truncate(File file) {
LogLog.debug("Compression of file: " + file.getAbsolutePath() + " started.");
if (FileUtils.isFileOlder(file, ManagementFactory.getRuntimeMXBean().getStartTime())) {
File backupRoot = new File(getBackupDir());
if (!backupRoot.exists() && !... | 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... | true |
897,710 | 13,292,327 | 5,828,731 | public static Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileIn... | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | true |
897,711 | 20,947,969 | 4,707,507 | static InputStream getFileAsStream(Class clazz, HandlerChain chain) {
URL url = clazz.getResource(chain.file());
if (url == null) {
url = Thread.currentThread().getContextClassLoader().getResource(chain.file());
}
if (url == null) {
String tmp = clazz.getPacka... | @Override
public HttpResponse execute() throws IOException {
if (this.method == HttpMethod.GET) {
String url = this.toString();
if (url.length() > this.cutoff) {
if (log.isLoggable(Level.FINER)) log.finer("URL length " + url.length() + " too long, converting GET t... | false |
897,712 | 22,323,983 | 12,440,169 | private void getLines(PackageManager pm) throws PackageManagerException {
final Pattern p = Pattern.compile("\\s*deb\\s+(ftp://|http://)(\\S+)\\s+((\\S+\\s*)*)(./){0,1}");
Matcher m;
if (updateUrlAndFile == null) updateUrlAndFile = new ArrayList<UrlAndFile>();
BufferedReader f;
... | 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);
}
... | true |
897,713 | 657,801 | 23,029,916 | void copyFile(String from, String to) throws IOException {
File destFile = new File(to);
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
... | public static void notify(String msg) throws Exception {
String url = "http://api.clickatell.com/http/sendmsg?";
url = add(url, "user", user);
url = add(url, "password", password);
url = add(url, "api_id", apiId);
url = add(url, "to", to);
url = add(url, "text", msg);... | true |
897,714 | 9,245,183 | 23,563,688 | public void read(Model m, String url) throws JenaException {
try {
URLConnection conn = new URL(url).openConnection();
String encoding = conn.getContentEncoding();
if (encoding == null) read(m, conn.getInputStream(), url); else read(m, new InputStreamReader(conn.getInputS... | private void getLocationAddressByGoogleMapAsync(Location location) {
if (location == null) {
return;
}
AsyncTask<Location, Void, String> task = new AsyncTask<Location, Void, String>() {
@Override
protected String doInBackground(Location... params) {
... | false |
897,715 | 18,921,331 | 13,405,484 | public void init() {
this.setFormulaCalculationMode(WorkBookHandle.CALCULATE_ALWAYS);
try {
if (memeId < 0) {
} else {
conurl = new URL(ServerURL + "?meme_id=" + memeId);
java.io.InputStream xmlstr = conurl.openStream();
this.re... | public boolean send(String number, String message) throws IOException {
init();
message = message.substring(0, Math.min(MAX_PAYLOAD, message.length()));
message = message.replace('\r', ' ');
message = message.replace('\n', ' ');
ActualFormParameters params = new ActualFormPar... | false |
897,716 | 20,239,268 | 7,051,649 | public static File[] splitFile(FileValidator validator, File source, long target_length, File todir, String prefix) {
if (target_length == 0) return null;
if (todir == null) {
todir = new File(System.getProperty("java.io.tmpdir"));
}
if (prefix == null || prefix.equals(""... | private void copyFile(String inputPath, String basis, String filename) throws GLMRessourceFileException {
try {
FileChannel inChannel = new FileInputStream(new File(inputPath)).getChannel();
File target = new File(basis, filename);
FileChannel outChannel = new FileOutputS... | true |
897,717 | 13,667,527 | 4,414,596 | private Bitmap fetchImage(String urlstr) throws Exception {
URL url;
url = new URL(urlstr);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setDoInput(true);
c.setRequestProperty("User-Agent", "Agent");
c.connect();
InputStream is = c.getInpu... | public static int UsePassword(String username, String password, String new_password) {
try {
URL url = new URL("http://eiffel.itba.edu.ar/hci/service/Security.groovy?method=ChangePassword&username=" + username + "&password=" + password + "&new_password=" + new_password);
URLConnectio... | false |
897,718 | 10,467,996 | 6,146,146 | public void copyFile(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPath);
FileOutputStream fs =... | public static String encrypt(String text) throws NoSuchAlgorithmException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
try {
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (UnsupportedEncodingExceptio... | false |
897,719 | 8,546,232 | 6,693,221 | public void execute(File sourceFile, File destinationFile, Properties htmlCleanerConfig) {
FileReader reader = null;
Writer writer = null;
try {
reader = new FileReader(sourceFile);
logger.info("Using source file: " + trimPath(userDir, sourceFile));
if (!d... | public void dumpDB(String in, String out) {
try {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
inChannel.close();
... | true |
897,720 | 23,677,136 | 10,598,170 | public static void BubbleSortFloat2(float[] num) {
int last_exchange;
int right_border = num.length - 1;
do {
last_exchange = 0;
for (int j = 0; j < num.length - 1; j++) {
if (num[j] > num[j + 1])
{
float temp = num[j];
num[j] = num[j + 1];
num[j + 1] = temp;
last_exchange = j;
... | private static String sort(final String item) {
final char[] chars = item.toCharArray();
for (int i = 1; i < chars.length; i++) {
for (int j = 0; j < chars.length - 1; j++) {
if (chars[j] > chars[j + 1]) {
final char temp = chars[j];
... | true |
897,721 | 20,900,753 | 12,082,137 | public boolean isServerAlive(String pStrURL) {
boolean isAlive;
long t1 = System.currentTimeMillis();
try {
URL url = new URL(pStrURL);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((i... | public static Set<Municipality> getMunicipios(String pURL) {
Set<Municipality> result = new HashSet<Municipality>();
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String iniDesErr = "<des>";
String finDesErr = "</des>";
String iniMun = "<muni>";
S... | true |
897,722 | 18,645,749 | 13,233,448 | public void GetList() throws Exception {
Authenticator.setDefault(new MyAuth(this._user, this._pwd));
URL url = new URL(MyFanfou.PublicTimeLine);
InputStream ins = url.openConnection().getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
S... | private static String GetSHA1(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 |
897,723 | 11,552,288 | 3,331,971 | public void run() {
Thread.currentThread().setName("zhongwen.com watcher");
String url = getURL();
try {
while (m_shouldBeRunning) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "ISO8859_1"))... | protected void onSubmit() {
try {
Connection conn = ((JdbcRequestCycle) getRequestCycle()).getConnection();
String sql = "insert into entry (author, accessibility) values(?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, userId);
... | false |
897,724 | 7,330,695 | 234,104 | static final String md5(String text) throws RtmApiException {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("UTF-8"), 0, text.length());
md5hash = md.digest();
return c... | public static void main(String[] argv) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (Exception e) {
e.printStackTrace();
}
md.update("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq".getBytes(), 0, 56);
... | true |
897,725 | 20,696,811 | 1,142,776 | private static boolean insereTutorial(final Connection con, final Tutorial tut, final Autor aut, final Descricao desc) {
try {
con.setAutoCommit(false);
Statement smt = con.createStatement();
if (aut.getCodAutor() == 0) {
GeraID.gerarCodAutor(con, aut);
... | public LinkedList<NameValuePair> getScoreboard() {
InputStream is = null;
String result = "";
LinkedList<NameValuePair> scores = new LinkedList<NameValuePair>();
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(domain);
... | false |
897,726 | 15,097,860 | 13,405,484 | public static Bitmap loadPhotoBitmap(final String imageUrl, final String type) {
InputStream imageStream = null;
try {
HttpGet httpRequest = new HttpGet(new URL(imageUrl).toURI());
HttpResponse response = (HttpResponse) new DefaultHttpClient().execute(httpRequest);
... | public boolean send(String number, String message) throws IOException {
init();
message = message.substring(0, Math.min(MAX_PAYLOAD, message.length()));
message = message.replace('\r', ' ');
message = message.replace('\n', ' ');
ActualFormParameters params = new ActualFormPar... | false |
897,727 | 6,644,756 | 6,066,972 | public void alterar(Cliente cliente) throws Exception {
Connection connection = criaConexao(false);
String sql = "update cliente set nome = ?, sexo = ?, cod_cidade = ? where cod_cliente = ?";
PreparedStatement stmt = null;
try {
stmt = connection.prepareStatement(sql);
... | @Override
public void run() {
Shell currentShell = Display.getCurrent().getActiveShell();
if (DMManager.getInstance().getOntology() == null) return;
DataRecordSet data = DMManager.getInstance().getOntology().getDataView().dataset();
InputDialog input = new InputDialog(currentShel... | true |
897,728 | 14,504,556 | 23,029,126 | public void doNew(Vector userId, String shareFlag, String folderId) throws AddrException {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement ps = null;
ResultSet rset = null;
String sql = "insert into " + SHARE_TABLE + " values(?,?,?)";
try {
... | private HttpURLConnection makeGetRequest(String action, Object... parameters) throws IOException {
StringBuffer request = new StringBuffer(remoteUrl);
HTMLUtils.appendQuery(request, VERSION_PARAM, CLIENT_VERSION);
HTMLUtils.appendQuery(request, ACTION_PARAM, action);
for (int i = 0; ... | false |
897,729 | 12,876,684 | 21,266,476 | public String getMD5(String data) {
try {
MessageDigest md5Algorithm = MessageDigest.getInstance("MD5");
md5Algorithm.update(data.getBytes(), 0, data.length());
byte[] digest = md5Algorithm.digest();
StringBuffer hexString = new StringBuffer();
Str... | public static String md5(String word) {
MessageDigest alg = null;
try {
alg = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ServletUtils.class.getName()).log(Level.SEVERE, null, ex);
}
alg.reset();
a... | true |
897,730 | 1,787,391 | 21,715,891 | private static void writeOneAttachment(Context context, Writer writer, OutputStream out, Attachment attachment) throws IOException, MessagingException {
writeHeader(writer, "Content-Type", attachment.mMimeType + ";\n name=\"" + attachment.mFileName + "\"");
writeHeader(writer, "Content-Transfer-Enco... | protected void copy(File src, File dest) throws IOException {
if (src.isDirectory() && dest.isFile()) throw new IOException("Cannot copy a directory to a file");
if (src.isDirectory()) {
File newDir = new File(dest, src.getName());
if (!newDir.mkdirs()) throw new IOException(... | true |
897,731 | 8,344,457 | 23,022,776 | private static void addFileToZip(String path, String srcFile, ZipOutputStream zip, String prefix, String suffix) throws Exception {
File folder = new File(srcFile);
if (folder.isDirectory()) {
addFolderToZip(path, srcFile, zip, prefix, suffix);
} else {
if (isFileName... | public Long processAddHolding(Holding holdingBean, AuthSession authSession) {
if (authSession == null) {
return null;
}
PreparedStatement ps = null;
DatabaseAdapter dbDyn = null;
try {
dbDyn = DatabaseAdapter.getInstance();
CustomSequenceTy... | false |
897,732 | 12,039,036 | 9,353,181 | public static ArrayList<Credential> importCredentials(String urlString) {
ArrayList<Credential> results = new ArrayList<Credential>();
try {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer... | JSONResponse execute() throws ServerException, RtmApiException, IOException {
HttpClient httpclient = new DefaultHttpClient();
URI uri;
try {
uri = new URI(this.request.getUrl());
HttpPost httppost = new HttpPost(uri);
HttpResponse response = httpclient.ex... | true |
897,733 | 14,497,172 | 4,646,950 | public String getHtml(String path) throws Exception {
URL url = new URL(path);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
InputStream inputStream = conn.getInputStream();
InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8");
Stri... | public boolean openInputStream() throws Exception {
open = false;
if (filename == null) return false;
try {
url = new URL(filename);
con = url.openConnection();
con.connect();
lengthOfData = con.getContentLength();
System.out.printl... | false |
897,734 | 12,678,589 | 1,953,115 | 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.... | protected int doWork() {
SAMFileReader reader = new SAMFileReader(IoUtil.openFileForReading(INPUT));
reader.getFileHeader().setSortOrder(SORT_ORDER);
SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), false, OUTPUT);
Iterator<SAMRecord> itera... | true |
897,735 | 7,237,618 | 588,571 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public static void main(String[] args) throws Exception {
String uri = args[0];
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.open(new Path(uri));
IOUtils.copyBytes... | true |
897,736 | 19,063,414 | 552,319 | public void readData() throws IOException {
i = 0;
j = 0;
URL url = getClass().getResource("resources/Chrom_623_620.dat");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
s = br... | public String getpage(String leurl) throws Exception {
int data;
StringBuffer lapage = new StringBuffer();
URL myurl = new URL(leurl);
URLConnection conn = myurl.openConnection();
conn.connect();
if (!Pattern.matches("HTTP/... 2.. .*", conn.getHeaderField(0).toString(... | true |
897,737 | 13,653,638 | 22,857,041 | private static String scramble(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
for (byte b : md.digest()) sb.append(Integer.toString(b & 0xFF, 16));
... | public static String generate(String source) {
byte[] SHA = new byte[20];
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(source.getBytes());
SHA = digest.digest();
} catch (NoSuchAlgorithmException e) {
System.ou... | true |
897,738 | 15,537,156 | 19,722,337 | 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();
... | @Override
public void objectToEntry(String object, TupleOutput output) {
byte array[] = object.getBytes();
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream out = new GZIPOutputStream(baos);
ByteArrayI... | true |
897,739 | 14,416,222 | 11,419,588 | private boolean subtitleDownload(Movie movie, File movieFile, File subtitleFile) {
try {
String ret;
String xml;
String moviehash = getHash(movieFile);
String moviebytesize = String.valueOf(movieFile.length());
xml = generateXMLRPCSS(moviehash, mov... | public static 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(m... | false |
897,740 | 14,867,997 | 20,681,845 | public String getResponse(URL url) throws OAuthException {
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String i... | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | false |
897,741 | 5,951,609 | 9,689,565 | public void testCryptHash() {
Log.v("Test", "[*] testCryptHash()");
String testStr = "Hash me";
byte messageDigest[];
MessageDigest digest = null;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(testStr.getBytes());
... | public static String md5sum(String s, String alg) {
try {
MessageDigest md = MessageDigest.getInstance(alg);
md.update(s.getBytes(), 0, s.length());
StringBuffer sb = new StringBuffer();
synchronized (sb) {
for (byte b : md.digest()) sb.append(... | true |
897,742 | 17,341,373 | 20,880,642 | private void handleServerIntroduction(DataPacket serverPacket) {
DataPacketIterator iter = serverPacket.getDataPacketIterator();
String version = iter.nextString();
int serverReportedUDPPort = iter.nextUByte2();
_authKey = iter.nextUByte4();
_introKey = iter.nextUByte4();
... | public static String getHash(String password, String salt) throws NoSuchAlgorithmException, UnsupportedEncodingException {
logger.debug("Entering getHash with password = " + password + "\n and salt = " + salt);
MessageDigest digest = MessageDigest.getInstance("SHA-512");
digest.reset();
... | true |
897,743 | 8,596,559 | 4,511,510 | public boolean connect() {
if (connectStatus > -1) return (connectStatus == 1);
connectStatus = 0;
try {
URL url = new URL(getURL());
m_connection = (HttpURLConnection) url.openConnection();
m_connection.connect();
processHeaders();
... | public static String cryptoSHA(String _strSrc) {
try {
BASE64Encoder encoder = new BASE64Encoder();
MessageDigest sha = MessageDigest.getInstance("SHA");
sha.update(_strSrc.getBytes());
byte[] buffer = sha.digest();
return encoder.encode(buffer);
... | false |
897,744 | 7,125,457 | 12,754,505 | void readFileHeader(DmgConfigDMO config, ConfigLocation sl) throws IOException {
fileHeader = "";
if (config.getGeneratedFileHeader() != null) {
StringBuffer sb = new StringBuffer();
if (sl.getJarFilename() != null) {
URL url = new URL("jar:file:" + sl.getJarF... | public static final String MD5(String value) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String newValue = hash.toString(16);
return newValue;
}... | false |
897,745 | 20,661,433 | 20,968,465 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | private boolean downloadFile(Proxy proxy, URL url, File file) {
try {
URLConnection conn = null;
if (null == proxy) {
conn = url.openConnection();
} else {
conn = url.openConnection(proxy);
}
conn.connect();
... | false |
897,746 | 36,860 | 13,325,917 | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getCanonicalPath());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getCanonicalP... | true |
897,747 | 16,454,974 | 12,270,268 | @Override
public int write(FileStatus.FileTrackingStatus fileStatus, InputStream input, PostWriteAction postWriteAction) throws WriterException, InterruptedException {
String key = logFileNameExtractor.getFileName(fileStatus);
int wasWritten = 0;
FileOutputStreamPool fileOutputStreamPool... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
if (System.getProperty("os.name").toUpperCase().indexOf("WIN") != -1) {
... | true |
897,748 | 22,950,121 | 21,266,147 | private boolean createPKCReqest(String keystoreLocation, String pw) {
boolean created = false;
Security.addProvider(new BouncyCastleProvider());
KeyStore ks = null;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new BufferedInputStream(new... | public void execute() {
File sourceFile = new File(oarfilePath);
File destinationFile = new File(deploymentDirectory + File.separator + sourceFile.getName());
try {
FileInputStream fis = new FileInputStream(sourceFile);
FileOutputStream fos = new FileOutputStream(dest... | true |
897,749 | 21,583,226 | 23,206 | public String getMessageofTheDay(String id) {
StringBuffer mod = new StringBuffer();
int serverModId = 0;
int clientModId = 0;
BufferedReader input = null;
try {
URL url = new URL(FlyShareApp.BASE_WEBSITE_URL + "/mod.txt");
input = new BufferedReader(n... | public static BufferedReader getUserInfoStream(String name) throws IOException {
BufferedReader in;
try {
URL url = new URL("http://www.spoj.pl/users/" + name.toLowerCase() + "/");
in = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (MalformedURL... | true |
897,750 | 14,053,971 | 206,397 | private static String fetchUrl(String url, boolean keepLineEnds) throws IOException, MalformedURLException {
URLConnection destConnection = (new URL(url)).openConnection();
BufferedReader br;
String inputLine;
StringBuffer doc = new StringBuffer();
String contentEncoding;
... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
897,751 | 23,299,439 | 14,658,498 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String contentType = req.getParameter("type");
String arg = req.getParameter("file");
if (arg == null) {
resp.sendError(404, "Missing File Arg");
... | private Properties loadPropertiesFromURL(String propertiesURL, Properties defaultProperties) {
Properties properties = new Properties(defaultProperties);
URL url;
try {
url = new URL(propertiesURL);
URLConnection urlConnection = url.openConnection();
prope... | false |
897,752 | 18,488,108 | 2,467,280 | public static void saveZipComponents(ZipComponents zipComponents, File zipFile) throws FileNotFoundException, IOException, Exception {
ZipOutputStream zipOutStream = new ZipOutputStream(new FileOutputStream(zipFile));
for (ZipComponent comp : zipComponents.getComponents()) {
ZipEntry new... | private static void discoverRegisteryEntries(DataSourceRegistry registry) {
try {
Enumeration<URL> urls = DataSetURL.class.getClassLoader().getResources("META-INF/org.virbo.datasource.DataSourceFactory.extensions");
while (urls.hasMoreElements()) {
URL url = urls.next... | false |
897,753 | 5,869,013 | 19,169,483 | public Leilao insertLeilao(Leilao leilao) throws SQLException {
Connection conn = null;
String insert = "insert into Leilao (idleilao, atividade_idatividade, datainicio, datafim) " + "values " + "(nextval('seq_leilao'), " + leilao.getAtividade().getIdAtividade() + ", '" + leilao.getDataInicio() + "'... | public static String encryptString(String str) {
StringBuffer sb = new StringBuffer();
int i;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(str.getBytes());
byte[] md5Bytes = md5.digest();
for (i = 0; i < md5Bytes.lengt... | false |
897,754 | 15,568,623 | 8,274,572 | public Resultado procesar() {
if (resultado != null) return resultado;
int[] a = new int[elems.size()];
Iterator iter = elems.iterator();
int w = 0;
while (iter.hasNext()) {
a[w] = ((Integer) iter.next()).intValue();
w++;
}
int n = a.le... | public ODFSignatureService(TimeStampServiceValidator timeStampServiceValidator, RevocationDataService revocationDataService, SignatureFacet signatureFacet, InputStream documentInputStream, OutputStream documentOutputStream, TimeStampService timeStampService, String role, IdentityDTO identity, byte[] photo, DigestAl... | false |
897,755 | 5,402,254 | 9,547,227 | public void setKey(String key) {
MessageDigest md5;
byte[] mdKey = new byte[32];
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(key.getBytes());
byte[] digest = md5.digest();
System.arraycopy(digest, 0, mdKey, 0, 16);
Syst... | public void testBackup() throws Exception {
masterJetty.stop();
copyFile(new File(CONF_DIR + "solrconfig-master1.xml"), new File(master.getConfDir(), "solrconfig.xml"));
masterJetty = createJetty(master);
masterClient = createNewSolrServer(masterJetty.getLocalPort());
for (in... | false |
897,756 | 11,314,012 | 2,386,120 | public static java.io.ByteArrayOutputStream getFileByteStream(URL _url) {
java.io.ByteArrayOutputStream buffer = new java.io.ByteArrayOutputStream();
try {
InputStream input = _url.openStream();
IOUtils.copy(input, buffer);
IOUtils.closeQuietly(input);
} c... | @Override
public void setContentAsStream(InputStream input) throws IOException {
BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(htmlFile));
try {
IOUtils.copy(input, output);
} finally {
output.close();
}
if (this.getLa... | true |
897,757 | 17,553,387 | 20,273,405 | @Override
public boolean putDescription(String uuid, String description) throws DatabaseException {
if (uuid == null) throw new NullPointerException("uuid");
if (description == null) throw new NullPointerException("description");
try {
getConnection().setAutoCommit(false);
... | 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... | false |
897,758 | 13,405,484 | 15,127,557 | public boolean send(String number, String message) throws IOException {
init();
message = message.substring(0, Math.min(MAX_PAYLOAD, message.length()));
message = message.replace('\r', ' ');
message = message.replace('\n', ' ');
ActualFormParameters params = new ActualFormPar... | public static void find(String pckgname, Class tosubclass) {
String name = new String(pckgname);
if (!name.startsWith("/")) {
name = "/" + name;
}
name = name.replace('.', '/');
URL url = RTSI.class.getResource(name);
System.out.println(name + "->" + url);... | false |
897,759 | 15,311,523 | 5,774,521 | public String buscaSAIKU() {
URL url;
Properties prop = new CargaProperties().Carga();
BufferedReader in;
String inputLine;
String miLinea = null;
try {
url = new URL(prop.getProperty("SAIKU"));
in = new BufferedReader(new InputStreamReader(url... | private static URL lookForDefaultThemeFile(String aFilename) {
try {
XPathFactory fabrique = XPathFactory.newInstance();
XPath environnement = fabrique.newXPath();
URL url = new URL("file:" + aFilename);
InputSource source = new InputSource(url.openStream());
... | false |
897,760 | 6,147,227 | 14,533,769 | public static String[] putFECSplitFile(String uri, File file, int htl, boolean mode) {
FcpFECUtils fecutils = null;
Vector segmentHeaders = null;
Vector segmentFileMaps = new Vector();
Vector checkFileMaps = new Vector();
Vector segmentKeyMaps = new Vector();
Vector c... | private WikiSiteContentInfo createInfoIndexSite(Long domainId) {
final UserInfo user = getSecurityService().getCurrentUser();
final Locale locale = new Locale(user.getLocale());
final String country = locale.getLanguage();
InputStream inStream = Thread.currentThread().getContextClass... | true |
897,761 | 78,966 | 9,439,748 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
lon... | true |
897,762 | 8,196,591 | 5,624,313 | private void bokActionPerformed(java.awt.event.ActionEvent evt) {
if (this.seriesstatementpanel.getEnteredvalues().get(0).toString().trim().equals("")) {
this.showWarningMessage("Enter Series Title");
} else {
String[] patlib = newgen.presentation.NewGenMain.getAppletInstance... | private GenomicSequence fetch(Chromosome k, int start, int end) throws IOException {
try {
String chr = k.toString();
if (chr.toLowerCase().startsWith("chr")) chr = chr.substring(3);
SAXParserFactory f = SAXParserFactory.newInstance();
f.setNamespaceAware(fals... | false |
897,763 | 9,219,797 | 14,077,808 | public static void encryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | public Dbf(URL url) throws java.io.IOException, DbfFileException {
if (DEBUG) System.out.println("---->uk.ac.leeds.ccg.dbffile.Dbf constructed. Will identify itself as " + DBC);
URLConnection uc = url.openConnection();
InputStream in = uc.getInputStream();
EndianDataInputStream sfile... | false |
897,764 | 5,817,511 | 520,600 | @Override
public void send(String payload, TransportReceiver receiver) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
configureConnection(connection);
OutputStream out = connection.getOutputStream();
... | 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 |
897,765 | 23,383,764 | 15,113,543 | public static void createBackup() {
String workspacePath = Workspace.INSTANCE.getWorkspace();
if (workspacePath.length() == 0) return;
workspacePath += "/";
String backupPath = workspacePath + "Backup";
File directory = new File(backupPath);
if (!directory.exists()) d... | private static void identify(ContentNetwork cn, String str) {
try {
URL url = new URL(str);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
UrlUtils.setBrowserHeaders(con, null);
String key = "cn." + cn.getID() + ".identify.cookie";
... | false |
897,766 | 9,415,194 | 21,431,679 | public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | public static String get(String u, String usr, String pwd) {
String response = "";
logger.debug("Attempting to call: " + u);
logger.debug("Creating Authenticator: usr=" + usr + ", pwd=" + pwd);
Authenticator.setDefault(new CustomAuthenticator(usr, pwd));
try {
URL... | false |
897,767 | 7,645,348 | 14,560,668 | @BeforeClass
public static void setUpOnce() throws OWLOntologyCreationException {
dbManager = (OWLDBOntologyManager) OWLDBManager.createOWLOntologyManager(OWLDataFactoryImpl.getInstance());
dbIRI = IRI.create(ontoUri);
System.out.println("copying ontology to work folder...");
try... | public void execute(PaymentInfoMagcard payinfo) {
if (payinfo.getTotal().compareTo(BigDecimal.ZERO) > 0) {
try {
StringBuffer sb = new StringBuffer();
sb.append("x_login=");
sb.append(URLEncoder.encode(m_sCommerceID, "UTF-8"));
sb.a... | false |
897,768 | 390,386 | 1,725,721 | static String fetchURLComposeExternPackageList(String urlpath, String pkglisturlpath) {
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (Malforme... | public static int writeFile(URL url, File outFilename) {
InputStream input;
try {
input = url.openStream();
} catch (IOException e) {
e.printStackTrace();
return 0;
}
FileOutputStream outputStream;
try {
outputStream = n... | false |
897,769 | 15,097,860 | 6,155,833 | public static Bitmap loadPhotoBitmap(final String imageUrl, final String type) {
InputStream imageStream = null;
try {
HttpGet httpRequest = new HttpGet(new URL(imageUrl).toURI());
HttpResponse response = (HttpResponse) new DefaultHttpClient().execute(httpRequest);
... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | false |
897,770 | 11,522,419 | 23,248,618 | public static void copyFile(File in, File out) {
int len;
byte[] buffer = new byte[1024];
try {
FileInputStream fin = new FileInputStream(in);
FileOutputStream fout = new FileOutputStream(out);
while ((len = fin.read(buffer)) >= 0) fout.write(buffer, 0, le... | public static Recipes addRecipe(Lists complexity, String about, String title, Users user, int preparationTime, int cookingTime, int servings, Lists dishType, String picUrl, Iterable<String> instructions) throws Exception {
URL url = new URL(picUrl);
HttpURLConnection conn = (HttpURLConnection) url.o... | false |
897,771 | 9,909,126 | 9,704,751 | public void service(TranslationRequest request, TranslationResponse response) {
try {
Thread.sleep((long) Math.random() * 250);
} catch (InterruptedException e1) {
}
hits.incrementAndGet();
String key = getKey(request);
RequestResponse cachedResponse = cac... | public OOXMLSignatureService(InputStream documentInputStream, OutputStream documentOutputStream, SignatureFacet signatureFacet, String role, IdentityDTO identity, byte[] photo, RevocationDataService revocationDataService, TimeStampService timeStampService, DigestAlgo signatureDigestAlgo) throws IOException {
... | true |
897,772 | 1,039,796 | 15,718,136 | public static void insert(Connection c, MLPApprox net, int azioneId, String descrizione, int[] indiciID, int output, Date from, Date to) throws SQLException {
try {
PreparedStatement ps = c.prepareStatement(insertNet, PreparedStatement.RETURN_GENERATED_KEYS);
ArrayList<Integer> index... | 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;
}
| false |
897,773 | 12,706,520 | 19,191,608 | private FTPClient connect() throws IOException {
FTPClient client = null;
Configuration conf = getConf();
String host = conf.get("fs.ftp.host");
int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
String user = conf.get("fs.ftp.user." + host);
String passwor... | public static String getDigestResponse(String user, String password, String method, String requri, String authstr) {
String realm = "";
String nonce = "";
String opaque = "";
String algorithm = "";
String qop = "";
StringBuffer digest = new StringBuffer();
Str... | false |
897,774 | 21,291,602 | 3,743,400 | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | private static byte[] calcMd5(String pass) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(pass.getBytes(), 0, pass.length());
byte[] hash = digest.digest();
return hash;
} catch (NoSuchAlgorithmException e)... | false |
897,775 | 7,949,001 | 1,205,207 | protected byte[] getBytesForWebPageUsingHTTPClient(String urlString) throws ClientProtocolException, IOException {
log("Retrieving url: " + urlString);
DefaultHttpClient httpclient = new DefaultHttpClient();
if (this.archiveAccessSpecification.getUserID() != null) {
httpclient.ge... | @SuppressWarnings("deprecation")
private void loadClassFilesFromJar() {
IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) getJavaElement();
File jarFile = packageFragmentRoot.getResource().getLocation().toFile();
try {
URL url = jarFile.toURL();
UR... | false |
897,776 | 5,634,854 | 17,630,907 | private static void checkClients() {
try {
sendMultiListEntry('l');
} catch (Exception e) {
if (Util.getDebugLevel() > 90) e.printStackTrace();
}
try {
if (CANT_CHECK_CLIENTS != null) KeyboardHero.removeStatus(CANT_CHECK_CLIENTS);
URL u... | public static int[] sortDescending(int input[]) {
int[] order = new int[input.length];
for (int i = 0; i < order.length; i++) order[i] = i;
for (int i = input.length; --i >= 0; ) {
for (int j = 0; j < i; j++) {
if (input[j] < input[j + 1]) {
in... | false |
897,777 | 10,606,028 | 5,783,518 | public void bubble() {
boolean test = false;
int kars = 0, tas = 0;
while (true) {
for (int j = 0; j < dizi.length - 1; j++) {
kars++;
if (dizi[j] > dizi[j + 1]) {
int temp = dizi[j];
dizi[j] = dizi[j + 1];
... | @Override
protected boolean sendBytes(byte[] data, int offset, int length) {
try {
String hex = toHex(data, offset, length);
URL url = new URL(this.endpoint, "?raw=" + hex);
System.out.println("Connecting to " + url);
URLConnection conn = url.openConnectio... | false |
897,778 | 17,014,842 | 2,530,139 | private String createDefaultRepoConf() throws IOException {
InputStream confIn = getClass().getResourceAsStream(REPO_CONF_PATH);
File tempConfFile = File.createTempFile("repository", "xml");
tempConfFile.deleteOnExit();
IOUtils.copy(confIn, new FileOutputStream(tempConfFile));
... | public static String md5(String input) {
String res = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] md5 = algorithm.digest();
String tmp = "";
... | false |
897,779 | 18,488,106 | 18,810,216 | public static Document validateXml(File messageFile, URL inputUrl, String[] catalogs) throws IOException, ParserConfigurationException, Exception, SAXException, FileNotFoundException {
InputSource source = new InputSource(inputUrl.openStream());
Document logDoc = DomUtil.getNewDom();
XMLRead... | private void doIt() throws Throwable {
int numCachedTiles = 0;
try {
List<MapTile> backTiles = new ArrayList<MapTile>();
final LatLngRectangle bounds = new LatLngRectangle(new LatLngPoint(south, west), new LatLngPoint(north, east));
final String backMapGuid = "gst... | true |
897,780 | 386,013 | 1,931,704 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | private EventSeries<PhotoEvent> loadIncomingEvents(long reportID) {
EventSeries<PhotoEvent> events = new EventSeries<PhotoEvent>();
try {
URL url = new URL(SERVER_URL + XML_PATH + "reports.csv");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(... | true |
897,781 | 14,879,478 | 2,245,320 | public static void copyFile(File src, File dst) throws IOException {
BufferedInputStream is = new BufferedInputStream(new FileInputStream(src));
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(dst));
byte[] buf = new byte[1024];
int count = 0;
while ((... | void writeToFile(String dir, InputStream input, String fileName) throws FileNotFoundException, IOException {
makeDirs(dir);
FileOutputStream fo = null;
try {
System.out.println(Thread.currentThread().getName() + " : " + "Writing file " + fileName + " to path " + dir);
... | true |
897,782 | 14,757,691 | 10,927,077 | protected String getCitations(String ticket, String query) throws IOException {
String urlQuery;
try {
urlQuery = "http://www.jstor.org/search/BasicResults?hp=" + MAX_CITATIONS + "&si=1&gw=jtx&jtxsi=1&jcpsi=1&artsi=1&Query=" + URLEncoder.encode(query, "UTF-8") + "&wc=on&citationAction=sa... | private String hash(String message) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new AssertionError("Can't find the SHA1 algorithm in the java.security package");
}
String saltStr... | false |
897,783 | 19,147,293 | 112,491 | 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 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 |
897,784 | 1,820,410 | 10,104,168 | public static void zipDirectory(String dir, String zipfile) throws IOException, IllegalArgumentException {
File d = new File(dir);
if (!d.isDirectory()) throw new IllegalArgumentException("Not a directory: " + dir);
String[] entries = d.list();
byte[] buffer = new byte[4096];
... | public static String calculateHash(String data, String algorithm) {
if (data == null) {
return null;
}
algorithm = (algorithm == null ? INTERNAL : algorithm.toUpperCase());
if (algorithm.equals(PLAIN)) {
return data;
}
if (algorithm.startsWith(... | false |
897,785 | 18,942,525 | 4,615,986 | public void updateUserInfo(AuthSession authSession, AuthUserExtendedInfo infoAuth) {
log.info("Start update auth");
PreparedStatement ps = null;
DatabaseAdapter db = null;
try {
db = DatabaseAdapter.getInstance();
String sql = "update WM_AUTH_USER " + "set " +... | public void processAction(DatabaseAdapter db_, DataDefinitionActionDataListType parameters) throws Exception {
PreparedStatement ps = null;
try {
if (log.isDebugEnabled()) log.debug("db connect - " + db_.getClass().getName());
String seqName = DefinitionService.getString(para... | true |
897,786 | 14,533,769 | 20,761,702 | private WikiSiteContentInfo createInfoIndexSite(Long domainId) {
final UserInfo user = getSecurityService().getCurrentUser();
final Locale locale = new Locale(user.getLocale());
final String country = locale.getLanguage();
InputStream inStream = Thread.currentThread().getContextClass... | private File newFile(File oldFile) throws IOException {
int counter = 0;
File nFile = new File(this.stateDirProvider.get() + File.separator + oldFile.getName());
while (nFile.exists()) {
nFile = new File(this.stateDirProvider.get() + File.separator + oldFile.getName() + "_" + cou... | true |
897,787 | 10,193,598 | 20,418,573 | public static String encodePassword(String password) {
try {
MessageDigest messageDiegest = MessageDigest.getInstance("SHA-1");
messageDiegest.update(password.getBytes("UTF-8"));
return Base64.encodeToString(messageDiegest.digest(), false);
} catch (NoSuchAlgorith... | public static String hashMD5(String password) {
String hashword = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
hashword = hash.toString(16);
... | true |
897,788 | 587,211 | 1,429,497 | @Override
public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException {
String url = request.getParameter(URL_PARAM_NAME);
if (StringUtils.isEmpty(url)) {
log.error("url parameter not provided.");
throw new DataSourceException(Re... | private Scanner getUrlScanner(String strUrl) {
URL urlParticipants = null;
Scanner scannerParticipants;
try {
urlParticipants = new URL(strUrl);
URLConnection connParticipants;
if (StringUtils.isBlank(this.configProxyIp)) {
connParticipants... | false |
897,789 | 7,119,938 | 19,142,737 | public void putFile(CompoundName file, FileInputStream fileInput) throws IOException {
File fullDir = new File(REMOTE_BASE_DIR.getCanonicalPath());
for (int i = 0; i < file.size() - 1; i++) fullDir = new File(fullDir, file.get(i));
fullDir.mkdirs();
File outputFile = new File(fullDir... | 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 |
897,790 | 20,559,735 | 1,607,807 | public void deletePortletName(PortletNameBean portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (portletNameBean.getPortletId() == null) throw new IllegalArgumentException("portletNameId is nu... | public void save(String oid, String key, Serializable obj) throws PersisterException {
String lock = getLock(oid);
if (lock == null) {
throw new PersisterException("Object does not exist: OID = " + oid);
} else if (!NULL.equals(lock) && (!lock.equals(key))) {
throw ne... | true |
897,791 | 12,539,808 | 1,971,286 | public void jsFunction_extract(ScriptableFile outputFile) throws IOException, FileSystemException, ArchiveException {
InputStream is = file.jsFunction_createInputStream();
OutputStream output = outputFile.jsFunction_createOutputStream();
BufferedInputStream buf = new BufferedInputStream(is);... | public XmlDocument parseLocation(String locationUrl) {
URL url = null;
try {
url = new URL(locationUrl);
} catch (MalformedURLException e) {
throw new XmlBuilderException("could not parse URL " + locationUrl, e);
}
try {
return parseInputSt... | false |
897,792 | 367,771 | 17,014,629 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void fileCopy(File src, File dest) throws IOException {
IOException xforward = null;
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel fcin = null;
FileChannel fcout = null;
try {
fis = new FileInputStream(src);
... | true |
897,793 | 18,367,536 | 6,881,934 | public static void main(String[] args) throws HttpException, IOException {
String headerName = null;
String t = "http://localhost:8080/access/content/group/81c8542d-3f58-48cf-ac72-9f482df47ebe/sss/QuestionarioSocioEc.pdf";
URL url = new URL(t);
HttpURLConnection srvletConnection = (H... | public static String sendSoapMsg(String SOAPUrl, byte[] b, String SOAPAction) throws IOException {
log.finest("HTTP REQUEST SIZE " + b.length);
if (SOAPAction.startsWith("\"") == false) SOAPAction = "\"" + SOAPAction + "\"";
URL url = new URL(SOAPUrl);
HttpURLConnection httpConn = (H... | false |
897,794 | 20,428,223 | 15,669,668 | public void extractSong(Song s, File dir) {
FileInputStream fin = null;
FileOutputStream fout = null;
File dest = new File(dir, s.file.getName());
if (dest.equals(s.file)) return;
byte[] buf = new byte[COPY_BLOCKSIZE];
try {
fin = new FileInputStream(s.fil... | private static FileChannel getFileChannel(File file, boolean isOut, boolean append) throws OpenR66ProtocolSystemException {
FileChannel fileChannel = null;
try {
if (isOut) {
FileOutputStream fileOutputStream = new FileOutputStream(file.getPath(), append);
... | true |
897,795 | 18,536,907 | 7,669,917 | public static void copyFile(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
... | public void insertStringInFile(String file, String textToInsert, long fromByte, long toByte) throws Exception {
String tmpFile = file + ".tmp";
BufferedInputStream in = null;
BufferedOutputStream out = null;
long byteCount = 0;
try {
in = new BufferedInputStream(n... | true |
897,796 | 1,008,325 | 20,453,777 | 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... | 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);
... | false |
897,797 | 6,008,880 | 21,496,577 | protected void updateJava2ScriptProject(String prjFolder, String binRelative) {
try {
File cpFile = new File(prjFolder, ".classpath");
FileInputStream fis = new FileInputStream(cpFile);
String classpath = J2SLaunchingUtil.readAFile(fis);
if (classpath != null)... | private void regattaBackup() {
SwingWorker sw = new SwingWorker() {
Regatta lRegatta = fRegatta;
public Object construct() {
String fullName = lRegatta.getSaveDirectory() + lRegatta.getSaveName();
System.out.println(MessageFormat.format(res.getString... | true |
897,798 | 7,791,429 | 3,516,106 | public static String hashMD5(String baseString) {
MessageDigest digest = null;
StringBuffer hexString = new StringBuffer();
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(baseString.getBytes());
byte[] hash = digest.digest();
... | 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);
}
... | true |
897,799 | 23,047,157 | 106,595 | @Override
public void run() {
long timeout = 10 * 1000L;
long start = (new Date()).getTime();
try {
InputStream is = socket.getInputStream();
boolean available = false;
while (!available && !socket.isClosed()) {
... | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.