id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
2,600 | 11,050,195 | 938,889 | private void writeFile(File file, String fileName) {
try {
FileInputStream fin = new FileInputStream(file);
FileOutputStream fout = new FileOutputStream(dirTableModel.getDirectory().getAbsolutePath() + File.separator + fileName);
int val;
while ((val = fin.rea... | 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... | true |
2,601 | 4,208,869 | 10,912,340 | public static void putNextJarEntry(JarOutputStream modelStream, String name, File file) throws IOException {
JarEntry entry = new JarEntry(name);
entry.setSize(file.length());
modelStream.putNextEntry(entry);
InputStream fileStream = new BufferedInputStream(new FileInputStream(file))... | public boolean chequearMarca(int a, int m, int d) {
boolean existe = false;
try {
cantidadArchivos = obtenerCantidad() + 1;
String filenametxt = "";
String filenamezip = "";
int dia = 0;
int mes = 0;
int ano = 0;
for... | true |
2,602 | 13,376,846 | 14,072,818 | private String hashPassword(String password) {
if (password != null && password.trim().length() > 0) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.trim().getBytes());
BigInteger hash = new BigInteger(1, md5.diges... | public osid.shared.Id ingest(String fileName, String templateFileName, String fileType, File file, Properties properties) throws osid.dr.DigitalRepositoryException, java.net.SocketException, java.io.IOException, osid.shared.SharedException, javax.xml.rpc.ServiceException {
long sTime = System.currentTimeMil... | false |
2,603 | 10,353,862 | 16,008,963 | public boolean copyTo(String targetFilePath) {
try {
FileInputStream srcFile = new FileInputStream(filePath);
FileOutputStream target = new FileOutputStream(targetFilePath);
byte[] buff = new byte[1024];
int readed = -1;
while ((readed = srcFile.re... | public static void unzip(final File file, final ZipFile zipFile, final File targetDirectory) throws PtException {
LOG.info("Unzipping zip file '" + file.getAbsolutePath() + "' to directory " + "'" + targetDirectory.getAbsolutePath() + "'.");
assert (file.exists() && file.isFile());
if (targe... | true |
2,604 | 11,452,667 | 21,161,481 | private void processData(InputStream raw) {
String fileName = remoteName;
if (localName != null) {
fileName = localName;
}
try {
FileOutputStream fos = new FileOutputStream(new File(fileName), true);
IOUtils.copy(raw, fos);
LOG.info("ok... | public static void toZip(File zippedFile, File[] filesToZip, String zipComment, boolean savePath, int compressionLevel) throws IOException, FileNotFoundException, ZipException {
if (zippedFile != null && filesToZip != null) {
new File(zippedFile.getParent()).mkdirs();
ZipOutputStream... | true |
2,605 | 631,632 | 6,983,973 | @Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == btnChange) {
Error.log(7002, "Bot�o alterar pressionado por " + login + ".");
if (new String(passwordUser1.getPassword()).compareTo("") == 0) {
JOptionPane.... | 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 |
2,606 | 4,477,205 | 1,772,401 | private static void copyFile(File srcFile, File destFile, long chunkSize) throws IOException {
FileInputStream is = null;
FileOutputStream os = null;
try {
is = new FileInputStream(srcFile);
FileChannel iChannel = is.getChannel();
os = new FileOutputStream... | private void redownloadResource(SchemaResource resource) {
if (_redownloadSet != null) {
if (_redownloadSet.contains(resource)) return;
_redownloadSet.add(resource);
}
String filename = resource.getFilename();
String schemaLocation = resource.getSchemaLocation... | false |
2,607 | 1,347,808 | 22,303,956 | public static void main(String[] args) throws IOException {
FileOutputStream f = new FileOutputStream("test.zip");
CheckedOutputStream csum = new CheckedOutputStream(f, new Adler32());
ZipOutputStream zos = new ZipOutputStream(csum);
BufferedOutputStream out = new BufferedOutputStrea... | private static BreakIterator createBreakInstance(Locale where, int kind, String rulesName, String dictionaryName) {
ResourceBundle bundle = ICULocaleData.getResourceBundle("BreakIteratorRules", where);
String[] classNames = bundle.getStringArray("BreakIteratorClasses");
String rules = bundle... | false |
2,608 | 16,226,357 | 15,402,323 | private String getHash(String string) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md5.reset();
md5.update(string.getBytes());
byte[] result = md... | public static String getMd5Hash(String text) {
StringBuffer result = new StringBuffer(32);
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
Formatter f = new Formatter(result);
byte[] digest = md5.digest();
... | true |
2,609 | 19,758,418 | 20,623,710 | public static String post(String strUrl, String data) throws Exception {
URL url = new URL(strUrl);
final String method = "POST";
final String host = url.getHost();
final String contentType = "application/x-www-form-urlencoded";
final int contentLength = getContentLength(data... | public static synchronized void repartition(File[] sourceFiles, File targetDirectory, String prefix, long maxUnitBases, long maxUnitEntries) throws Exception {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) throw new Exception("Could not create directory " + targetDirectory.getA... | false |
2,610 | 7,271,784 | 2,716,763 | public static boolean copy(File source, File target, boolean owrite) {
if (!source.exists()) {
log.error("Invalid input to copy: source " + source + "doesn't exist");
return false;
} else if (!source.isFile()) {
log.error("Invalid input to copy: source " + source ... | public void saveUploadFile(String toFileName, UploadFile uploadFile, SysConfig sysConfig) throws IOException {
OutputStream bos = new FileOutputStream(toFileName);
IOUtils.copy(uploadFile.getInputStream(), bos);
if (sysConfig.isAttachImg(uploadFile.getFileName()) && sysConfig.getReduceAttach... | true |
2,611 | 292,999 | 5,257,598 | 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 int proxy(java.net.URI uri, HttpServletRequest req, HttpServletResponse res) throws IOException {
final HostConfiguration hostConfig = new HostConfiguration();
hostConfig.setHost(uri.getHost());
HttpMethodBase httpMethod = null;
if (HttpRpcServer.METHOD_GET.equalsIgnore... | true |
2,612 | 7,872,667 | 12,980,227 | private static boolean computeMovieAverages(String completePath, String MovieAveragesOutputFileName, String MovieIndexFileName) {
try {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + MovieIndexFileName);
FileChannel inC = new FileInputStream(inputFile).getChann... | public void copy(File src, File dest) throws FileNotFoundException, IOException {
FileInputStream srcStream = new FileInputStream(src);
FileOutputStream destStream = new FileOutputStream(dest);
FileChannel srcChannel = srcStream.getChannel();
FileChannel destChannel = destStream.getC... | true |
2,613 | 21,764,292 | 5,623,479 | private static byte[] sha2(String... data) {
byte[] digest = new byte[32];
StringBuilder buffer = new StringBuilder();
for (String s : data) {
buffer.append(s);
}
MessageDigest sha256 = null;
try {
sha256 = MessageDigest.getInstance("SHA-256");... | public static String getHash(String text) {
String ret = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(text.getBytes());
ret = getHex(md.digest());
} catch (NoSuchAlgorithmException e) {
log.error(e);
... | true |
2,614 | 21,980,807 | 552,314 | public void checkAndDownload(String statsUrl, RDFStatsUpdatableModelExt stats, Date lastDownload, boolean onlyIfNewer) throws DataSourceMonitorException {
if (log.isInfoEnabled()) log.info("Checking if update required for statistics of " + ds + "...");
HttpURLConnection urlConnection;
try {
... | public void refreshFileItem(YahooInfo legroup) throws Exception {
String lapage = new String("");
String ledir = new String("");
Pattern pat;
Matcher mat;
Pattern pat2;
Matcher mat2;
int data;
URL myurl = new URL("http://groups.yahoo.com/mygroups");
... | false |
2,615 | 23,338,802 | 16,389,745 | @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "getJarFile", args = { })
public void test_getJarFile() throws MalformedURLException, IOException {
URL url = null;
url = createContent("lf.jar", "missing");
JarURLConnection connection = null;
connection = (JarURLC... | private void doIt() throws Throwable {
GenericDAO<User> dao = DAOFactory.createDAO(User.class);
try {
final User user = dao.findUniqueByCriteria(Expression.eq("login", login));
if (user == null) throw new IllegalArgumentException("Specified user isn't exist");
if ... | false |
2,616 | 17,409,656 | 9,510,692 | public XMLPieChartDemo(final String title) {
super(title);
PieDataset dataset = null;
final URL url = getClass().getResource("/org/jfree/chart/demo/piedata.xml");
try {
final InputStream in = url.openStream();
dataset = DatasetReader.readPieDatasetFromXML(in);... | public static void main(String[] args) {
try {
boolean readExp = Utils.getFlag('l', args);
final boolean writeExp = Utils.getFlag('s', args);
final String expFile = Utils.getOption('f', args);
if ((readExp || writeExp) && (expFile.length() == 0)) {
... | false |
2,617 | 20,592,334 | 8,917,665 | public static String md5Encode16(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes("utf-8"));
byte b[] = md.digest();
int i;
StringBuilder buf = new StringBuilder("");
for (int offset = 0; offse... | public static void copyAll(URL url, StringBuilder ret) {
Reader in = null;
try {
in = new InputStreamReader(new BufferedInputStream(url.openStream()));
copyAll(in, ret);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
... | false |
2,618 | 18,121,763 | 17,670,291 | public String doUpload(@ParamName(name = "file") MultipartFile file, @ParamName(name = "uploadDirectory") String _uploadDirectory) throws IOException {
String sessionId = (String) RuntimeAccess.getInstance().getSession().getAttribute("SESSION_ID");
String tempUploadDir = MewitProperties.getTemporary... | public void createNewFile(String filePath, InputStream in) throws IOException {
FileOutputStream out = null;
try {
File file = newFileRef(filePath);
FileHelper.createNewFile(file, true);
out = new FileOutputStream(file);
IOUtils.copy(in, out);
... | true |
2,619 | 19,279,420 | 7,396,681 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final FileManager fmanager = FileManager.getFileManager(request, leechget);
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter;
try {
... | public static boolean copy(File src, FileSystem dstFS, Path dst, boolean deleteSource, Configuration conf) throws IOException {
dst = checkDest(src.getName(), dstFS, dst, false);
if (src.isDirectory()) {
if (!dstFS.mkdirs(dst)) {
return false;
}
Fi... | true |
2,620 | 3,874,060 | 20,037,335 | public static void copyFile(File sourceFile, File targetFile) throws IOException {
if (sourceFile == null || targetFile == null) {
throw new NullPointerException("Source file and target file must not be null");
}
File directory = targetFile.getParentFile();
if (!directory... | public static void copyFromHDFSMerge(String hdfsDir, String local) throws IOException {
rmr(local);
File f = new File(local);
f.getAbsoluteFile().getParentFile().mkdirs();
HDFSDirInputStream inp = new HDFSDirInputStream(hdfsDir);
FileOutputStream oup = new FileOutputStream(lo... | true |
2,621 | 13,292,288 | 3,459,107 | 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 boolean hardCopy(File sourceFile, File destinationFile, StringBuffer errorLog) {
boolean result = true;
try {
notifyCopyStart(destinationFile);
destinationFile.getParentFile().mkdirs();
byte[] buffer = new byte[4096];
int len = 0;
... | true |
2,622 | 16,900,369 | 5,907,126 | private void addAllSpecialPages(Environment env, ZipOutputStream zipout, int progressStart, int progressLength) throws Exception, IOException {
ResourceBundle messages = ResourceBundle.getBundle("ApplicationResources", locale);
String tpl;
int count = 0;
int numberOfSpecialPages = 7;... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String contentId = req.getParameter(CONTENT_ID);
String contentType = req.getParameter(CONTENT_TYPE);
if (contentId == null || contentType == null) {
resp.s... | true |
2,623 | 13,863,615 | 23,512,890 | protected String getLibJSCode() throws IOException {
if (cachedLibJSCode == null) {
InputStream is = getClass().getResourceAsStream(JS_LIB_FILE);
StringWriter output = new StringWriter();
IOUtils.copy(is, output);
cachedLibJSCode = output.toString();
}... | private boolean write(File file) {
String filename = file.getPath();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream out = new PrintStream(byteArrayOutputStream);
try {
StringBuffer xml = null;
if (MainFrame.getInstance()... | true |
2,624 | 8,809,710 | 7,872,663 | public void salva(UploadedFile imagem, Usuario usuario) {
File destino = new File(pastaImagens, usuario.getId() + ".imagem");
try {
IOUtils.copyLarge(imagem.getFile(), new FileOutputStream(destino));
} catch (IOException e) {
throw new RuntimeException("Erro ao copiar... | private static boolean prepareQualifyingFile(String completePath, String outputFile) {
try {
File inFile = new File(completePath + fSep + "qualifying.txt");
FileChannel inC = new FileInputStream(inFile).getChannel();
BufferedReader br = new BufferedReader(new FileReader(i... | true |
2,625 | 22,422,244 | 1,362,126 | protected Source getStylesheetSource(Resource stylesheetLocation) throws ApplicationContextException {
if (logger.isDebugEnabled()) {
logger.debug("Loading XSLT stylesheet from " + stylesheetLocation);
}
try {
URL url = stylesheetLocation.getURL();
String ... | public InputStream resolve(String uri) throws SAJException {
try {
URI url = new URI(uri);
InputStream stream = url.toURL().openStream();
if (stream == null) throw new SAJException("URI " + uri + " can't be resolved");
return stream;
} catch (SAJExcept... | false |
2,626 | 17,575,096 | 1,718,589 | public boolean compile(URL url, String name) {
try {
final InputStream stream = url.openStream();
final InputSource input = new InputSource(stream);
input.setSystemId(url.toString());
return compile(input, name);
} catch (IOException e) {
_... | @Override
public ImageData getImageData(URL url) {
InputStream in = null;
try {
URLConnection conn = url.openConnection();
conn.setRequestProperty("user-agent", "Tahiti/Alpha5x");
conn.setRequestProperty("agent-system", "aglets");
conn.setAllowUser... | false |
2,627 | 4,721,547 | 19,641,319 | public static void main(String[] args) throws Exception {
String infile = "C:\\copy.sql";
String outfile = "C:\\copy.txt";
FileInputStream fin = new FileInputStream(infile);
FileOutputStream fout = new FileOutputStream(outfile);
FileChannel fcin = fin.getChannel();
Fi... | public void testDoPost() throws Exception {
URL url = null;
url = new URL("http://127.0.0.1:" + connector.getLocalPort() + "/test/dump/info?query=foo");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.se... | false |
2,628 | 5,724,216 | 19,299,263 | protected static void copyOrMove(File sourceLocation, File targetLocation, boolean move) throws IOException {
String[] children;
int i;
InputStream in;
OutputStream out;
byte[] buf;
int len;
if (sourceLocation.isDirectory()) {
if (!targetLocation.e... | String extractTiffFile(String path) throws IOException {
ZipInputStream in = new ZipInputStream(new FileInputStream(path));
OutputStream out = new FileOutputStream(dir + TEMP_NAME);
byte[] buf = new byte[1024];
int len;
ZipEntry entry = in.getNextEntry();
if (entry ==... | true |
2,629 | 9,399,634 | 8,778,961 | protected static String fileName2md5(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(input.getBytes("iso-8859-1"));
byte[] byteHash = md.digest();
md.reset();
StringBuffer resultString = ... | 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.... | false |
2,630 | 1,008,325 | 21,609,542 | 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... | public static long[] getUids(String myUid) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpGet get = new HttpGet(UIDS_URI);
HttpResponse response = client.execute(get);
if (response.getStatusLine().getStatusCode() ==... | false |
2,631 | 651,715 | 5,875,193 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private static void zip(ZipArchiveOutputStream zos, File efile, String base) throws IOException {
if (efile.isDirectory()) {
File[] lf = efile.listFiles();
base = base + File.separator + efile.getName();
for (File file : lf) {
zip(zos, file, base);
... | true |
2,632 | 7,682,331 | 3,402,503 | @org.junit.Test
public void testReadWrite() throws Exception {
final String reference = "testString";
final Reader reader = new StringReader(reference);
final StringWriter osString = new StringWriter();
final Reader teeStream = new TeeReaderWriter(reader, osString);
IOUti... | public static File insertFileInto(File zipFile, File toInsert, String targetPath) {
Zip64File zip64File = null;
try {
boolean compress = false;
zip64File = new Zip64File(zipFile);
FileEntry testEntry = getFileEntry(zip64File, targetPath);
if (testEntry... | true |
2,633 | 2,467,221 | 21,754,660 | void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
out.close... | public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new SoundFilter());
int returnVal = fc.showDialog(AdministracionResorces.this, Messages.getString("gui.AdministracionRes... | true |
2,634 | 19,852,761 | 2,214,949 | private int getCountFromUrl(String url) {
HttpGet request = new HttpGet(url);
try {
HttpResponse response = httpClient.execute(request);
int status = response.getStatusLine().getStatusCode();
if (status != HttpStatus.SC_OK) {
ByteArrayOutputStream ... | private static int get(URL url, byte[] content) throws IOException {
int len = -1;
InputStream in = null;
try {
in = new BufferedInputStream(url.openStream());
String type = URLConnection.guessContentTypeFromStream(in);
if (type == null || type.compareTo("... | false |
2,635 | 15,002,153 | 4,603,629 | public static void main(String[] args) {
if (args.length < 2) {
System.out.println(" *** DDL (creates) and DML (inserts) script importer from DB ***");
System.out.println(" You must specify name of the file with script importing data");
System.out.println(" Fisrt rows of ... | public static boolean copy(File from, File to) {
if (from.isDirectory()) {
for (String name : Arrays.asList(from.list())) {
if (!copy(from, to, name)) {
LogUtils.info("Failed to copy " + name + " from " + from + " to " + to, null);
return f... | true |
2,636 | 13,192,161 | 14,230,405 | protected List<String[]> execute(String queryString, String sVar1, String sVar2, String filter) throws Exception {
String query = URLEncoder.encode(queryString, "UTF-8");
String urlString = "http://sparql.bibleontology.com/sparql.jsp?sparql=" + query + "&type1=xml";
URL url;
Buffered... | public void copyFile(String from, String to) throws IOException {
FileChannel srcChannel = new FileInputStream(from).getChannel();
FileChannel dstChannel = new FileOutputStream(to).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
ds... | false |
2,637 | 11,627,705 | 10,443,091 | public static void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
... | public boolean validateZipFile(File zipFile) {
String tempdir = Config.CONTEXT.getRealPath(getBackupTempFilePath());
try {
deleteTempFiles();
File ftempDir = new File(tempdir);
ftempDir.mkdirs();
File tempZip = new File(tempdir + File.separator + zipFi... | true |
2,638 | 9,977,165 | 16,944,401 | protected void setUp() throws Exception {
this.testOutputDirectory = new File(getClass().getResource("/").getPath());
this.pluginFile = new File(this.testOutputDirectory, "/plugin.zip");
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(pluginFile));
zos.putNextEntry(new... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel.size(), destinationChanne... | true |
2,639 | 22,556,550 | 15,129,123 | private void copyFiles(File oldFolder, File newFolder) {
for (File fileToCopy : oldFolder.listFiles()) {
File copiedFile = new File(newFolder.getAbsolutePath() + "\\" + fileToCopy.getName());
try {
FileInputStream source = new FileInputStream(fileToCopy);
... | public String doGet() throws MalformedURLException, IOException {
uc = (HttpURLConnection) url.openConnection();
BufferedInputStream buffer = new BufferedInputStream(uc.getInputStream());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int c;
while ((c = buffer.read(... | false |
2,640 | 9,526,428 | 10,871,260 | public static String hashPassword(String password) {
String passwordHash = "";
try {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
sha1.reset();
sha1.update(password.getBytes());
Base64 encoder = new Base64();
passwordHash = new ... | public static final String getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
try {
localHost = InetAddress.getLo... | true |
2,641 | 7,142,334 | 4,598,940 | public byte[] getHTTPByte(String sUrl) {
HttpURLConnection connection = null;
InputStream inputStream = null;
ByteArrayOutputStream os = null;
try {
URL url = new URL(sUrl);
connection = (HttpURLConnection) url.openConnection();
connection.connect(... | public static void retrieveAttachments(RemoteAttachment[] attachments, String id, String projectName, String key, SimpleDateFormat formatter, java.sql.Connection connect) {
if (attachments.length != 0) {
for (RemoteAttachment attachment : attachments) {
attachmentAuthor = attachm... | false |
2,642 | 7,044,675 | 6,166,363 | public Object run() {
List correctUsers = (List) JsonPath.query("select * from ? where name=?", usersTable(), username);
if (correctUsers.size() == 0) {
return new LoginException("user " + username + " not found");
}
Persist... | private static byte[] gerarHash(String frase) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(frase.getBytes());
return md.digest();
} catch (Exception e) {
return null;
}
}
| true |
2,643 | 3,569,939 | 18,065,572 | public void connect() throws FTPException {
try {
ftp = new FTPClient();
ftp.connect(host);
if (FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
ftp.login(this.username, this.password);
} else {
ftp.disconnect();
... | public static String executePost(String urlStr, String content) {
StringBuffer result = new StringBuffer();
try {
Authentication.doIt();
URL url = new URL(urlStr);
System.out.println("Host: " + url.getHost());
HttpURLConnection connection = (HttpURLCon... | false |
2,644 | 18,708,933 | 8,212,984 | public APIResponse delete(String id) throws Exception {
APIResponse response = new APIResponse();
connection = (HttpURLConnection) new URL(url + "/api/user/delete/" + id).openConnection();
connection.setRequestMethod("DELETE");
connection.setConnectTimeout(TIMEOUT);
connectio... | private void readCard() {
try {
final String urlString = createURLStringExistRESTGetXQuery("//scheda[cata = \"" + cata + "\"]");
InputStream inputStream = new URL(urlString).openStream();
uiSchedaXml.read(inputStream);
inputStream.close();
} catch (Mal... | false |
2,645 | 16,289,496 | 11,904,056 | public static void reset() throws Exception {
Session session = DataStaticService.getHibernateSessionFactory().openSession();
try {
Connection connection = session.connection();
try {
Statement statement = connection.createStatement();
try {
... | public static void convertEncoding(File infile, File outfile, String from, String to) throws IOException, UnsupportedEncodingException {
InputStream in;
if (infile != null) in = new FileInputStream(infile); else in = System.in;
OutputStream out;
outfile.createNewFile();
if (o... | false |
2,646 | 12,670,642 | 5,260,867 | public boolean backupLastAuditSchema(File lastAuditSchema) {
boolean isBkupFileOK = false;
String writeTimestamp = DateFormatUtils.format(new java.util.Date(), configFile.getTimestampPattern());
File target = new File(configFile.getAuditSchemaFileDir() + File.separator + configFile.getAuditS... | public BufferedWriter createWriter(File outfile, String encoding) throws UnsupportedEncodingException, IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outfile));
zos.setMet... | true |
2,647 | 4,923,514 | 16,351,776 | public static void main(String[] args) {
if (args.length != 3) {
System.out.println("Usage: HexStrToBin enc/dec <infileName> <outfilename>");
System.exit(1);
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream in = new F... | 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 |
2,648 | 13,480,108 | 13,612,487 | public static String getStringResponse(String urlString) throws Exception {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
StringBuilder buffer = new StringBuilder();
while ((inputLine = in.read... | private ArrayList<String> loadProperties(String filename) throws DevFailed, IOException {
java.net.URL url = getClass().getResource(filename);
if (url == null) {
Except.throw_exception("LOAD_PROPERTY_FAILED", "URL for property file (" + filename + ") is null !", "PogoProperty.loadPropert... | true |
2,649 | 20,306,675 | 20,169,227 | public int delete(BusinessObject o) throws DAOException {
int delete = 0;
Bill bill = (Bill) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("DELETE_BILL"));
pst.setInt(1, bill.getId());
delete = pst.executeUpdate();
... | @Override
public String addUser(UserInfoItem user) throws DatabaseException {
if (user == null) throw new NullPointerException("user");
if (user.getSurname() == null || "".equals(user.getSurname())) throw new NullPointerException("user.getSurname()");
try {
getConnection().se... | true |
2,650 | 922,716 | 20,601,754 | private static String getDocumentAt(String urlString) {
StringBuffer html_text = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream... | public static File copyFile(File file, String dirName) {
File destDir = new File(dirName);
if (!destDir.exists() || !destDir.isDirectory()) {
destDir.mkdirs();
}
File src = file;
File dest = new File(dirName, src.getName());
try {
if (!dest.exi... | false |
2,651 | 5,606,566 | 430,971 | public boolean authenticate(String user, String pass) throws IOException {
MessageDigest hash = null;
try {
MessageDigest.getInstance("BrokenMD4");
} catch (NoSuchAlgorithmException x) {
throw new Error(x);
}
hash.update(new byte[4], 0, 4);
try... | public static void copyFile(File destFile, File src) throws IOException {
File destDir = destFile.getParentFile();
File tempFile = new File(destFile + "_tmp");
destDir.mkdirs();
InputStream is = new FileInputStream(src);
try {
FileOutputStream os = new FileOutputS... | false |
2,652 | 5,674,869 | 2,825,450 | public static String getHash(String text) {
if (text == null) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
byte[] hashedTextBytes = md.digest();
BigInteger hashedTextBigInteger = new BigInteger(1, ... | public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in... | false |
2,653 | 23,548,072 | 3,660,246 | public static boolean insert(final Cargo cargo) {
int result = 0;
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
if (c == null) {
return false;
}
try {
c.setAutoCommit(false);
final String sql = "in... | private Object query(String json) throws IOException, ParseException {
String envelope = "{\"qname1\":{\"query\":" + json + "}}";
String urlStr = MQLREADURL + "?queries=" + URLEncoder.encode(envelope, "UTF-8");
if (isDebugging()) {
if (echoRequest) System.err.println("Sending:" +... | false |
2,654 | 3,609,806 | 18,868,986 | private static String getData(String myurl) throws Exception {
System.out.println("getdata");
URL url = new URL(myurl);
uc = (HttpURLConnection) url.openConnection();
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String temp = "", k = "";
while ... | protected boolean registerFromFile(URI providerList) {
boolean registeredSomething = false;
InputStream urlStream = null;
try {
urlStream = providerList.toURL().openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream, "UTF-8"));
... | true |
2,655 | 3,493,863 | 4,787,102 | @Test
public void testDocumentDownloadKnowledgeBase() throws IOException {
if (uploadedKbDocumentID == null) {
fail("Document Upload Test should run first");
}
String downloadLink = GoogleDownloadLinkGenerator.generateTextDownloadLink(uploadedKbDocumentID);
URL url = ... | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
OutputStream output = getOutputStream();
if (cachedContent != null) {
output.write(cachedContent);
} else {
FileInputStream input = new FileInput... | false |
2,656 | 11,907,560 | 13,450,574 | public static String hash(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(text.getBytes());
byte[] digest = md.digest();
StringBuffer sb = new StringBuffer(digest.length * 2);
for (int i = 0; i < digest.lengt... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer(128);
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
}
try {
long time = System.curren... | true |
2,657 | 12,646,326 | 11,107,871 | private void weightAndPlaceClasses() {
int rows = getRows();
for (int curRow = _maxPackageRank; curRow < rows; curRow++) {
xPos = getHGap() / 2;
BOTLRuleDiagramNode[] rowObject = getObjectsInRow(curRow);
for (int i = 0; i < rowObject.length; i++) {
... | private static Reader getReader(String fname) throws IOException {
InputStream is;
if (isUrl(fname)) {
URL url = new URL(fname);
is = url.openStream();
} else {
is = new FileInputStream(fname);
}
if (fname.endsWith(".zip")) {
is... | false |
2,658 | 16,083,957 | 11,078,985 | protected void createValueListAnnotation(IProgressMonitor monitor, IPackageFragment pack, Map model) throws CoreException {
IProject pj = pack.getJavaProject().getProject();
QualifiedName qn = new QualifiedName(JstActivator.PLUGIN_ID, JstActivator.PACKAGE_INFO_LOCATION);
String location = pj... | public void run() {
OutputStream out = null;
InputStream in = null;
boolean success = false;
String absoluteFileName = "";
try {
String fileName = getFileName(softwareLocation);
File downloadFolder = new File(Properties.downloadFolder);
if ... | false |
2,659 | 1,008,325 | 1,966,262 | 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... | 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 |
2,660 | 4,076,629 | 228,925 | public void uploadFile(String filename) throws RQLException {
checkFtpClient();
OutputStream out = null;
try {
out = ftpClient.storeFileStream(filename);
IOUtils.copy(new FileReader(filename), out);
out.close();
ftpClient.completePendingCommand... | 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 |
2,661 | 12,229,175 | 11,032,545 | public static void fileCopy(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(sourceFile);
fos = new ... | @Test
public void testCopyOverSize() throws IOException {
final InputStream in = new ByteArrayInputStream(TEST_DATA);
final ByteArrayOutputStream out = new ByteArrayOutputStream(TEST_DATA.length);
final int cpySize = ExtraIOUtils.copy(in, out, TEST_DATA.length + Long.SIZE);
asser... | true |
2,662 | 22,625,096 | 7,655,679 | public void run() {
long starttime = (new Date()).getTime();
Matcher m = Pattern.compile("(\\S+);(\\d+)").matcher(Destination);
boolean completed = false;
if (OutFile.length() > IncommingProcessor.MaxPayload) {
logger.warn("Payload is too large!");
close();
... | public static void copy(String sourceName, String destName) throws IOException {
File src = new File(sourceName);
File dest = new File(destName);
BufferedInputStream source = null;
BufferedOutputStream destination = null;
byte[] buffer;
int bytes_read;
long by... | true |
2,663 | 20,749,219 | 3,430,781 | public static void copyFile(File from, File to) throws FileNotFoundException, IOException {
requireFile(from);
requireFile(to);
if (to.isDirectory()) {
to = new File(to, getFileName(from));
}
FileChannel sourceChannel = new FileInputStream(from).getChannel();
... | public static String getTextFromPart(Part part) {
try {
if (part != null && part.getBody() != null) {
InputStream in = part.getBody().getInputStream();
String mimeType = part.getMimeType();
if (mimeType != null && MimeUtility.mimeTypeMatches(mimeTy... | true |
2,664 | 9,261,908 | 93,208 | public NamedList<Object> request(final SolrRequest request, ResponseParser processor) throws SolrServerException, IOException {
HttpMethod method = null;
InputStream is = null;
SolrParams params = request.getParams();
Collection<ContentStream> streams = requestWriter.getContentStream... | 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 |
2,665 | 8,236,587 | 14,275,711 | public void contextInitialized(ServletContextEvent event) {
try {
String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) {
URL url = new URL("http://localhost/");
URLConnection urlConn = url.openC... | private void initSerializerFiles(String fileName, HashSet<String> fileList, HashMap<Class, Class> classMap, Class type) {
try {
ClassLoader classLoader = getClassLoader();
if (classLoader == null) return;
Enumeration iter;
iter = classLoader.getResources(fileN... | false |
2,666 | 5,976,298 | 5,084,177 | public static String generateMD5(String str) {
String hashword = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(str.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
hashword = hash.toString(16);
} ca... | protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletConfig config = getServletConfig();
ServletContext context = config.getServletContext();
try {
String driver = context.getInitParameter("driver");... | true |
2,667 | 18,115,173 | 2,126,181 | private void copy(File in, File out) {
log.info("Copying yam file from: " + in.getName() + " to: " + out.getName());
try {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), o... | public void test_digest() throws UnsupportedEncodingException {
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA");
assertNotNull(sha);
} catch (NoSuchAlgorithmException e) {
fail("getInstance did not find algorithm");
}
... | false |
2,668 | 10,392,922 | 16,706,229 | public static void copyCompletely(InputStream input, OutputStream output) throws IOException {
if ((output instanceof FileOutputStream) && (input instanceof FileInputStream)) {
try {
FileChannel target = ((FileOutputStream) output).getChannel();
FileChannel source... | private void copy(File srouceFile, File destinationFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(srouceFile).getChannel();
FileChannel destinationChannel = new FileOutputStream(destinationFile).getChannel();
destinationChannel.transferFrom(sourceChannel, 0, sourc... | true |
2,669 | 17,520,336 | 15,895,682 | private void validateODFDoc(String url, String ver, ValidationReport commentary) throws IOException, MalformedURLException {
logger.debug("Beginning document validation ...");
synchronized (ODFValidationSession.class) {
PropertyMapBuilder builder = new PropertyMapBuilder();
S... | protected static Certificate[] getCurrentCertificates() throws Exception {
Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates();
if (certificate == null) {
URL location = AppletLoader.class.getProtectionDomain().getCodeSource().getLocatio... | false |
2,670 | 14,166,864 | 6,439,640 | private void send(java.awt.event.ActionEvent evt) {
String url = this.getURL();
if (url != null) {
String tinyurl = "";
try {
URLConnection conn = new URL("http://tinyurl.com/api-create.php?url=" + url).openConnection();
conn.setDoInput(true);
... | public Properties load() {
Properties lvProperties = new Properties();
try {
InputStream lvInputStream = url.openStream();
lvProperties.load(lvInputStream);
} catch (Exception e) {
throw new PropertiesLoadException("Error in load-method:", e);
}
... | false |
2,671 | 210,006 | 8,568,973 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public BasePolicy(String flaskPath) throws Exception {
SWIGTYPE_p_p_policy p_p_pol = apol.new_policy_t_p_p();
if (!flaskPath.endsWith("/")) flaskPath += "/";
File tmpPolConf = File.createTempFile("tmpBasePolicy", ".conf");
BufferedWriter tmpPolFile = new BufferedWriter(new FileWriter... | true |
2,672 | 18,098,931 | 13,812,091 | public static final void main(String[] args) throws FileNotFoundException, IOException {
ArrayList<String[]> result = new ArrayList<String[]>();
IStream is = new StreamImpl();
IOUtils.copy(new FileInputStream("H:\\7-项目预算表.xlsx"), is.getOutputStream());
int count = loadExcel(result, i... | public static void copyFile(IPath fromFileName, IPath toFileName) throws IOException {
File fromFile = fromFileName.toFile();
File toFile = toFileName.toFile();
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | true |
2,673 | 9,705,209 | 4,886,971 | public static void main(String[] args) throws Exception {
PatternLayout pl = new PatternLayout("%d{ISO8601} %-5p %c: %m\n");
ConsoleAppender ca = new ConsoleAppender(pl);
Logger.getRoot().addAppender(ca);
Logger.getRoot().setLevel(Level.INFO);
Options options = new Options();... | private static void copyFile(String srFile, String dtFile) {
try {
File f1 = new File(srFile);
File f2 = new File(dtFile);
InputStream in = new FileInputStream(f1);
OutputStream out = new FileOutputStream(f2);
byte[] buf = new byte[1024];
... | true |
2,674 | 9,399,634 | 13,665,830 | protected static String fileName2md5(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(input.getBytes("iso-8859-1"));
byte[] byteHash = md.digest();
md.reset();
StringBuffer resultString = ... | public static void main(String[] args) {
Usage u = new ccngetmeta();
for (int i = 0; i < args.length - 3; i++) {
if (!CommonArguments.parseArguments(args, i, u)) {
u.usage();
System.exit(1);
}
if (CommonParameters.startArg > i + 1) ... | false |
2,675 | 7,132,185 | 7,825,860 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void testAutoIncrement() {
final int count = 3;
final Object lock = new Object();
for (int i = 0; i < count; i++) {
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
... | false |
2,676 | 1,655,162 | 1,543,361 | public boolean updatenum(int num, String pid) {
boolean flag = false;
Connection conn = null;
PreparedStatement pm = null;
try {
conn = Pool.getConnection();
conn.setAutoCommit(false);
pm = conn.prepareStatement("update addwuliao set innum=? where ... | public ProgramSymbol createNewProgramSymbol(int programID, String module, String symbol, int address, int size) throws AdaptationException {
ProgramSymbol programSymbol = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
... | true |
2,677 | 10,013,939 | 2,617,135 | public Object execute(ExecutionEvent event) throws ExecutionException {
try {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
QuizTreeView view = (QuizTreeView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.rcpquizen... | public static String generate(String documentSelector) {
if (documentSelector == null) {
return null;
}
String date = Long.toString(System.currentTimeMillis());
try {
MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM);
md.update(documentS... | true |
2,678 | 10,718,506 | 18,317,332 | public void update() {
if (url == null) {
throw new IllegalArgumentException("URL cannot be null!");
}
try {
URLConnection urlConnection = url.openConnection();
urlConnection.setRequestProperty("User-Agent", Settings.INSTANCE.getUserAgent());
S... | void execute(Connection conn, Component parent, String context, final ProgressMonitor progressMonitor, ProgressWrapper progressWrapper) throws Exception {
int noOfComponents = m_components.length;
Statement statement = null;
StringBuffer pmNoteBuf = new StringBuffer(m_update ... | false |
2,679 | 14,879,478 | 12,044,335 | 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 ((... | JcrFile createBody(Part part) throws IOException, MessagingException {
JcrFile body = new JcrFile();
body.setName("part");
ByteArrayOutputStream pout = new ByteArrayOutputStream();
IOUtils.copy(part.getInputStream(), pout);
body.setDataProvider(new JcrDataProviderImpl(TYPE.BY... | true |
2,680 | 2,390,396 | 11,103,449 | @Override
protected void processImport() throws SudokuInvalidFormatException {
importFolder(mUri.getLastPathSegment());
try {
URL url = new URL(mUri.toString());
InputStreamReader isr = new InputStreamReader(url.openStream());
BufferedReader br = null;
... | @Override
public void run() {
try {
IOUtils.copy(_is, processOutStr);
} catch (final IOException ioe) {
proc.destroy();
} finally {
IOUtils.closeQuietly(_is);
IOUtils.closeQuietly(processOutStr);
... | false |
2,681 | 87,685 | 10,109,343 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | public void readData() throws IOException {
i = 0;
j = 0;
URL url = getClass().getResource("resources/tuneGridMaster.dat");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
s = b... | true |
2,682 | 23,403,205 | 272,444 | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | public static void main(String[] args) {
boolean rotateLeft = false;
boolean rotateRight = false;
boolean exclude = false;
boolean reset = false;
float quality = 0f;
int thumbArea = 12000;
for (int i = 0; i < args.length; i++) {
if (args[i].equals(... | false |
2,683 | 2,481,505 | 10,062,074 | @Override
public void run() {
try {
File[] inputFiles = new File[this.previousFiles != null ? this.previousFiles.length + 1 : 1];
File copiedInput = new File(this.randomFolder, this.inputFile.getName());
IOUtils.copyFile(this.inputFile, copiedInput);
input... | private long generateUnixInstallShell(File unixShellFile, String instTemplate, File instClassFile) throws IOException {
FileOutputStream byteWriter = new FileOutputStream(unixShellFile);
InputStream is = getClass().getResourceAsStream("/" + instTemplate);
InputStreamReader isr = new InputStr... | true |
2,684 | 3,375,714 | 6,596,328 | public void importarHistoricoDeCotacoesDosPapeis(File[] pArquivosTXT, boolean pApagarDadosImportadosAnteriormente, Andamento pAndamento) throws FileNotFoundException, SQLException {
if (pApagarDadosImportadosAnteriormente) {
Statement stmtLimpezaInicialDestino = conDestino.createStatement();
... | public static String getSHA1Hash(String plainText) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA1");
md.update(plainText.getBytes());
byte[] mdbytes = md.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < mdbytes.l... | false |
2,685 | 19,197,300 | 21,382,198 | private void writeStatsToDatabase(long transferJobAIPCount, long reprocessingJobAIPCount, long transferJobAIPVolume, long reprocessingJobAIPVolume, long overallBinaryAIPCount, Map<String, AIPStatistics> mimeTypeRegister) throws SQLException {
int nextAIPStatsID;
long nextMimetypeStatsID;
Sta... | private void initializeTree() {
InputStreamReader reader = null;
BufferedReader buffReader = null;
try {
for (int i = 0; i < ORDER.length; i++) {
int index = ORDER[i];
String indexName = index < 10 ? "0" + index : (index > 20 ? "big" : "" + index);... | false |
2,686 | 23,611,030 | 8,300,620 | @Override
public CasAssembly build() {
try {
prepareForBuild();
File casWorkingDirectory = casFile.getParentFile();
DefaultCasFileReadIndexToContigLookup read2contigMap = new DefaultCasFileReadIndexToContigLookup();
AbstractDefaultCasFileLookup readIdLooku... | @Override
public void copierPhotos(FileInputStream fichierACopier, FileOutputStream fichierDestination) {
FileChannel in = null;
FileChannel out = null;
try {
in = fichierACopier.getChannel();
out = fichierDestination.getChannel();
in.transferTo(0, in.... | true |
2,687 | 16,366,790 | 5,851,660 | public String load(URL url) throws LoaderException {
log.debug("loading content");
log.trace("opening connection: " + url);
BufferedReader in = null;
URLConnection conn = null;
try {
conn = url.openConnection();
in = null;
if (encodedProxyL... | public static String genetateSHA256(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes("UTF-8"));
byte[] passWd = md.digest();
String hex = toHex(passWd);
return... | false |
2,688 | 6,902,534 | 20,273,405 | public void doAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
String attachmentName = request.getParameter("attachment");
String virtualWiki = getVirtualWiki(request);
File uploadPath = getEnvironment().uploadPath(virtualWiki, attachmentName);
resp... | 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... | true |
2,689 | 16,050,015 | 19,880,277 | public static void downloadFile(String htmlUrl, String dirUrl) {
try {
URL url = new URL(htmlUrl);
System.out.println("Opening connection to " + htmlUrl + "...");
URLConnection urlC = url.openConnection();
InputStream is = url.openStream();
Date da... | private void postUrl() throws Exception {
String authors = "";
for (String auth : plugin.getDescription().getAuthors()) {
authors = authors + " " + auth;
}
authors = authors.trim();
String url = String.format("http://bukkitstats.randomappdev.com/ping.aspx?snam=%s&... | false |
2,690 | 18,688,737 | 11,090,448 | private void loadMascotLibrary() {
if (isMascotLibraryLoaded) return;
try {
boolean isLinux = false;
boolean isAMD64 = false;
String mascotLibraryFile;
if (Configurator.getOSName().toLowerCase().contains("linux")) {
isLinux = true;
... | public static Object fetchCached(String address, int hours) throws MalformedURLException, IOException {
String cacheName = md5(address);
checkAndCreateDirectoryIfNeeded();
File r = new File(CACHELOCATION + cacheName);
Date d = new Date();
long limit = d.getTime() - (1000 * 60... | true |
2,691 | 12,296,632 | 2,215,295 | public boolean check(Object credentials) {
try {
byte[] digest = null;
if (credentials instanceof Password || credentials instanceof String) {
synchronized (__md5Lock) {
if (__md == null) __md = MessageDigest.getInstance("MD... | static ConversionMap create(String file) {
ConversionMap out = new ConversionMap();
URL url = ConversionMap.class.getResource("data/" + file);
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = in.readLine();
... | false |
2,692 | 14,050,303 | 1,760,353 | public int subclass(int objectId, String description) throws FidoDatabaseException, ObjectNotFoundException {
try {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
String sql = "insert into Objects (Description) " + "v... | public static int deleteSysPosInsert() {
Connection conn = null;
PreparedStatement psmt = null;
StringBuffer SQL = new StringBuffer(200);
int deleted = 0;
SQL.append(" DELETE FROM JHF_SYS_POSITION_INSERT ");
try {
conn = JdbcConnectionPool.mainConnection()... | true |
2,693 | 21,320,070 | 20,815,136 | public static void copy(File from_file, File to_file) throws IOException {
if (!from_file.exists()) {
throw new IOException("FileCopy: no such source file: " + from_file.getPath());
}
if (!from_file.isFile()) {
throw new IOException("FileCopy: can't copy directory: " ... | public static void copyTo(File src, File dest) throws IOException {
if (src.equals(dest)) throw new IOException("copyTo src==dest file");
FileOutputStream fout = new FileOutputStream(dest);
InputStream in = new FileInputStream(src);
IOUtils.copyTo(in, fout);
fout.flush();
... | true |
2,694 | 16,375,558 | 13,824,827 | private void sort() {
for (int i = 0; i < density.length; i++) {
for (int j = density.length - 2; j >= i; j--) {
if (density[j] > density[j + 1]) {
KDNode n = nonEmptyNodesArray[j];
nonEmptyNodesArray[j] = nonEmptyNodesArray[j + 1];
... | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | false |
2,695 | 6,371,592 | 10,852,631 | public void deleteUser(final List<Integer> userIds) {
try {
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
@Override
public void executeProcessReturnNull() thro... | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
final StringBuilder sbValueBeforeMD5 = new StringBuilder();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.fatal("", e);
return;
... | false |
2,696 | 8,660,836 | 14,566,265 | public void transform(String style, String spec, OutputStream out) throws IOException {
URL url = new URL(rootURL, spec);
InputStream in = new PatchXMLSymbolsStream(new StripDoctypeStream(url.openStream()));
transform(style, in, out);
in.close();
}
| public I18N(JApplet applet) {
if (prop != null) {
return;
}
String lang = "de";
try {
Properties userProperties = new Properties();
if (applet != null) {
URL url = new URL(applet.getCodeBase() + xConfigPath + "ElementDesigner.cfg");... | false |
2,697 | 8,660,836 | 18,161,428 | public void transform(String style, String spec, OutputStream out) throws IOException {
URL url = new URL(rootURL, spec);
InputStream in = new PatchXMLSymbolsStream(new StripDoctypeStream(url.openStream()));
transform(style, in, out);
in.close();
}
| private String getAuthUrlString(String account, String password) throws IOException, NoSuchAlgorithmException {
Map<String, String> dict = retrieveLoginPage();
if (dict == null) {
return null;
}
StringBuilder url = new StringBuilder("/config/login?login=");
url.ap... | false |
2,698 | 11,319,480 | 15,593,678 | 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.... | private static void copyFile(File in, File out) throws Exception {
final FileInputStream input = new FileInputStream(in);
try {
final FileOutputStream output = new FileOutputStream(out);
try {
final byte[] buf = new byte[4096];
int readBytes = ... | true |
2,699 | 14,347,882 | 5,456,371 | public void load(boolean isOrdered) throws ResourceInstantiationException {
try {
if (null == url) {
throw new ResourceInstantiationException("URL not specified (null).");
}
BufferedReader listReader;
listReader = new BomStrippingInputStreamRea... | public MapInfo loadLocalMapData(String fileName) {
MapInfo info = mapCacheLocal.get(fileName);
if (info != null && info.getContent() == null) {
try {
BufferedReader bufferedreader;
URL fetchUrl = new URL(localMapContextUrl, fileName);
URLCo... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.