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 |
|---|---|---|---|---|---|
899,100 | 8,139,665 | 23,574,216 | public ActionResponse executeAction(ActionRequest request) throws Exception {
BufferedReader in = null;
try {
CurrencyEntityManager em = new CurrencyEntityManager();
String id = (String) request.getProperty("ID");
CurrencyMonitor cm = getCurrencyMonitor(em, Long.v... | public static void copyFile(File fromFile, File toFile) throws OWFileCopyException {
try {
FileChannel src = new FileInputStream(fromFile).getChannel();
FileChannel dest = new FileOutputStream(toFile).getChannel();
dest.transferFrom(src, 0, src.size());
src.cl... | false |
899,101 | 2,831,663 | 22,619,332 | public void onMessage(Message message) {
LOG.debug("onMessage");
DownloadMessage downloadMessage;
try {
downloadMessage = new DownloadMessage(message);
} catch (JMSException e) {
LOG.error("JMS error: " + e.getMessage(), e);
return;
}
... | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
LOG.debug("copying file");
String tTempFileName = this.getTempDir() + "uploaded-file.tmp";
IOUtils.copy(pDeposit.getFile(), new FileOutputStream(tTempFileName));
Datastrea... | true |
899,102 | 5,545,050 | 19,950,034 | public void sendFile(File file, String filename, String contentType) throws SearchLibException {
response.setContentType(contentType);
response.addHeader("Content-Disposition", "attachment; filename=" + filename);
FileInputStream inputStream = null;
try {
inputStream = ne... | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | true |
899,103 | 18,570,191 | 5,671,690 | public RawCandidate getRawCandidate(long candId) throws BookKeeprCommunicationException {
try {
synchronized (httpClient) {
HttpGet req = new HttpGet(remoteHost.getUrl() + "/cand/" + Long.toHexString(candId));
req.setHeader("Accept-Encoding", "gzip");
... | @Override
public void backup() {
Connection connection = null;
PreparedStatement prestm = null;
try {
if (logger.isInfoEnabled()) logger.info("backup table " + getOrigin() + " start...");
Class.forName(driver);
connection = DriverManager.getConnection(... | false |
899,104 | 19,780,094 | 636,262 | protected PTask commit_result(Result r, SyrupConnection con) throws Exception {
try {
int logAction = LogEntry.ENDED;
String kk = r.context().task().key();
if (r.in_1_consumed() && r.context().in_1_link() != null) {
sqlImpl().updateFunctions().updateInLink... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
899,105 | 98,428 | 10,009,723 | public static XMLShowInfo NzbSearch(TVRageShowInfo tvrage, XMLShowInfo xmldata, int latestOrNext) {
String newzbin_query = "", csvData = "", hellaQueueDir = "", newzbinUsr = "", newzbinPass = "";
String[] tmp;
DateFormat tvRageDateFormat = new SimpleDateFormat("MMM/dd/yyyy");
DateFor... | @Override
public File fetchHSMFile(String fsID, String filePath) throws HSMException {
log.debug("fetchHSMFile called with fsID=" + fsID + ", filePath=" + filePath);
if (absIncomingDir.mkdirs()) {
log.info("M-WRITE " + absIncomingDir);
}
File tarFile;
try {
... | false |
899,106 | 7,464,993 | 17,456,433 | @Override
public void alterar(QuestaoDiscursiva q) throws Exception {
System.out.println("ALTERAR " + q.getIdQuestao());
PreparedStatement stmt = null;
String sql = "UPDATE questao SET id_disciplina=?, enunciado=?, grau_dificuldade=? WHERE id_questao=?";
try {
stmt = ... | public static boolean isSameHttpContent(final String url, final File localFile, UsernamePasswordCredentials creds) throws IOException {
if (localFile.isFile()) {
long localContentLength = localFile.length();
long localLastModified = localFile.lastModified() / 1000;
long c... | false |
899,107 | 13,682,237 | 13,546,467 | private void generate(String salt) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.error("No MD5", e);
}
long time = Sys... | private FTPClient getClient() throws SocketException, IOException {
FTPClient ftp = new FTPClient();
ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
ftp.setDefaultPort(getPort());
ftp.connect(getIp());
int reply = ftp.getReplyCode();
... | false |
899,108 | 2,217,508 | 15,873,054 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (destFile.getParentFile() != null && !destFile.getParentFile().mkdirs()) {
LOG.error("GeneralHelper.copyFile(): Cannot create parent directories from " + destFile);
}
FileInputStream f... | public static final long copyFile(final File srcFile, final File dstFile, final long cpySize) throws IOException {
if ((null == srcFile) || (null == dstFile)) return (-1L);
final File dstFolder = dstFile.getParentFile();
if ((!dstFolder.exists()) && (!dstFolder.mkdirs())) throw new IOExcepti... | true |
899,109 | 12,876,684 | 2,069,219 | 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 void copieFichier(File fichier1, File fichier2) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(fichier1).getChannel();
out = new FileOutputStream(fichier2).getChannel();
in.transferTo(0, in.size(), out);
... | false |
899,110 | 23,047,155 | 592,597 | @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()) {
... | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnRegister) {
Error.log(6002, "Bot�o cadastrar pressionado por " + login + ".");
if (nameUser.getText().compareTo("") == 0) {
JOptionPane.showMessageDialog(null, "... | false |
899,111 | 4,314,597 | 13,496,394 | public void run() {
StringBuffer messageStringBuffer = new StringBuffer();
messageStringBuffer.append("Program: \t" + UpdateChannel.getCurrentChannel().getApplicationTitle() + "\n");
messageStringBuffer.append("Version: \t" + Lister.version + "\n");
messageStringBuffer.append("Revisi... | @Override
protected ResourceHandler doGet(final URI resourceUri) throws ResourceException {
if (resourceUri.getHost() == null) {
throw new IllegalStateException(InternalBundleHelper.StoreMessageBundle.getMessage("store.uri.ftp.illegal", resourceUri.toString()));
}
try {
... | false |
899,112 | 18,048,836 | 417,300 | public void modify(ModifyInterceptorChain chain, DistinguishedName dn, ArrayList<LDAPModification> mods, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + this.dbInsertName);
if (con == null) {
throw new LDAP... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | false |
899,113 | 359,113 | 17,226,920 | public static void bubbleSort(String[] a) {
Collator myCollator = Collator.getInstance();
boolean switched = true;
for (int pass = 0; pass < a.length - 1 && switched; pass++) {
switched = false;
for (int i = 0; i < a.length - pass - 1; i++) {
if (myCol... | public void setUrl(URL url) throws PDFException, PDFSecurityException, IOException {
InputStream in = null;
try {
URLConnection urlConnection = url.openConnection();
in = urlConnection.getInputStream();
String pathOrURL = url.toString();
setInputStream... | false |
899,114 | 7,169,017 | 16,579,945 | private void download(String fileName, HttpServletResponse response) throws IOException {
TelnetInputStream ftpIn = ftpClient_sun.get(fileName);
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
OutputStream out = null;
try {
... | public he3Decode(String in_file) {
try {
File out = new File(in_file + extension);
File in = new File(in_file);
int file_size = (int) in.length();
FileInputStream in_stream = new FileInputStream(in_file);
out.createNewFile();
FileOutput... | true |
899,115 | 5,553,346 | 6,098,865 | public static JsonNode getJSONFromURL(String httpUrl) throws Exception {
URL url;
InputStream inputStream = null;
DataInputStream dataInputStream;
try {
url = new URL(httpUrl);
inputStream = url.openStream();
dataInputStream = new DataInputStream(n... | private ScrollingGraphicalViewer createGraphicalViewer(final Composite parent) {
final ScrollingGraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(parent);
_root = new ScalableRootEditPart();
viewer.setRootEditPart(_root);
getEditDomain().addViewer(... | false |
899,116 | 10,658,266 | 7,343,430 | public static void copy(File srcFile, File destFile) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile);
final byte[] buf = new byte[4096];
... | protected boolean writeFile(Interest outstandingInterest) throws IOException {
File fileToWrite = ccnNameToFilePath(outstandingInterest.name());
Log.info("CCNFileProxy: extracted request for file: " + fileToWrite.getAbsolutePath() + " exists? ", fileToWrite.exists());
if (!fileToWrite.exists... | true |
899,117 | 22,303,544 | 21,266,147 | @Test
public void testWriteAndRead() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
R... | 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 |
899,118 | 16,553,582 | 21,781,575 | public QueryResult doSearch(String searchTerm, Integer searchInReceivedItems, Integer searchInSentItems, Integer searchInSupervisedItems, Integer startRow, Integer resultCount, Boolean searchArchived, Boolean searchInItemsNeededAttentionOnly) throws UnsupportedEncodingException, IOException {
String session... | private String loadSchemas() {
StringWriter writer = new StringWriter();
try {
IOUtils.copy(CoreOdfValidator.class.getResourceAsStream("schema_list.properties"), writer);
} catch (IOException e) {
e.printStackTrace();
}
return writer.toString();
}
| false |
899,119 | 6,847,452 | 11,158,190 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String act = request.getParameter("act");
if (null == act) {
} else if ("down".equalsIgnoreCase(act)) {
String vest = request.getParam... | public static void copyFile(String fromPath, String toPath) {
try {
File inputFile = new File(fromPath);
String dirImg = (new File(toPath)).getParent();
File tmp = new File(dirImg);
if (!tmp.exists()) {
tmp.mkdir();
}
Fi... | true |
899,120 | 2,090,332 | 20,612,707 | private void doProcess(HttpServletRequest request, HttpServletResponse resp) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
Analyzer analyzer = new Analyzer();
ServletContext context = getServletContext();
String xml = context.getRe... | public Vector decode(final URL url) throws IOException {
LineNumberReader reader;
if (owner != null) {
reader = new LineNumberReader(new InputStreamReader(new ProgressMonitorInputStream(owner, "Loading " + url, url.openStream())));
} else {
reader = new LineNumberRead... | false |
899,121 | 10,392,922 | 10,912,336 | 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... | public void verRecordatorio() {
try {
cantidadArchivos = obtenerCantidad() + 1;
boolean existe = false;
String filenametxt = "";
String filenamezip = "";
String hora = "";
String lugar = "";
String actividad = "";
... | true |
899,122 | 2,770,143 | 6,871,526 | protected static String readAFewChars(URL url) throws IOException {
StringBuffer buf = new StringBuffer(10);
Reader reader = new InputStreamReader(url.openStream());
for (int i = 0; i < 10; i++) {
int c = reader.read();
if (c == -1) {
break;
... | private boolean cacheUrlFile(String filePath, String realUrl, boolean isOnline) {
try {
URL url = new URL(realUrl);
String encoding = "gbk";
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), encoding));
StringBuilder sb = new Strin... | false |
899,123 | 15,153,344 | 800,221 | public ActualTask(TEditor editor, TIGDataBase dataBase, String directoryPath) {
File myDirectory = new File(directoryPath);
int i;
Vector images = new Vector();
images = dataBase.allImageSearch();
lengthOfTask = images.size() * 2;
String di... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
899,124 | 4,453,922 | 20,149,832 | public static void request() {
try {
URL url = new URL("http://www.nseindia.com/marketinfo/companyinfo/companysearch.jsp?cons=ghcl§ion=7");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
BufferedReader rd = new BufferedReader(new InputS... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
try {
URL url = new URL("http://placekitten.com/g/500/250");
HttpURLConnectio... | false |
899,125 | 8,714,262 | 23,398,709 | public void readBooklist(String filename) {
Reader input = null;
try {
if (filename.startsWith("http:")) {
URL url = new URL(filename);
URLConnection conn = url.openConnection();
input = new InputStreamReader(conn.getInputStream());
... | public ArrayList<Tweet> getTimeLine() {
try {
HttpGet get = new HttpGet("http://api.linkedin.com/v1/people/~/network/updates?scope=self");
consumer.sign(get);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
... | false |
899,126 | 16,744,397 | 8,637,246 | public void copyToZip(ZipOutputStream zout, String entryName) throws IOException {
close();
ZipEntry entry = new ZipEntry(entryName);
zout.putNextEntry(entry);
if (!isEmpty() && this.tmpFile.exists()) {
InputStream in = new FileInputStream(this.tmpFile);
IOUti... | @Override
public void setDocumentSpace(DocumentSpace space) {
for (Document doc : space) {
File result = new File(parent, doc.getName());
if (doc instanceof XMLDOMDocument) {
new PlainXMLDocumentWriter(result).writeDocument(doc);
} else if (doc instanc... | true |
899,127 | 7,408,304 | 17,468,430 | public static void main(String[] args) {
String u = "http://portal.acm.org/results.cfm?query=%28Author%3A%22" + "Boehm%2C+Barry" + "%22%29&srt=score%20dsc&short=0&source_disp=&since_month=&since_year=&before_month=&before_year=&coll=ACM&dl=ACM&termshow=matchboolean&range_query=&CFID=22704101&CFTOKEN=3782714... | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | false |
899,128 | 20,601,756 | 839,385 | public static File copyFile(String path) {
File src = new File(path);
File dest = new File(src.getName());
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
FileChann... | 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 |
899,129 | 2,965,996 | 661 | public static void main(String[] args) {
if (args.length != 2) {
System.out.println("Usage: HashCalculator <Algorithm> <Input>");
System.out.println("The preferred algorithm is SHA.");
} else {
MessageDigest md;
try {
md = MessageDigest... | 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 |
899,130 | 15,192,681 | 1,527,633 | public DataSetInfo(String request) throws AddeURLException {
URLConnection urlc;
BufferedReader reader;
debug = debug || request.indexOf("debug=true") >= 0;
try {
URL url = new URL(request);
urlc = url.openConnection();
reader = new BufferedReader(... | public String getWebcontent(final String link, final String postdata) {
final StringBuffer response = new StringBuffer();
try {
DisableSSLCertificateCheckUtil.disableChecks();
final URL url = new URL(link);
final URLConnection conn = url.openConnection();
... | false |
899,131 | 679,959 | 5,621,074 | 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 static void upper() throws Exception {
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(java.security.cert... | false |
899,132 | 19,867,423 | 7,604,737 | @Test
public void testPersistor() throws Exception {
PreparedStatement ps;
ps = connection.prepareStatement("delete from privatadresse");
ps.executeUpdate();
ps.close();
ps = connection.prepareStatement("delete from adresse");
ps.executeUpdate();
ps.close(... | public String get(String url) {
String buf = null;
StringBuilder resultBuffer = new StringBuilder(512);
if (debug.DEBUG) debug.logger("gov.llnl.tox.util.href", "get(url)>> " + url);
try {
URL theURL = new URL(url);
URLConnection urlConn = theURL.openConnection... | false |
899,133 | 3,634,782 | 7,839,811 | public static void main(String[] args) {
paraProc(args);
CanonicalGFF cgff = new CanonicalGFF(gffFilename);
CanonicalGFF geneModel = new CanonicalGFF(modelFilename);
CanonicalGFF transcriptGff = new CanonicalGFF(transcriptFilename);
TreeMap ksTable1 = getKsTable(ksTable1Filen... | public static String md5(String input) {
byte[] temp;
try {
MessageDigest messageDigest;
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(input.getBytes());
temp = messageDigest.digest();
} catch (Exception e) {
... | false |
899,134 | 10,432,256 | 12,448,713 | private void copyImage(ProjectElement e) throws Exception {
String fn = e.getName();
if (!fn.toLowerCase().endsWith(".png")) {
if (fn.contains(".")) {
fn = fn.substring(0, fn.lastIndexOf('.')) + ".png";
} else {
fn += ".png";
}
... | private void writeGif(String filename, String outputFile) throws IOException {
File file = new File(filename);
InputStream in = new FileInputStream(file);
FileOutputStream fout = new FileOutputStream(outputFile);
int totalRead = 0;
int readBytes = 0;
int blockSize = 6... | true |
899,135 | 16,064,530 | 19,565,153 | private void bubbleSort() {
for (int i = 0; i < testfield.length; i++) {
for (int j = 0; j < testfield.length - i - 1; j++) if (testfield[j] > testfield[j + 1]) {
short temp = testfield[j];
testfield[j] = testfield[j + 1];
testfield[j + 1] = temp;
... | private void copy(File fin, File fout) throws IOException {
FileOutputStream out = new FileOutputStream(fout);
FileInputStream in = new FileInputStream(fin);
byte[] buf = new byte[2048];
int read = in.read(buf);
while (read > 0) {
out.write(buf, 0, read);
... | false |
899,136 | 11,499,032 | 13,335,071 | private void outputSignedOpenDocument(byte[] signatureData) throws IOException {
LOG.debug("output signed open document");
OutputStream signedOdfOutputStream = getSignedOpenDocumentOutputStream();
if (null == signedOdfOutputStream) {
throw new NullPointerException("signedOpenDocu... | public static boolean copy(File source, File dest) {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in.map(FileChannel... | true |
899,137 | 4,076,627 | 17,662,458 | public void openFtpConnection(String workingDirectory) throws RQLException {
try {
ftpClient = new FTPClient();
ftpClient.connect(server);
ftpClient.login(user, password);
ftpClient.changeWorkingDirectory(workingDirectory);
} catch (IOException ioex) {... | public static String getHighlightBaseLib() throws Exception {
StringBuffer highlightKey = new StringBuffer();
highlightKey.append("<c color=\"" + COLOR_BASELIB + "\">\n\t");
URL url = AbstractRunner.class.getResource("baselib.js");
if (url != null) {
InputStream is = url.... | false |
899,138 | 20,109,527 | 523,070 | private void writeMessage(ChannelBuffer buffer, File dst) throws IOException {
ChannelBufferInputStream is = new ChannelBufferInputStream(buffer);
OutputStream os = null;
try {
os = new FileOutputStream(dst);
IOUtils.copyLarge(is, os);
} finally {
... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
899,139 | 18,752,957 | 7,020,500 | public static String getSHADigest(String input) {
if (input == null) return null;
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA-1");
} catch (java.security.NoSuchAlgorithmException nsae) {
throw new RuntimeException(nsae);
}
... | public static URL[] getURLsForAllJars(URL url, File tmpDir) {
FileInputStream fin = null;
InputStream in = null;
ZipInputStream zin = null;
try {
ArrayList array = new ArrayList();
in = url.openStream();
String fileName = url.getFile();
... | false |
899,140 | 16,961,459 | 11,821,056 | @Test
public void testConfigurartion() {
try {
Enumeration<URL> assemblersToRegister = this.getClass().getClassLoader().getResources("META-INF/PrintAssemblerFactory.properties");
log.debug("PrintAssemblerFactory " + SimplePrintJobTest.class.getClassLoader().getResource("META-INF/... | private void constructDialogContent(Composite parent) {
SashForm splitter = new SashForm(parent, SWT.HORIZONTAL);
splitter.setLayoutData(new GridData(GridData.FILL_BOTH));
Group fragmentsGroup = new Group(splitter, SWT.NONE);
fragmentsGroup.setLayout(new GridLayout(1, false));
... | false |
899,141 | 4,629,672 | 5,401,999 | public static String hexSHA1(String value) {
try {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
md.update(value.getBytes("utf-8"));
byte[] digest = md.digest();
return byteToHexString(digest);
} catch (Exception ex) {
... | @Override
protected void setUp() throws Exception {
super.setUp();
FTPConf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
FTPConf.setServerTimeZoneId("GMT");
FTP.configure(FTPConf);
try {
FTP.connect("tgftp.nws.noaa.gov");
FTP.login("anonymous",... | false |
899,142 | 22,224,116 | 7,839,474 | public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.out.println("Usage: \nGZIPcompress file\n" + "\tUses GZIP compression to compress " + "the file to test.gz");
System.exit(1);
}
BufferedReader in = new BufferedReader(new FileRe... | private Map<String, DomAttr> getAttributesFor(final BaseFrame frame) throws IOException {
final Map<String, DomAttr> map = createAttributesCopyWithClonedAttribute(frame, "src");
final DomAttr srcAttr = map.get("src");
if (srcAttr == null) {
return map;
}
final Pag... | true |
899,143 | 18,962,892 | 14,974,316 | public String control(final String allOptions) throws SQLException {
connect();
final Statement stmt = connection.createStatement();
final ResultSet rst1 = stmt.executeQuery("SELECT versionId FROM versions WHERE version='" + Concrete.version() + "'");
final long versionId;
if... | public void connect() throws ClientProtocolException, IOException {
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
inputStream = entity.getContent();
Header contentEncodingHeader = entity.getContentEncoding();
if (conten... | false |
899,144 | 19,279,420 | 7,872,668 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final FileManager fmanager = FileManager.getFileManager(request, leechget);
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter;
try {
... | private static boolean computeCustomerAverages(String completePath, String CustomerAveragesOutputFileName, String CustIndexFileName) {
try {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + CustIndexFileName);
FileChannel inC = new FileInputStream(inputFile).getC... | true |
899,145 | 16,199,085 | 10,177,034 | @Override
public byte[] read(String path) throws PersistenceException {
path = fmtPath(path);
try {
S3Object fileObj = s3Service.getObject(bucketObj, path);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(fileObj.getDataInputStream(), out... | public static synchronized BaseFont getL2BaseFont() {
if (l2baseFont == null) {
final ConfigProvider conf = ConfigProvider.getInstance();
try {
final ByteArrayOutputStream tmpBaos = new ByteArrayOutputStream();
String fontPath = conf.getNotEmptyPropert... | true |
899,146 | 22,654,851 | 5,706,528 | public static String getHashedPassword(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(password.getBytes());
BigInteger hashedInt = new BigInteger(1, digest.digest());
return String.format("%1$032X", hashedInt);
... | public void run() {
try {
URL url = new URL(myListURL);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
Pattern folderPattern = Pattern.compile(".*DIR.*<a href=.(.*)/.>(.*)</a>.*"... | false |
899,147 | 14,638,475 | 3,633,154 | public static String md5String(String string) {
try {
MessageDigest msgDigest = MessageDigest.getInstance("MD5");
msgDigest.update(string.getBytes("UTF-8"));
byte[] digest = msgDigest.digest();
String result = "";
for (int i = 0; i < digest.length;... | public static String getHash(String userName, String pass) {
String hash = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(userName.getBytes());
hash = ISOUtil.hexString(md.digest(pass.getBytes())).toLowerCase();
} catch (NoSuchA... | true |
899,148 | 4,056,446 | 13,771,944 | public final String hashRealmPassword(String username, String realm, String password) throws GeneralSecurityException {
MessageDigest md = null;
md = MessageDigest.getInstance("MD5");
md.update(username.getBytes());
md.update(":".getBytes());
md.update... | public static String generate(String username, String password) throws PersistenceException {
String output = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.reset();
md.update(username.getBytes());
md.update(password.getBytes()... | true |
899,149 | 19,691,919 | 23,161,666 | public static void main(String[] args) throws IOException {
FileChannel fc = new FileOutputStream("src/com/aaron/nio/data.txt").getChannel();
fc.write(ByteBuffer.wrap("dfsdf ".getBytes()));
fc.close();
fc = new RandomAccessFile("src/com/aaron/nio/data.txt", "rw").getChannel();
... | private boolean createFTPConnection() {
client = new FTPClient();
System.out.println("Client created");
try {
client.connect(this.hostname, this.port);
System.out.println("Connected: " + this.hostname + ", " + this.port);
client.login(username, password);
... | false |
899,150 | 5,090,669 | 23,383,764 | private static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel... | public 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... | true |
899,151 | 16,464,790 | 6,191,498 | private void fileCopy(final File src, final File dest) throws IOException {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChan... | private static void copySmallFile(final File sourceFile, final File targetFile) throws PtException {
LOG.debug("Copying SMALL file '" + sourceFile.getAbsolutePath() + "' to " + "'" + targetFile.getAbsolutePath() + "'.");
FileChannel inChannel = null;
FileChannel outChannel = null;
tr... | true |
899,152 | 16,797,551 | 3,608,828 | public boolean backup() {
try {
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String currentDBPath = "/data/android.bluebox/databases/bluebox.db";
String backupDBPath =... | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
String req1xml = jTextArea1.getText();
java.net.URL url = new java.net.URL("http://217.34.8.235:8080/newgenlibctxt/PatronServlet");
java.net.URLConnection urlconn = (java.net.URLConnection) url.o... | false |
899,153 | 6,371,609 | 9,656,103 | public void addUserToRealm(final NewUser user) {
try {
connection.setAutoCommit(false);
final String pass, salt;
final List<RealmWithEncryptedPass> realmPass = new ArrayList<RealmWithEncryptedPass>();
Realm realm;
String username;
usern... | private void removeCollection(long oid, Connection conn) throws XMLDBException {
try {
String sql = "DELETE FROM X_DOCUMENT WHERE X_DOCUMENT.XDB_COLLECTION_OID = ?";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, oid);
pstmt.executeUpda... | true |
899,154 | 11,275,834 | 7,901,579 | private void createHomeTab() {
Tabpanel homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, Msg.getMsg(EnvWeb.getCtx(), "Home").replaceAll("&", ""), false);
Portallayout portalLayout = new Portallayout();
portalLayout.setWidth("100%");
portalLayout.setHeight("100%");... | public static long writePropertiesInOpenXMLDocument(String ext, InputStream in, OutputStreamProvider outProvider, Map<String, String> properties) {
in = new BufferedInputStream(in);
try {
File tempPptx = null;
POIXMLDocument doc;
if (ext.toLowerCase().equals("docx... | false |
899,155 | 10,369,570 | 8,939,074 | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | public RawTableData(int selectedId) {
selectedProjectId = selectedId;
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetProjectDocuments";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "documents.xml";
try {
S... | true |
899,156 | 49,209 | 16,012,363 | private void makeConn(String filename1, String filename2) {
String basename = "http://www.bestmm.com/";
String urlname = basename + filename1 + "/pic/" + filename2 + ".jpg";
URL url = null;
try {
url = new URL(urlname);
} catch (MalformedURLException e) {
... | public static void main(String[] args) throws IOException {
String uri = "hdfs://localhost:8020/user/leeing/maxtemp/sample.txt";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.o... | false |
899,157 | 20,856,551 | 3,307,772 | public synchronized void checkout() throws SQLException, InterruptedException {
Connection con = this.session.open();
con.setAutoCommit(false);
String sql_stmt = DB2SQLStatements.shopping_cart_getAll(this.customer_id);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENS... | public void deleteScript(Integer id) {
InputStream is = null;
try {
URL url = new URL(strServlet + getSessionIDSuffix() + "?deleteScript=" + id);
System.out.println("requesting: " + url);
is = url.openStream();
while (is.read() != -1) ;
} catch... | false |
899,158 | 19,579,830 | 14,311,145 | public static void copy(File toCopy, File dest) throws IOException {
FileInputStream src = new FileInputStream(toCopy);
FileOutputStream out = new FileOutputStream(dest);
try {
while (src.available() > 0) {
out.write(src.read());
}
} finally {
... | public static void copyFile(File src, File dst) throws IOException {
LogUtil.d(TAG, "Copying file %s to %s", src, dst);
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(src).getChannel();
outChannel = new FileO... | true |
899,159 | 5,935,063 | 19,868,415 | public String generateKey(Message msg) {
String text = msg.getDefaultMessage();
String meaning = msg.getMeaning();
if (text == null) {
return null;
}
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgori... | 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... | true |
899,160 | 21,492,244 | 5,017,376 | private String getData(String myurl) throws Exception {
URL url = new URL(myurl);
uc = (HttpURLConnection) url.openConnection();
uc.setRequestProperty("Cookie", NetLoadAccount.getPhpsessioncookie());
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String ... | public static String md5(String str) {
StringBuffer buf = new StringBuffer();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] data = new byte[32];
md.update(str.getBytes(md5Encoding), 0, str.length());
data = md.digest();
... | false |
899,161 | 47,337 | 15,503,077 | 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 ArrayList execAtParentServer(ArrayList paramList) throws Exception {
ArrayList outputList = null;
String message = "";
try {
HashMap serverUrlMap = InitXml.getInstance().getServerMap();
Iterator it = serverUrlMap.keySet().iterator();
while (it.hasNext(... | false |
899,162 | 3,253,027 | 18,207,261 | private static void addFile(File file, TarArchiveOutputStream taos) throws IOException {
String filename = null;
filename = file.getName();
TarArchiveEntry tae = new TarArchiveEntry(filename);
tae.setSize(file.length());
taos.putArchiveEntry(tae);
FileInputStream fis ... | private RemoteObject createRemoteObject(final VideoEntry videoEntry, final RemoteContainer container) throws RemoteException {
MessageDigest instance;
try {
instance = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RemoteException(S... | false |
899,163 | 11,012,490 | 6,596,328 | private void execute(String file, String[] ebms, String[] eems, String[] ims, String[] efms) throws BuildException {
if (verbose) {
System.out.println("Preprocessing file " + file + " (type: " + type + ")");
}
try {
File targetFile = new File(file);
FileRe... | 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 |
899,164 | 21,302,551 | 10,315,215 | public static Document convertHtmlToXml(final InputStream htmlInputStream, final String classpathXsltResource, final String encoding) {
Parser p = new Parser();
javax.xml.parsers.DocumentBuilder db;
try {
db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuil... | public final void testT4CClientWriter() throws Exception {
InputStream is = ClassLoader.getSystemResourceAsStream(this.testFileName);
T4CClientReader reader = new T4CClientReader(is, rc);
File tmpFile = File.createTempFile("barde", ".log", this.tmpDir);
System.out.println("tmp=" + tm... | true |
899,165 | 3,533,514 | 14,789,933 | public boolean saveVideoXMLOnWebserver() {
String text = "";
boolean erg = false;
try {
URL url = new URL("http://localhost:8080/virtPresenterVerwalter/videofile.jsp?id=" + this.getId());
HttpURLConnection http = (HttpURLConnection) url.openConnection();
B... | public static String stringToHash(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Shoul... | false |
899,166 | 6,863,593 | 3,998,244 | private String hashmd5(String suppliedPassword) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(suppliedPassword.getBytes());
String encriptedPassword = null;
try {
encriptedPassword = new String(Base64.encode(md.digest()),... | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
}
}
try {
digest.update(data.getBytes("utf-8"));
} ca... | true |
899,167 | 7,895,612 | 10,671,991 | public final String encrypt(String input) throws Exception {
try {
MessageDigest messageDigest = (MessageDigest) MessageDigest.getInstance(algorithm).clone();
messageDigest.reset();
messageDigest.update(input.getBytes());
String output = convert(messageDigest.... | public static String md5(String value) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(value.getBytes());
return bytesToString(messageDigest.digest());
} catch (Exception ex) {
Tools.logException(Tools.class... | true |
899,168 | 9,219,798 | 22,019,481 | public static void decryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.DECRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | private static boolean copyFile(File srcFile, File tagFile) throws IOException {
if (srcFile == null || tagFile == null) {
return false;
}
int length = 2097152;
FileInputStream in = new FileInputStream(srcFile);
FileOutputStream out = new FileOutputStream(tagFile)... | true |
899,169 | 19,279,420 | 582,326 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final FileManager fmanager = FileManager.getFileManager(request, leechget);
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter;
try {
... | private void setup() {
env = new EnvAdvanced();
try {
URL url = Sysutil.getURL("world.env");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
String[]... | false |
899,170 | 7,008,364 | 13,307,307 | private String getBytes(String in) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(in.getBytes());
byte[] passWordBytes = md5.digest();
String s = "[";
for (int i = 0; i < passWordBytes.length; i++) s += passWordBytes[i] + ",... | private static void doCopyFile(FileInputStream in, FileOutputStream out) {
FileChannel inChannel = null, outChannel = null;
try {
inChannel = in.getChannel();
outChannel = out.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IO... | false |
899,171 | 19,689,457 | 11,939,185 | public synchronized void connect() throws FTPException, IOException {
if (eventAggregator != null) {
eventAggregator.setConnId(ftpClient.getId());
ftpClient.setMessageListener(eventAggregator);
ftpClient.setProgressMonitor(eventAggregator);
ftpClient.setProgre... | public static String getMD5(String password) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes());
String pwd = new BigInteger(1, md5.digest()).toString(16);
return pwd;
} catch (Exception e) {
... | false |
899,172 | 398,778 | 10,329,098 | public static boolean downloadFile(String url, String destination) throws Exception {
BufferedInputStream bi = null;
BufferedOutputStream bo = null;
File destfile;
byte BUFFER[] = new byte[100];
java.net.URL fileurl;
URLConnection conn;
fileurl = new java.net.... | public void setPilot(PilotData pilotData) throws UsernameNotValidException {
try {
if (pilotData.username.trim().equals("") || pilotData.password.trim().equals("")) throw new UsernameNotValidException(1, "Username or password missing");
PreparedStatement psta;
if (pilotDa... | false |
899,173 | 20,926,888 | 19,322,906 | public void setUp() {
configureProject("src/etc/testcases/taskdefs/optional/net/ftp.xml");
getProject().executeTarget("setup");
tmpDir = getProject().getProperty("tmp.dir");
ftp = new FTPClient();
ftpFileSep = getProject().getProperty("ftp.filesep");
myFTPTask.setSepa... | @Test
public void test_baseMaterialsForTypeID_NonExistingID() throws Exception {
URL url = new URL(baseUrl + "/baseMaterialsForTypeID/1234567890");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestPr... | false |
899,174 | 16,386,620 | 19,779,101 | public static void main(String[] args) {
try {
FileReader reader = new FileReader(args[0]);
FileWriter writer = new FileWriter(args[1]);
html2xhtml(reader, writer);
writer.close();
reader.close();
} catch (Exception e) {
freemin... | protected void initGame() {
try {
for (File fonte : files) {
String absolutePath = outputDir.getAbsolutePath();
String separator = System.getProperty("file.separator");
String name = fonte.getName();
String destName = name.substring... | true |
899,175 | 18,731,110 | 20,955,451 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public void criarTopicoQuestao(Questao q, Integer idTopico) throws SQLException {
PreparedStatement stmt = null;
String sql = "INSERT INTO questao_topico (id_questao, id_disciplina, id_topico) VALUES (?,?,?)";
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1,... | false |
899,176 | 7,976,872 | 16,993,715 | public static void copy_file(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.is... | public static boolean copyFile(String fromfile, String tofile) {
File from = new File(fromfile);
File to = new File(tofile);
if (!from.exists()) return false;
if (to.exists()) {
log.error(tofile + "exists already");
return false;
}
BufferedInpu... | true |
899,177 | 10,195,219 | 22,769,774 | public void configureKerberos(boolean overwriteExistingSetup) throws Exception {
OutputStream keyTabOut = null;
InputStream keyTabIn = null;
OutputStream krb5ConfOut = null;
try {
keyTabIn = loadKeyTabResource(keyTabResource);
File file = new File(keyTabReposi... | public static void copyFile(File src, File dest) throws IOException {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
java.nio.channels.FileChannel channelSrc = fis.getChannel();
java.nio.channels.FileChannel channelDest = fos.getCha... | true |
899,178 | 120,983 | 3,558,514 | void sort(int a[]) throws Exception {
for (int i = a.length; --i >= 0; ) {
boolean flipped = false;
for (int j = 0; j < i; j++) {
if (stopRequested) {
return;
}
if (a[j] > a[j + 1]) {
int T = a[j]... | private synchronized void ensureParsed() throws IOException, BadIMSCPException {
if (cp != null) return;
if (on_disk == null) {
on_disk = createTemporaryFile();
OutputStream to_disk = new FileOutputStream(on_disk);
IOUtils.copy(in.getInputStream(), to_disk);
... | false |
899,179 | 14,581,601 | 14,501,401 | public static void fileCopy(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 ... | private void checkServerAccess() throws IOException {
URL url = new URL("https://testnetbeans.org/bugzilla/index.cgi");
try {
URLConnection conn = url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.connect();
} ... | false |
899,180 | 3,253,024 | 4,047,586 | private static void recurseFiles(File root, File file, TarArchiveOutputStream taos, boolean absolute) throws IOException {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File file2 : files) {
recurseFiles(root, file2, taos, absolute);
}
... | public static void toValueSAX(Property property, Value value, int valueType, ContentHandler contentHandler, AttributesImpl na, Context context) throws SAXException, RepositoryException {
na.clear();
String _value = null;
switch(valueType) {
case PropertyType.DATE:
... | true |
899,181 | 3,024,986 | 9,564,133 | @Test
public void testCopy_readerToOutputStream_nullOut() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
Reader reader = new InputStreamReader(in, "US-ASCII");
try {
IOUtils.copy(reader, (OutputStream) nu... | public void copy(File aSource, File aDestDir) throws IOException {
FileInputStream myInFile = new FileInputStream(aSource);
FileOutputStream myOutFile = new FileOutputStream(new File(aDestDir, aSource.getName()));
FileChannel myIn = myInFile.getChannel();
FileChannel myOut = myOutFil... | true |
899,182 | 13,044,936 | 8,665,322 | public List<SatelliteElementSet> parseTLE(String urlString) throws IOException {
List<SatelliteElementSet> elementSets = new ArrayList<SatelliteElementSet>();
BufferedReader reader = null;
try {
String line = null;
int i = 0;
URL url = new URL(urlString);
... | public Vector<String> getVoiceServersNames() {
Vector<String> result = new Vector<String>();
boolean serverline = false;
String line;
String[] splitline;
try {
URL url = new URL(voiceaddress);
URLConnection connection = url.openConnection();
... | true |
899,183 | 8,080,019 | 16,120,974 | public static String getInstanceUserdata() throws IOException {
int retries = 0;
while (true) {
try {
URL url = new URL("http://169.254.169.254/latest/user-data/");
InputStreamReader rdr = new InputStreamReader(url.openStream());
StringWrit... | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Usage: java xyzImpl inputfile");
System.exit(0);
}
XYZ xyz = null;
try {
URL url = new URL(Util.makeAbsoluteURL(args[0]));
BufferedReader bReader = new... | false |
899,184 | 15,599,613 | 6,322,440 | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | public static void copyFile(final File fromFile, File toFile) throws IOException {
try {
if (!fromFile.exists()) {
throw new IOException("FileCopy: " + "no such source file: " + fromFile.getAbsoluteFile());
}
if (!fromFile.isFile()) {
throw... | true |
899,185 | 10,062,077 | 8,787,101 | private void appendArchive(File instClass) throws IOException {
FileOutputStream out = new FileOutputStream(instClass.getName(), true);
FileInputStream zipStream = new FileInputStream("install.jar");
byte[] buf = new byte[2048];
int read = zipStream.read(buf);
while (read > 0... | private void downloadThread() {
int c;
status = false;
try {
URLConnection urlc = resource.url.openConnection();
File f = resource.createFile();
boolean resume = false;
resource.resetBytesDown();
if (f.exists()) {
if... | false |
899,186 | 13,818,000 | 950,938 | private void RotaDraw(GeoPoint orig, GeoPoint dest, int color, MapView mapa) {
StringBuilder urlString = new StringBuilder();
urlString.append("http://maps.google.com/maps?f=d&hl=en");
urlString.append("&saddr=");
urlString.append(Double.toString((double) orig.getLatitudeE6() / 1.0E6... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
899,187 | 16,083,957 | 21,369,761 | 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... | protected void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | true |
899,188 | 19,142,736 | 18,034,360 | 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 boolean download(String url) {
HttpGet httpGet = new HttpGet(url);
String filename = FileUtils.replaceNonAlphanumericCharacters(url);
String completePath = directory + File.separatorChar + filename;
int retriesLeft = MAX_RETRIES;
while (retriesLeft > 0) {
t... | true |
899,189 | 21,779,336 | 1,730,523 | private void weightAndPlaceClasses() {
int rows = getRows();
for (int curRow = _maxPackageRank; curRow < rows; curRow++) {
xPos = getHGap() / 2;
ClassdiagramNode[] rowObject = getObjectsInRow(curRow);
for (int i = 0; i < rowObject.length; i++) {
if... | public static boolean insert(final Departamento ObjDepartamento) {
int result = 0;
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
if (c == null) {
return false;
}
try {
c.setAutoCommit(false);
final... | false |
899,190 | 17,597,670 | 19,074,021 | @Deprecated
public boolean backupLuceneIndex(int indexLocation, int backupLocation) {
boolean result = false;
try {
System.out.println("lucene backup started");
String indexPath = this.getIndexFolderPath(indexLocation);
String backupPath = this.getIndexFolderP... | public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
long time = System.currentTimeMillis();
String text = request.getParameter("text");
String parsedQueryString = request.getQueryString();
if (text == null) {
... | true |
899,191 | 668,660 | 19,267,855 | 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 updateTableData(Connection dest, TableMetaData tableMetaData) throws Exception {
PreparedStatement ps = null;
try {
dest.setAutoCommit(false);
String sql = "UPDATE " + tableMetaData.getSchema() + "." + tableMetaData.getTableName() + " SET ";
for... | false |
899,192 | 21,337,941 | 945,981 | public static void main(String[] argv) throws IOException {
int i;
for (i = 0; i < argv.length; i++) {
if (argv[i].charAt(0) != '-') break;
++i;
switch(argv[i - 1].charAt(1)) {
case 'b':
try {
flag_predic... | 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 |
899,193 | 11,673,911 | 8,296,360 | private void _save(ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form) throws Exception {
List list = (List) req.getAttribute(WebKeys.LANGUAGE_MANAGER_LIST);
for (int i = 0; i < list.size(); i++) {
long langId = ((Language) list.get(i)).getId();
try ... | public static void copiaAnexos(String from, String to, AnexoTO[] anexoTO) {
FileChannel in = null, out = null;
for (int i = 0; i < anexoTO.length; i++) {
try {
in = new FileInputStream(new File((uploadDiretorio.concat(from)).concat(File.separator + anexoTO[i].getNome())))... | true |
899,194 | 22,275,471 | 6,975,979 | public static boolean update(Funcionario objFuncionario) {
int result = 0;
Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
if (c == null) {
return false;
}
try {
c.setAutoCommit(false);
final String sql = ... | public static void main(String[] args) {
FTPClient f = new FTPClient();
String host = "ftpdatos.aemet.es";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
final String datestamp = sdf.format(new Date());
System.out.println(datestamp);
String pathname = "datos... | false |
899,195 | 4,404,642 | 18,420,618 | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
HttpGet request = new HttpGet(SERVICE_URI + "/json/getproducts");
request.setHeader("Accept", "application/json");
request.setHeader("Content... | public static String hashURL(String url) {
if (url == null) {
throw new IllegalArgumentException("URL may not be null. ");
}
String result = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
if (md != null) {
md.res... | false |
899,196 | 8,230,744 | 23,252,484 | protected void performInsertTest() throws Exception {
Connection conn = connect();
EntityDescriptor ed = repository.getEntityDescriptor(User.class);
User testUser = new User();
Date now = new Date();
conn.setAutoCommit(false);
testUser.setUsername("rednose");
... | public static void copy(File file1, File file2) throws IOException {
FileReader in = new FileReader(file1);
FileWriter out = new FileWriter(file2);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| false |
899,197 | 17,551,920 | 10,846,738 | @Override
public void execute() throws ProcessorExecutionException {
try {
if (getSource().getPaths() == null || getSource().getPaths().size() == 0 || getDestination().getPaths() == null || getDestination().getPaths().size() == 0) {
throw new ProcessorExecutionException("No i... | private static <OS extends OutputStream> OS getUnzipAndDecodeOutputStream(InputStream inputStream, final OS outputStream) {
final PipedOutputStream pipedOutputStream = new PipedOutputStream();
final List<Throwable> ungzipThreadThrowableList = new LinkedList<Throwable>();
Writer decoderWriter... | true |
899,198 | 978,946 | 7,574,033 | 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 String generateHashSE(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException, DigestException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-256");
byte[] hashSHA256 = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
... | false |
899,199 | 18,070,589 | 3,459,078 | @Test
public void testWriteAndReadSecondLevel() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | public static void copyFile(File source, File target) {
try {
target.getParentFile().mkdirs();
byte[] buffer = new byte[4096];
int len = 0;
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(target);
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.