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,900 | 1,528,296 | 21,130,111 | public static Hashtable DefaultLoginValues(String firstName, String lastName, String password, String mac, String startLocation, int major, int minor, int patch, int build, String platform, String viewerDigest, String userAgent, String author) throws Exception {
Hashtable values = new Hashtable();
M... | public static String SHA1(String string) throws XLWrapException {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
throw new XLWrapException("SHA-1 message digest is not available.");
}
byte[] data... | true |
899,901 | 10,896,362 | 2,215,295 | private HttpResponse executePutPost(HttpEntityEnclosingRequestBase request, String content) {
try {
if (LOG.isTraceEnabled()) {
LOG.trace("Content: {}", content);
}
StringEntity e = new StringEntity(content, "UTF-8");
e.setContentType("applicat... | 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 |
899,902 | 970,144 | 4,948,580 | public Logging() throws Exception {
File home = new File(System.getProperty("user.home"), ".jorgan");
if (!home.exists()) {
home.mkdirs();
}
File logging = new File(home, "logging.properties");
if (!logging.exists()) {
InputStream input = getClass().ge... | public InputStream getResourceAsStream(String path) {
try {
URL url = getResource(path);
if (url != null) {
return url.openStream();
} else {
return null;
}
} catch (IOException ioe) {... | false |
899,903 | 467,550 | 23,250,845 | 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... | private void unzipResource(final String resourceName, final File targetDirectory) throws IOException {
assertTrue(resourceName.startsWith("/"));
final URL resource = this.getClass().getResource(resourceName);
assertNotNull("Expected '" + resourceName + "' not found.", resource);
asse... | true |
899,904 | 11,651,293 | 93,208 | public void render(final HttpServletRequest request, final HttpServletResponse response, final byte[] bytes, final Throwable t, final String contentType, final String encoding) throws Exception {
if (contentType != null) {
response.setContentType(contentType);
}
if (encoding != n... | 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,905 | 11,265,073 | 257,201 | public static void zip(File srcDir, File destFile, FileFilter filter) throws IOException {
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new FileOutputStream(destFile));
Collection<File> files = FileUtils.listFiles(srcDir, TrueFileFilter.TRUE, TrueFileFilter.TRU... | 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,906 | 2,191,115 | 2,232,619 | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
List<Datastream> tDatastreams = super.getDatastreams(pDeposit);
FileInputStream tInput = null;
String tFileName = ((LocalDatastream) tDatastreams.get(0)).getPath();
String... | public void testStorageStringWriter() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
{
Writer w = r.getWriter();
w.write("This is an example");
w.write(" and another one.");
w.flush();
ass... | true |
899,907 | 13,955,716 | 14,429,171 | public static void copier(final File pFichierSource, final File pFichierDest) {
FileChannel vIn = null;
FileChannel vOut = null;
try {
vIn = new FileInputStream(pFichierSource).getChannel();
vOut = new FileOutputStream(pFichierDest).getChannel();
vIn.trans... | public void salva(UploadedFile imagem, Usuario usuario) {
File destino;
if (usuario.getId() == null) {
destino = new File(pastaImagens, usuario.hashCode() + ".jpg");
} else {
destino = new File(pastaImagens, usuario.getId() + ".jpg");
}
try {
... | true |
899,908 | 2,476,569 | 14,581,601 | public static void reconstruct(final List files, final Map properties, final OutputStream fout, final String base_url, final String producer, final PageSize[] size, final List hf) throws CConvertException {
OutputStream out = fout;
OutputStream out2 = fout;
boolean signed = false;
Ou... | 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 ... | true |
899,909 | 3,104,483 | 22,019,481 | @Override
public void writeTo(final TrackRepresentation t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws WebApplicationException {
if (mediaType.isCompatibl... | 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,910 | 19,591,847 | 19,438,539 | @Override
public void run() {
try {
for (int r = 0; r < this.requestCount; r++) {
HttpGet httpget = new HttpGet("/");
HttpResponse response = this.httpclient.execute(this.target, httpget, this.context);
this.count++;... | public void run() throws Exception {
logger.debug("#run enter");
logger.debug("#run orderId = " + orderId);
ResultSet rs = null;
PreparedStatement ps = null;
try {
connection.setAutoCommit(false);
ps = connection.prepareStatement(SQL_SELECT_ORDER_LINE)... | false |
899,911 | 22,986,029 | 15,479,412 | private boolean doDelete(String identifier) throws IOException, MalformedURLException {
URL url = new URL(baseurl.toString() + "/" + identifier);
HttpURLConnection huc = (HttpURLConnection) (url.openConnection());
huc.setRequestMethod("DELETE");
huc.connect();
if (huc.getResp... | private ImageReader findImageReader(URL url) {
ImageInputStream input = null;
try {
input = ImageIO.createImageInputStream(url.openStream());
} catch (IOException e) {
logger.log(Level.WARNING, "zly adres URL obrazka " + url, e);
}
ImageReader reader =... | false |
899,912 | 2,235,431 | 13,064,742 | private LinkedList<Datum> processDatum(Datum dataset) {
ArrayList<Object[]> markerTestResults = new ArrayList<Object[]>();
ArrayList<Object[]> alleleEstimateResults = new ArrayList<Object[]>();
boolean hasAlleleNames = false;
String blank = new String("");
MarkerPhenotypeAdap... | public DataRecord addRecord(InputStream input) throws DataStoreException {
File temporary = null;
try {
temporary = newTemporaryFile();
DataIdentifier tempId = new DataIdentifier(temporary.getName());
usesIdentifier(tempId);
long length = 0;
... | true |
899,913 | 11,733,067 | 8,335,944 | public static String sha1(String src) {
MessageDigest md1 = null;
try {
md1 = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
md1.update(src.getBytes("UTF-8"));
} catch (Unsupp... | public static byte[] sendRequestV1(String url, Map<String, Object> params, String secretCode, String method, Map<String, String> files, String encoding, String signMethod, Map<String, String> headers, String contentType) {
HttpClient client = new HttpClient();
byte[] result = null;
if (metho... | false |
899,914 | 11,233,252 | 2,310,752 | private void loadTrustAnchors(final String keystoreLocation) {
LOG.debug("keystore location: " + keystoreLocation);
try {
if (keystoreLocation == null) {
throw new NullPointerException("No TrustAnchor KeyStore name is set");
}
InputStream keyStoreS... | public static void copy(final String source, final String dest) {
final File s = new File(source);
final File w = new File(dest);
try {
final FileInputStream in = new FileInputStream(s);
final FileOutputStream out = new FileOutputStream(w);
int c;
... | false |
899,915 | 9,361,117 | 12,065,181 | protected String encrypt(String text) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
| private void sortMasters() {
masterCounter = 0;
for (int i = 0; i < maxID; i++) {
if (users[i].getMasterPoints() > 0) {
masterHandleList[masterCounter] = users[i].getHandle();
masterPointsList[masterCounter] = users[i].getMasterPoints();
ma... | false |
899,916 | 820,872 | 20,306,674 | 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 int create(BusinessObject o) throws DAOException {
int insert = 0;
int id = 0;
Bill bill = (Bill) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("INSERT_BILL"));
pst.setDate(1, new java.sql.Date(bill.getDate().getTime(... | false |
899,917 | 5,498,222 | 18,923,902 | public static void copyFile(String inputFile, String outputFile) throws IOException {
FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
for (int b = fis.read(); b != -1; b = fis.read()) fos.write(b);
fos.close();
fi... | public ActualTask(TEditor editor, TIGDataBase dataBase, String directoryPath, String myImagesBehaviour) {
File myDirectory = new File(directoryPath);
String[] list = myDirectory.list();
File fileXML = new File(directoryPath + "images.xml");
SAXBuilder builder = ne... | true |
899,918 | 14,338,365 | 23,467,092 | private static String simpleCompute(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("utf-8"), 0, text.length());
sha1hash = md.diges... | public void control() {
String urlPrefix = "http://" + host + ":" + CONTROL_PORT + "/servlet/Streamsicle";
String skipURL = urlPrefix + "?action=skip";
String addURL = urlPrefix + "?action=add&song=";
String removeURL = urlPrefix + "?action=action=remove&fileID=";
String url ... | false |
899,919 | 13,299,924 | 13,952,259 | private void foundNewVersion() {
updater = new UpdaterView();
updater.setLabelText("Initiating Updater...");
updater.setProgress(0);
updater.setLocationRelativeTo(null);
updater.setVisible(true);
URL pathUrl = ClassLoader.getSystemResource("img/icon.png");
Str... | private static String getMD5(String phrase) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(phrase.getBytes());
return asHexString(md.digest());
} catch (Exception e) {
}
return "";
}
| false |
899,920 | 12,915,753 | 14,936,644 | private String readDataFromUrl(URL url) throws IOException {
InputStream inputStream = null;
InputStreamReader streamReader = null;
BufferedReader in = null;
StringBuffer data = new StringBuffer();
try {
inputStream = url.openStream();
streamReader = n... | String readArticleFromFile(String urlStr) {
String docbase = getDocumentBase().toString();
int pos = docbase.lastIndexOf('/');
if (pos > -1) {
docbase = docbase.substring(0, pos + 1);
} else {
docbase = "";
}
docbase = docbase + urlStr;
... | true |
899,921 | 13,450,574 | 733,283 | 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... | private boolean setupDatabase() {
if (DoInstallationTasks.DEBUG_DB) {
System.out.println("About to setup database");
}
if (installer.getRootDBUsername() != null && installer.getRootDBUsername().length() > 1 && installer.getRootDBPassword() != null && installer.getRootDBPassword()... | true |
899,922 | 19,344,016 | 1,423,646 | public static synchronized String encrypt(String plaintext) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BAS... | public void removerDisciplina(Disciplina disciplina) throws ClassNotFoundException, SQLException {
this.criaConexao(false);
String sql = "DELETE FROM \"Disciplina\" " + " WHERE ID_Disciplina = ? )";
PreparedStatement stmt = null;
try {
stmt = connection.prepareSt... | false |
899,923 | 19,870,772 | 3,307,772 | @RequestMapping(value = "/verdocumentoFisico.html", method = RequestMethod.GET)
public String editFile(ModelMap model, @RequestParam("id") int idAnexo) {
Anexo anexo = anexoService.selectById(idAnexo);
model.addAttribute("path", anexo.getAnexoCaminho());
try {
InputStream is ... | 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,924 | 1,189,509 | 12,909,291 | public void testRoundTrip_1(String resource) throws Exception {
long start1 = System.currentTimeMillis();
File originalFile = File.createTempFile("RoundTripTest", "testRoundTrip_1");
FileOutputStream fos = new FileOutputStream(originalFile);
IOUtils.copy(getClass().getResourceAsStrea... | public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType(s_contentType);
response.setHeader("Cache-control", "no-cache");
InputStream graphStream = getGraphStream(request);
OutputStream out = getOutputStream(re... | true |
899,925 | 6,753,786 | 2,031,752 | public static String hash(String value) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(HASH_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
try {
md.update(value.getBytes(INPUT_ENCODING));... | public String readFile(String filename) throws UnsupportedEncodingException, FileNotFoundException, IOException {
File f = new File(baseDir);
f = new File(f, filename);
StringWriter w = new StringWriter();
Reader fr = new InputStreamReader(new FileInputStream(f), "UTF-8");
IO... | false |
899,926 | 9,585,279 | 2,684,284 | public static String getResponseText(String url) throws MalformedURLException, IOException {
URL m_url = new URL(url);
URLConnection urlCconn = m_url.openConnection();
urlCconn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firef... | public DAS getDAS() throws MalformedURLException, IOException, ParseException, DASException, DODSException {
InputStream is;
if (fileStream != null) is = parseMime(fileStream); else {
URL url = new URL(urlString + ".das" + projString + selString);
if (dumpDAS) {
... | false |
899,927 | 6,226,270 | 16,529,002 | public static void copyFile(File in, File out) {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
... | 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,928 | 414,463 | 15,519,967 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private void output(HttpServletResponse resp, InputStream is, long length, String fileName) throws Exception {
resp.reset();
String mimeType = "image/jpeg";
resp.setContentType(mimeType);
resp.setContentLength((int) length);
resp.setHeader("Content-Disposition", "inline; file... | true |
899,929 | 4,982,455 | 3,021,780 | static final void saveStatus(JWAIMStatus status, DBConnector connector) throws IOException {
Connection con = null;
PreparedStatement ps = null;
Statement st = null;
try {
con = connector.getDB();
con.setAutoCommit(false);
st = con.createStatement(... | private Integer getInt(String sequence) throws NoSuchSequenceException {
Connection conn = null;
PreparedStatement read = null;
PreparedStatement write = null;
boolean success = false;
try {
conn = ds.getConnection();
conn.setTransactionIsolation(conn.... | true |
899,930 | 3,229,361 | 18,030,152 | public void copyFile(String source_name, String dest_name) throws IOException {
File source_file = new File(source_name);
File destination_file = new File(dest_name);
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
... | public static boolean copyFile(File from, File tu) {
final int BUFFER_SIZE = 4096;
byte[] buffer = new byte[BUFFER_SIZE];
try {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(tu);
int read;
while ((r... | true |
899,931 | 10,793,895 | 12,067,823 | protected void configure() {
Enumeration<URL> resources = null;
try {
resources = classLoader.getResources(resourceName);
} catch (IOException e) {
binder().addError(e.getMessage(), e);
return;
}
int resourceCount = 0;
while (resour... | public void run() {
if (saveAsDialog == null) {
saveAsDialog = new FileDialog(window.getShell(), SWT.SAVE);
saveAsDialog.setFilterExtensions(saveAsTypes);
}
String outputFile = saveAsDialog.open();
if (outputFile != null) {
Object inputFile = DataS... | false |
899,932 | 10,466,758 | 17,907,353 | public void handleRequestInternal(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws ServletException, IOException {
final String servetPath = httpServletRequest.getServletPath();
final String previousToken = httpServletRequest.getHeader(IF_NONE_MATCH)... | public static void resourceToFile(final String resource, final String filePath) throws IOException {
log.debug("Classloader is " + IOCopyUtils.class.getClassLoader());
InputStream in = IOCopyUtils.class.getResourceAsStream(resource);
if (in == null) {
log.warn("Resource not '" + ... | true |
899,933 | 8,075,978 | 1,342,927 | public String getDataAsString(String url) throws RuntimeException {
try {
String responseBody = "";
URLConnection urlc;
if (!url.toUpperCase().startsWith("HTTP://") && !url.toUpperCase().startsWith("HTTPS://")) {
urlc = tryOpenConnection(url);
... | public static InputStream getResourceAsStream(String resourceName) {
try {
URL url = getEmbeddedFileUrl(WS_SEP + resourceName);
if (url != null) {
return url.openStream();
}
} catch (MalformedURLException e) {
GdtAndroidPlugin.getLogger... | false |
899,934 | 3,024,980 | 5,102,752 | @Test
public void testCopy_inputStreamToWriter_Encoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new YellOn... | public String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| true |
899,935 | 6,865,572 | 6,881,934 | 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 sendSoapMsg(String SOAPUrl, byte[] b, String SOAPAction) throws IOException {
log.finest("HTTP REQUEST SIZE " + b.length);
if (SOAPAction.startsWith("\"") == false) SOAPAction = "\"" + SOAPAction + "\"";
URL url = new URL(SOAPUrl);
HttpURLConnection httpConn = (H... | false |
899,936 | 8,708,601 | 3,024,978 | public void testReadNormal() throws Exception {
archiveFileManager.executeWith(new TemporaryFileExecutor() {
public void execute(File temporaryFile) throws Exception {
ZipArchive archive = new ZipArchive(temporaryFile.getPath());
InputStream input = archive.getIn... | @Test
public void testCopy_inputStreamToWriter_nullIn() throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
OutputStream out = new YellOnFlushAndCloseOutputStreamTest(baout, true, true);
Writer writer = new OutputStreamWriter(baout, "US-ASCII");
try {
... | true |
899,937 | 23,310,399 | 5,953,607 | public void onClick(View v) {
String uriAPI = "http://www.sina.com";
HttpGet httpRequest = new HttpGet(uriAPI);
try {
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
if (httpResponse.getStatusLi... | public synchronized void write() throws IOException {
ZipOutputStream jar = new ZipOutputStream(new FileOutputStream(jarPath));
int index = className.lastIndexOf('.');
String packageName = className.substring(0, index);
String clazz = className.substring(index + 1);
String di... | false |
899,938 | 601,526 | 16,706,336 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | protected URLConnection openConnection(URL url) throws IOException {
URLConnection con = url.openConnection();
if ("HTTPS".equalsIgnoreCase(url.getProtocol())) {
HttpsURLConnection scon = (HttpsURLConnection) con;
try {
scon.setSSLSocke... | false |
899,939 | 15,453,012 | 2,057,786 | public ArrayList parseFile(File newfile) throws IOException {
String s;
String firstName;
String header;
String name = null;
Integer PVLoggerID = new Integer(0);
String[] tokens;
int nvalues = 0;
double num1, num2, num3;
double xoffset = 1.0;
... | public static String sendGetRequest(String urlStr) {
String result = null;
try {
URL url = new URL(urlStr);
System.out.println(urlStr);
URLConnection conn = url.openConnection();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInpu... | true |
899,940 | 19,045,087 | 15,102,902 | public static void copyfile(String src, String dst) throws IOException {
dst = new File(dst).getAbsolutePath();
new File(new File(dst).getParent()).mkdirs();
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel(... | public static void translateTableMetaData(String baseDir, String tableName, NameSpaceDefinition nsDefinition) throws Exception {
setVosiNS(baseDir, "table", nsDefinition);
String filename = baseDir + "table.xsl";
Scanner s = new Scanner(new File(filename));
PrintWriter fw = new Print... | true |
899,941 | 17,793,612 | 4,988,270 | public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException {
try {
String encodedString = ((StringValue) arguments[0].next()).getStringValue();
byte[] decodedBytes = Base64.decode(encodedString);
if (argument... | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | true |
899,942 | 7,791,429 | 4,376,758 | public static String hashMD5(String baseString) {
MessageDigest digest = null;
StringBuffer hexString = new StringBuffer();
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(baseString.getBytes());
byte[] hash = digest.digest();
... | public void setKey(String key) {
MessageDigest md5;
byte[] mdKey = new byte[32];
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(key.getBytes());
byte[] digest = md5.digest();
System.arraycopy(digest, 0, mdKey, 0, 16);
Syst... | true |
899,943 | 9,542,520 | 21,374,041 | @SuppressWarnings("static-access")
public void run() {
while (true) {
try {
thisThread.sleep(10000);
} catch (InterruptedException e) {
System.out.print("no connection");
}
++i;
umat.flush();
umat = n... | public void writeToStream(OutputStream out) throws IOException {
InputStream result = null;
if (tempFile != null) {
InputStream input = new BufferedInputStream(new FileInputStream(tempFile));
IOUtils.copy(input, out);
IOUtils.closeQuietly(input);
} else if... | false |
899,944 | 15,028,490 | 14,412,812 | public Document load(java.net.URL url) throws DOMTestLoadException {
Document doc = null;
Exception parseException = null;
try {
LoadErrorHandler errorHandler = new LoadErrorHandler();
builder.setErrorHandler(errorHandler);
doc = builder.parse(url.openStre... | public static String getMD5(String password) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] b = md.digest();
StringBuffer sb = new StringBuffer();
for (byte aB : b) {
sb.append((Integer... | false |
899,945 | 17,374,912 | 13,988,825 | public void copyTo(File folder) {
if (!isNewFile()) {
return;
}
if (!folder.exists()) {
folder.mkdir();
}
File dest = new File(folder, name);
try {
FileInputStream in = new FileInputStream(cur... | private void setNodekeyInJsonResponse(String service) throws Exception {
String filename = this.baseDirectory + service + ".json";
Scanner s = new Scanner(new File(filename));
PrintWriter fw = new PrintWriter(new File(filename + ".new"));
while (s.hasNextLine()) {
fw.prin... | true |
899,946 | 8,788,331 | 775,447 | private void copyFromStdin(Path dst, FileSystem dstFs) throws IOException {
if (dstFs.isDirectory(dst)) {
throw new IOException("When source is stdin, destination must be a file.");
}
if (dstFs.exists(dst)) {
throw new IOException("Target " + dst.toString() + " alread... | void copyFile(String src, String dest) throws IOException {
int amount;
byte[] buffer = new byte[4096];
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
while ((amount = in.read(buffer)) != -1) out.write(buffer, 0, amount);
... | true |
899,947 | 17,999,460 | 638,963 | public static long toFile(final DigitalObject object, final File file) {
try {
FileOutputStream fOut = new FileOutputStream(file);
long bytesCopied = IOUtils.copyLarge(object.getContent().getInputStream(), fOut);
fOut.close();
return bytesCopied;
} cat... | 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,948 | 120,707 | 17,597,670 | 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... | @Deprecated
public boolean backupLuceneIndex(int indexLocation, int backupLocation) {
boolean result = false;
try {
System.out.println("lucene backup started");
String indexPath = this.getIndexFolderPath(indexLocation);
String backupPath = this.getIndexFolderP... | true |
899,949 | 8,122,281 | 16,875,869 | public String get(String s, String encoding) throws Exception {
if (!s.startsWith("http")) return "";
StringBuilder sb = new StringBuilder();
try {
String result = null;
URL url = new URL(s);
URLConnection connection = url.openConnection();
con... | public static ArrayList<Quote> fetchAllQuotes(String symbol, Date from, Date to) {
try {
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(from);
String monthFrom = (new Integer(calendar.get(GregorianCalendar.MONTH))).toString();
String da... | true |
899,950 | 10,318,446 | 5,260,867 | public static void copy(String sourceFile, String targetFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel();
FileChannel targetChannel = new FileOutputStream(targetFile).getChannel();
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.s... | 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 |
899,951 | 19,950,034 | 2,226,036 | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | public void run() {
saveWLHome();
for (final TabControl control : tabControls) {
control.performOk(WLPropertyPage.this.getProject(), WLPropertyPage.this);
}
if (isEnabledJCLCopy()) {
final File url = new ... | true |
899,952 | 30,237 | 775,447 | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | void copyFile(String src, String dest) throws IOException {
int amount;
byte[] buffer = new byte[4096];
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
while ((amount = in.read(buffer)) != -1) out.write(buffer, 0, amount);
... | true |
899,953 | 13,832,862 | 14,479,581 | public static void main(String args[]) {
Connection con;
if (args.length != 2) {
System.out.println("Usage: Shutdown <host> <password>");
System.exit(0);
}
try {
con = new Connection(args[0]);
con.tStart();
Message message =... | public static void main(String[] args) throws NoSuchAlgorithmException {
String password = "root";
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(password.getBytes());
final byte[] digest = messageDigest.digest();
final StringBuilder buf ... | true |
899,954 | 555,513 | 8,296,360 | 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 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,955 | 1,508,164 | 1,293,657 | public boolean delMail(MailObject mail) throws NetworkException, ContentException {
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(HttpConfig.bbsURL() + HttpConfig.BBS_MAIL_DEL + mail.getId());
try {
HttpResponse response = client.execute(get);
... | public void modifyDecisionInstruction(int id, int condition, String frameSlot, String linkName, int objectId, String attribute, int positive, int negative) throws FidoDatabaseException, ObjectNotFoundException, InstructionNotFoundException {
try {
Connection conn = null;
Statement st... | false |
899,956 | 22,538,273 | 21,172,450 | public void format(File source, File target) {
if (!source.exists()) {
throw new IllegalArgumentException("Source '" + source + " doesn't exist");
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source '" + source + " is not a file");
}
t... | public static void unzip2(String strZipFile, String folder) throws IOException, ArchiveException {
FileUtil.fileExists(strZipFile, true);
final InputStream is = new FileInputStream(strZipFile);
ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
Zi... | true |
899,957 | 17,534,703 | 2,873,508 | 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(... | PackageFileImpl(PackageDirectoryImpl dir, String name, InputStream data) throws IOException {
this.dir = dir;
this.name = name;
this.updates = dir.getUpdates();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
IOUtils.copy(data, stream);
updates.setNewData(... | true |
899,958 | 15,946,011 | 7,893,892 | public long calculateResponseTime(Proxy proxy) {
try {
LOGGER.debug("Test network response time for " + RESPONSE_TEST_URL);
URL urlForTest = new URL(REACH_TEST_URL);
URLConnection testConnection = urlForTest.openConnection(proxy);
long startTime = System.curre... | public static String md5EncodeString(String s) throws UnsupportedEncodingException, NoSuchAlgorithmException {
if (s == null) return null;
if (StringUtils.isBlank(s)) return "";
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(s.... | false |
899,959 | 19,235,547 | 16,000,121 | protected BufferedImage handleRaremapsException() {
if (params.uri.startsWith("http://www.raremaps.com/cgi-bin/gallery.pl/detail/")) try {
params.uri = params.uri.replace("cgi-bin/gallery.pl/detail", "maps/medium");
URL url = new URL(params.uri);
URLConnection connection ... | public void invoke(InputStream is) throws AgentException {
try {
addHeader("Content-Type", "application/zip");
addHeader("Content-Length", String.valueOf(is.available()));
connection.setDoOutput(true);
connection.connect();
OutputStream os = connec... | false |
899,960 | 21,277,519 | 4,961,136 | public static String getMD5(String s) throws Exception {
MessageDigest complete = MessageDigest.getInstance("MD5");
complete.update(s.getBytes());
byte[] b = complete.digest();
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[... | private void salvarArtista(Artista artista) throws Exception {
System.out.println("GerenteMySQL.salvarArtista()" + artista.toString2());
Connection conn = null;
PreparedStatement ps = null;
try {
conn = C3P0Pool.getConnection();
String sql = "insert into artis... | false |
899,961 | 1,458,628 | 10,482,004 | 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 main(String[] args) throws IOException {
System.out.println("Start filtering zgps...");
final Config config = ConfigUtils.loadConfig(args[0]);
final String CONFIG_MODULE = "GPSFilterZGPS";
File sourceFileSelectedStages = new File(config.findParam(CONFIG_MODULE, "so... | true |
899,962 | 413,562 | 18,809,148 | 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 moveOutputAsmFile(File inputLocation, File outputLocation) throws Exception {
FileInputStream inputStream = null;
FileOutputStream outputStream = null;
try {
inputStream = new FileInputStream(inputLocation);
outputStream = new FileOutputStream(outpu... | true |
899,963 | 21,461,878 | 834,053 | private boolean verifyAppId(String appid) {
try {
String urlstr = "http://" + appid + ".appspot.com";
URL url = new URL(urlstr);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
899,964 | 10,313,906 | 14,230,405 | private File copyFile(File file, String newName, File folder) {
File newFile = null;
if (!file.exists()) {
System.out.println("File " + file + " does not exist");
return null;
}
if (file.isFile()) {
BufferedOutputStream out = null;
Buff... | 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... | true |
899,965 | 5,375,381 | 14,667,831 | public TempFileBinaryBody(InputStream is) throws IOException {
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
tempFile = tempPath.createTempFile("attachment", ".bin");
OutputStream out = tempFile.getOutputStream();
IOUtils.copy(is, out);
out.close();
}
| public void concatFiles() throws IOException {
Writer writer = null;
try {
final File targetFile = new File(getTargetDirectory(), getTargetFile());
targetFile.getParentFile().mkdirs();
if (null != getEncoding()) {
getLog().info("Writing aggregated ... | true |
899,966 | 18,310,020 | 20,370,107 | public static String postToAddress(Map<String, String> params, String address) throws Exception {
String data = "";
String separator = "";
for (String key : params.keySet()) {
data += separator + URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(params.get(key), "UTF-8");... | public boolean refresh() {
try {
URLConnection conn = url.openConnection();
conn.setUseCaches(false);
if (credential != null) conn.setRequestProperty("Authorization", credential);
conn.connect();
int status = ((HttpURLConnection) conn).getResponseC... | false |
899,967 | 18,293,811 | 7,005,226 | private static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("�������� ���� �� ���������" + from_file);
if (!from_file.isFile()) abort("���������� ����������� ���... | private void copyValidFile(File file, int cviceni) {
try {
String filename = String.format("%s%s%02d%s%s", validovane, File.separator, cviceni, File.separator, file.getName());
boolean copy = false;
File newFile = new File(filename);
if (newFile.exists()) {
... | true |
899,968 | 21,407,347 | 5,859,989 | public boolean load() {
if (getFilename() != null && getFilename().length() > 0) {
try {
File file = new File(PreferencesManager.getDirectoryLocation("macros") + File.separator + getFilename());
URL url = file.toURL();
InputStreamReader isr = new I... | public Integer execute(Connection con) throws SQLException {
int updateCount = 0;
boolean oldAutoCommitSetting = con.getAutoCommit();
Statement stmt = null;
try {
con.setAutoCommit(autoCommit);
stmt = con... | false |
899,969 | 16,287,068 | 14,632,238 | public OAuthResponseMessage access(OAuthMessage request, net.oauth.ParameterStyle style) throws IOException {
HttpMessage httpRequest = HttpMessage.newRequest(request, style);
HttpResponseMessage httpResponse = http.execute(httpRequest, httpParameters);
httpResponse = HttpMessageDecoder.deco... | public static void bubble(double[] a) {
for (int i = a.length - 1; i > 0; i--) for (int j = 0; j < i; j++) if (a[j] > a[j + 1]) {
double temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
| false |
899,970 | 536,114 | 5,305,335 | 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 void testRenderRules() {
try {
MappingManager manager = new MappingManager();
OWLOntologyManager omanager = OWLManager.createOWLOntologyManager();
OWLOntology srcOntology;
OWLOntology targetOntology;
manager.loadMapping(rulesDoc.toURL());
... | true |
899,971 | 5,199,811 | 10,912,335 | public static String encodePassword(String password) {
try {
MessageDigest messageDiegest = MessageDigest.getInstance("SHA-1");
messageDiegest.update(password.getBytes("UTF-8"));
return Base64.encodeToString(messageDiegest.digest(), false);
} catch (NoSuchAlgorith... | public void guardarCantidad() {
try {
String can = String.valueOf(cantidadArchivos);
File archivo = new File("cantidadArchivos.txt");
FileWriter fw = new FileWriter(archivo);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter salida = new Prin... | false |
899,972 | 9,632,237 | 9,499,457 | private boolean copy_to_file_io(File src, File dst) throws IOException {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(src);
is = new BufferedInputStream(is);
os = new FileOutputStream(dst);
os = new BufferedOutp... | private static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile... | true |
899,973 | 74 | 151,885 | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | 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]... | true |
899,974 | 13,098,121 | 3,809,086 | private URLConnection openConnection(final URL url) throws IOException {
try {
return (URLConnection) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws IOException {
return url.openConnection();
}
... | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1.setEnabled(false);
for (int i = 0; i < max; i++) {
Card crd = WLP.getSelectedCard(WLP.jTable1.getSelectedRows()[i]);
String s, s2;
s = "";
s2 = "";
try {
... | false |
899,975 | 14,249,320 | 2,092,752 | @SuppressWarnings("unchecked")
public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
String url;
boolean url_valid = true;
URI url_uri = getConfiguration().getUri();
url = url_uri.toString();
URLConnection urlConn_test;
try {
... | public void save() {
final JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileFilter() {
public String getDescription() {
return "PDF File";
}
public boolean accept(File f) {
return f.isDirectory() || f.getName().toLow... | false |
899,976 | 9,261,908 | 7,051,649 | 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 void copyFile(String inputPath, String basis, String filename) throws GLMRessourceFileException {
try {
FileChannel inChannel = new FileInputStream(new File(inputPath)).getChannel();
File target = new File(basis, filename);
FileChannel outChannel = new FileOutputS... | true |
899,977 | 17,050,025 | 9,593,609 | private static String retrieveVersion(InputStream is) throws RepositoryException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
IOUtils.copy(is, buffer);
} catch (IOException e) {
throw new RepositoryException(exceptionLocalizer.format("device-rep... | public static void main(String[] args) throws Exception {
File rootDir = new File("C:\\dev\\workspace_fgd\\gouvqc_crggid\\WebContent\\WEB-INF\\upload");
File storeDir = new File(rootDir, "storeDir");
File workDir = new File(rootDir, "workDir");
LoggerFacade loggerFacade = new Commons... | true |
899,978 | 19,922,657 | 255,401 | protected static boolean copyFile(File src, File dest) {
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
byte[] temp = new byte[1... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | false |
899,979 | 4,224,228 | 22,358,005 | public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | @Override
public InputStream getInputStream() throws IOException {
if (dfos == null) {
int deferredOutputStreamThreshold = Config.getInstance().getDeferredOutputStreamThreshold();
dfos = new DeferredFileOutputStream(deferredOutputStreamThreshold, Definitions.PROJECT_NAME, "." + D... | false |
899,980 | 1,172,494 | 23,563,688 | public static String encrypt(String input) {
try {
MessageDigest md = MessageDigest.getInstance("SHA1");
md.update(input.getBytes("UTF-8"));
return toHexString(md.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (U... | private void getLocationAddressByGoogleMapAsync(Location location) {
if (location == null) {
return;
}
AsyncTask<Location, Void, String> task = new AsyncTask<Location, Void, String>() {
@Override
protected String doInBackground(Location... params) {
... | false |
899,981 | 601,526 | 3,402,498 | 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... | private static void readFileEntry(Zip64File zip64File, FileEntry fileEntry, File destFolder) {
FileOutputStream fileOut;
File target = new File(destFolder, fileEntry.getName());
File targetsParent = target.getParentFile();
if (targetsParent != null) {
targetsParent.mkdirs... | true |
899,982 | 2,238,218 | 22,300,980 | public void includeCss(Group group, Writer out, PageContext pageContext) throws IOException {
ByteArrayOutputStream outtmp = new ByteArrayOutputStream();
if (AbstractGroupBuilder.getInstance().buildGroupJsIfNeeded(group, outtmp, pageContext.getServletContext())) {
FileOutputStream fileSt... | @Test
public void testTransactWriteAndRead() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | true |
899,983 | 5,891,092 | 8,041,989 | public static IProject createSimplemodelEnabledJavaProject() throws CoreException {
IWorkspaceDescription desc = ResourcesPlugin.getWorkspace().getDescription();
desc.setAutoBuilding(false);
ResourcesPlugin.getWorkspace().setDescription(desc);
String name = "TestProject";
for... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException {
String requestURI = req.getRequestURI();
logger.info("The requested URI: {}", requestURI);
String parameter = requestURI.substring(requestURI.lastIndexOf(ARXIVID_ENTRY) + ARXIVID_EN... | false |
899,984 | 11,818,436 | 22,054,404 | public void zip_compressFiles() throws Exception {
FileInputStream in = null;
File f1 = new File("C:\\WINDOWS\\regedit.exe");
File f2 = new File("C:\\WINDOWS\\win.ini");
File file = new File("C:\\" + NTUtil.class.getName() + ".zip");
ZipOutputStream out = new ZipOutputStream(... | private void copyfile(File srcFile, File dstDir) throws FileNotFoundException, IOException {
if (srcFile.isDirectory()) {
File newDestDir = new File(dstDir, srcFile.getName());
newDestDir.mkdir();
String fileNameList[] = srcFile.list();
for (int i = 0; i < fil... | true |
899,985 | 4,981,909 | 1,008,326 | public static File enregistrerFichier(String fileName, File file, String path, String fileMime) throws Exception {
if (file != null) {
try {
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
... | public long copyDirAllFilesToDirectoryRecursive(String baseDirStr, String destDirStr, boolean copyOutputsRtIDsDirs) throws Exception {
long plussQuotaSize = 0;
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.... | true |
899,986 | 12,626,918 | 18,613,811 | public void xtestURL2() throws Exception {
URL url = new URL(IOTest.URL);
InputStream inputStream = url.openStream();
OutputStream outputStream = new FileOutputStream("C:/Temp/testURL2.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.c... | public void readPersistentProperties() {
try {
String file = System.getProperty("user.home") + System.getProperty("file.separator") + ".das2rc";
File f = new File(file);
if (f.canRead()) {
try {
InputStream in = new FileInputStream(f);
... | true |
899,987 | 808,408 | 9,656,103 | public static synchronized String getSequenceNumber(String SequenceName) {
String result = "";
Connection conn = null;
Statement ps = null;
ResultSet rs = null;
try {
conn = TPCW_Database.getConnection();
conn.setAutoCommit(false);
String s... | 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,988 | 13,657,107 | 21,361,961 | public void add(final String name, final String content) {
forBundle(new BundleManipulator() {
public boolean includeEntry(String entryName) {
return !name.equals(entryName);
}
public void finish(Bundle bundle, ZipOutputStream zout) throws IOException {
... | private void transform(CommandLine commandLine) throws IOException {
Reader reader;
if (commandLine.hasOption('i')) {
reader = createFileReader(commandLine.getOptionValue('i'));
} else {
reader = createStandardInputReader();
}
Writer writer;
if... | true |
899,989 | 11,081,583 | 14,058,408 | public void rename(String virtualWiki, String oldTopicName, String newTopicName) throws Exception {
Connection conn = DatabaseConnection.getConnection();
try {
boolean commit = false;
conn.setAutoCommit(false);
try {
PreparedStatement pstm = conn.p... | private static void zipFolder(File folder, ZipOutputStream zipOutputStream, String relativePath) throws IOException {
File[] children = folder.listFiles();
for (int i = 0; i < children.length; i++) {
File child = children[i];
if (child.isFile()) {
String zipEn... | false |
899,990 | 23,243,320 | 5,271,062 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | private void copyThemeProviderClass() throws Exception {
InputStream is = getClass().getResourceAsStream("/zkthemer/ThemeProvider.class");
if (is == null) throw new RuntimeException("Cannot find ThemeProvider.class");
File outFile = new File(theme.getJarRootFile(), "zkthemer/ThemeProvider.cl... | false |
899,991 | 8,267,306 | 18,623,183 | public void testWriteThreadsNoCompression() throws Exception {
Bootstrap bootstrap = new Bootstrap();
bootstrap.loadProfiles(CommandLineProcessorFactory.PROFILE.DB, CommandLineProcessorFactory.PROFILE.REST_CLIENT, CommandLineProcessorFactory.PROFILE.COLLECTOR);
final LocalLogFileWriter write... | 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 |
899,992 | 18,176,215 | 6,028,953 | public int readLines() {
int i = 0;
if (istream == null) return 0;
try {
String s1;
if ((new String("http")).compareTo(url.getProtocol()) == 0) {
istream = url.openConnection();
if (last_contentLenght != istream.getContentLength()) {
... | public final int connectAndLogin(Uri u, boolean cwd) throws UnknownHostException, IOException, InterruptedException {
if (ftp.isLoggedIn()) {
if (cwd) {
String path = u.getPath();
if (path != null) ftp.setCurrentDir(path);
}
return WAS_IN;
... | false |
899,993 | 13,431,536 | 10,359,449 | @Override
public int updateStatus(UserInfo userInfo, String status) throws Exception {
OAuthConsumer consumer = SnsConstant.getOAuthConsumer(SnsConstant.SOHU);
consumer.setTokenWithSecret(userInfo.getAccessToken(), userInfo.getAccessSecret());
try {
URL url = new URL(SnsConst... | protected Class findClass(String name) throws ClassNotFoundException {
String classFile = name.replace('.', '/') + ".class";
InputStream classInputStream = null;
if (this.extensionJars != null) {
for (int i = 0; i < this.extensionJars.length; i++) {
JarFile extens... | false |
899,994 | 17,662,180 | 5,596,825 | public XlsBook(String path) throws IOException {
boolean isHttp = path.startsWith("http://");
InputStream is = null;
if (isHttp) {
URL url = new URL(path);
is = url.openStream();
} else {
File file = new File(path);
is = new FileInputSt... | public ZIPSignatureService(InputStream documentInputStream, SignatureFacet signatureFacet, OutputStream documentOutputStream, RevocationDataService revocationDataService, TimeStampService timeStampService, String role, IdentityDTO identity, byte[] photo, DigestAlgo signatureDigestAlgo) throws IOException {
... | false |
899,995 | 18,046,659 | 16,830,682 | public String fetch(final String address) throws EncoderException {
final String escapedAddress = new URLCodec().encode(address);
final String requestUrl = GeoCodeFetch.urlXmlPath + "&" + "address=" + escapedAddress;
this.log.debug("requestUrl: {}", requestUrl);
try {
fin... | public void install(Session session) throws Exception {
String cfgPath = ConfigurationFactory.getConfigSonInstance().getConfigurationPath();
File setupKson = new File(cfgPath, "setup.kson");
InputStream is = null;
if (setupKson.exists()) {
log.debug("Reagind kson from " +... | false |
899,996 | 21,704,695 | 12,754,505 | public String hmacSHA256(String message, byte[] key) {
MessageDigest sha256 = null;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new java.lang.AssertionError(this.getClass().getName() + ".hmacSHA256(): SHA-256 algor... | public static final String MD5(String value) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String newValue = hash.toString(16);
return newValue;
}... | true |
899,997 | 1,630,148 | 13,361,852 | public static void replaceEntry(File file, String entryName, InputStream stream) throws PersistenceException {
try {
File temporaryFile = File.createTempFile("pmMDA_zargo", ".zargo");
temporaryFile.deleteOnExit();
FileInputStream inputStream = new FileInputStream(file);
... | public static File copyFile(File from, File to) throws IOException {
FileOutputStream fos = new FileOutputStream(to);
FileInputStream fis = new FileInputStream(from);
FileChannel foc = fos.getChannel();
FileChannel fic = fis.getChannel();
foc.transferFrom(fic, 0, fic.size());... | true |
899,998 | 5,506,808 | 20,514,913 | public void testTransactions0010() throws Exception {
Statement stmt = con.createStatement();
stmt.executeUpdate("create table #t0010 " + " (i integer not null, " + " s char(10) not null) ");
con.setAutoCommit(false);
PreparedStatement pstmt = con.prepareStatement("in... | private void saveCampaign() throws HeadlessException {
try {
dbConnection.setAutoCommit(false);
dbConnection.setSavepoint();
String sql = "UPDATE campaigns SET " + "queue = ? ," + "adjustRatioPeriod = ?, " + "asterisk = ?, " + "context = ?," + "extension = ?, " + "dialCon... | true |
899,999 | 2,426,161 | 15,002,153 | public void readURL(URL url) throws IOException, ParserConfigurationException, SAXException {
URLConnection connection;
if (proxy == null) {
connection = url.openConnection();
} else {
connection = url.openConnection(proxy);
}
connection.setConnectTime... | 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 ... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.