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,000 | 9,727,050 | 6,061,403 | private PrecomputedAnimatedModel loadPrecomputedModel_(URL url) {
if (precompCache.containsKey(url.toExternalForm())) {
return (precompCache.get(url.toExternalForm()).copy());
}
TextureLoader.getInstance().getTexture("");
List<SharedGroup> frames = new ArrayList<SharedGro... | 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.... | false |
899,001 | 7,118,204 | 20,523,308 | private static String doGetForSessionKey(String authCode) throws Exception {
String sessionKey = "";
HttpClient hc = new DefaultHttpClient();
HttpGet hg = new HttpGet(Common.TEST_SESSION_HOST + Common.TEST_SESSION_PARAM + authCode);
HttpResponse hr = hc.execute(hg);
BufferedR... | public String getPassword(URI uri) {
if (_getPassword(uri) != null) return _getPassword(uri);
String result = null;
try {
String sUri = scrubURI(uri);
URL url = new URL(TEMP_PASSWORD_SERVICE_URL + "?SID=" + sessionId + "&ruri=" + URLEncoder.encode(sUri, "UTF-8"));
... | false |
899,002 | 22,066,329 | 12,257,332 | protected final void loadLogFile(String filename) throws IOException {
cleanUp(true, false);
InputStream is = null;
OutputStream os = null;
File f = File.createTempFile("log", null);
try {
is = getClass().getResourceAsStream(filename);
Assert.isTrue(is... | public synchronized FTPClient getFTPClient(String User, String Password) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("getFTPClient(String, String) - start");
}
while ((counter >= maxClients)) {
try {
wai... | false |
899,003 | 3,691,985 | 2,238,217 | public static void downloadFile(HttpServletResponse response, String file) throws IOException {
response.setContentType(FileUtils.getContentType(file));
response.setContentLength(FileUtils.getContentLength(file));
response.setHeader("Content-type", ResponseUtils.DOWNLOAD_CONTENT_TYPE);
... | public void includeJs(Group group, Writer out, PageContext pageContext) throws IOException {
includeResource(pageContext, out, RetentionHelper.buildRootRetentionFilePath(group, ".js"), JS_BEGIN_TAG, JS_END_TAG);
ByteArrayOutputStream outtmp = new ByteArrayOutputStream();
if (AbstractGroupBui... | true |
899,004 | 14,259,991 | 2,807,114 | private void sendLocal() throws Exception {
if (validParameters()) {
URL url = new URL(storageUrlString);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
RequestUtils requestUtils = new RequestUtils();
requestUtils.preRequestAdd... | public Controller(String m_hostname, String team, boolean m_shouldexit) throws InternalException {
m_received_messages = new ConcurrentLinkedQueue<ReceivedMessage>();
m_fragmsgs = new ArrayList<String>();
m_customizedtaunts = new HashMap<Integer, String>();
m_nethandler = new Caching... | false |
899,005 | 14,377,058 | 23,677,132 | public String process(URL url) throws IOException {
String line, results = "";
InputStream is = url.openStream();
BufferedReader dis = new BufferedReader(new InputStreamReader(is));
while ((line = dis.readLine()) != null) {
results += line + "\n";
}
System... | public FTPClient sample2(String server, String username, String password) throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException {
FTPClient ftpClient = new FTPClient();
ftpClient.connect(server);
ftpClient.login(username, password);
return ftpClient;
}
| false |
899,006 | 9,952,202 | 946,865 | public void testIntegrityViolation() throws Exception {
if (getDialect() instanceof MySQLMyISAMDialect) {
reportSkip("MySQL (ISAM) does not support FK violation checking", "exception conversion");
return;
}
SQLExceptionConverter converter = getDialect().buildSQLExcept... | 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,007 | 16,663,549 | 1,244,216 | private void prepareQueryResultData(ZipEntryRef zer, String nodeDir, String reportDir, Set<ZipEntryRef> statusZers) throws Exception {
String jobDir = nodeDir + File.separator + "job_" + zer.getUri();
if (!WorkDirectory.isWorkingDirectoryValid(jobDir)) {
throw new Exception("Cannot acces... | public String postEvent(EventDocument eventDoc, Map attachments) {
if (eventDoc == null || eventDoc.getEvent() == null) return null;
if (queue == null) {
sendEvent(eventDoc, attachments);
return eventDoc.getEvent().getEventId();
}
if (attachments != null) {
... | true |
899,008 | 15,535,344 | 15,287,816 | public void testDoubleNaN() {
double value = 0;
boolean wasEqual = false;
String message = "DB operation completed";
String ddl1 = "DROP TABLE t1 IF EXISTS;" + "CREATE TABLE t1 ( d DECIMAL, f DOUBLE, l BIGINT, i INTEGER, s SMALLINT, t TINYINT, " + "dt DATE DEFAULT CURRENT_DATE, ti TI... | public Vector<Question> reload() throws IOException {
Vector<Question> questions = new Vector<Question>();
InputStream is = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
shortName = br.readLine();
if (shortName != null && shortName.equal... | false |
899,009 | 9,857,411 | 23,677,117 | @Override
public void checkConnection(byte[] options) throws Throwable {
Properties opts = PropertiesUtils.deserializeProperties(options);
String server = opts.getProperty(TRANSFER_OPTION_SERVER);
String username = opts.getProperty(TRANSFER_OPTION_USERNAME);
String password = opt... | public static void copyFile4(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
IOUtils.copy(in, out);
in.close();
out.close();
}
| false |
899,010 | 12,078,160 | 4,341,090 | public String getIpAddress() {
try {
URL url = new URL("http://checkip.dyndns.org");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String linha;
String rtn = "";
while ((linha = in.readLine()) != null) rtn += linh... | public Object run() {
if (type == GET_THEME_DIR) {
String sep = File.separator;
String[] dirs = new String[] { userHome + sep + ".themes", System.getProperty("swing.metacitythemedir"), "/usr/share/themes", "/usr/gnome/share/themes", "/opt/gnome2/share/themes" };
... | false |
899,011 | 17,638,226 | 12,120,684 | public static String hash(final String s) {
if (s == null || s.length() == 0) return null;
try {
final MessageDigest hashEngine = MessageDigest.getInstance("SHA-1");
hashEngine.update(s.getBytes("iso-8859-1"), 0, s.length());
return convertToHex(hashEngine.digest(... | private void getRandomGUID(boolean secure) {
MessageDigest md5;
StringBuilder sbValueBeforeHash = new StringBuilder();
try {
md5 = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
throw new ApplicationIllegalArgumentException(e);
... | true |
899,012 | 7,743,689 | 13,719,500 | private void loadProperties() {
if (properties == null) {
properties = new Properties();
try {
URL url = getClass().getResource(propsFile);
properties.load(url.openStream());
} catch (IOException ioe) {
ioe.printStackTrace()... | private void onDhReply(final SshDhReply msg) throws GeneralSecurityException, IOException {
if ((this.keyPair == null) || this.connection.isServer()) throw new SshException("%s: unexpected %s", this.connection.uri, msg.getType());
final BigInteger k;
{
final DHPublicKeySpec remot... | false |
899,013 | 19,947,818 | 3,375,715 | public boolean update(int idPartida, partida partidaModificada) {
int intResult = 0;
String sql = "UPDATE partida " + "SET torneo_idTorneo = ?, " + " jugador_idJugadorNegras = ?, jugador_idJugadorBlancas = ?, " + " fecha = ?, " + " resultado = ?, " + " nombreBlancas = ?, nombreNegras = ?, eloBlancas... | public void importarHistoricoDeProventos(File pArquivoXLS, boolean pFiltrarPelaDataDeCorteDoCabecalho, Andamento pAndamento) throws IOException, SQLException, InvalidFormatException {
int iLinha = -1;
String nomeDaColuna = "";
Statement stmtLimpezaInicialDestino = null;
OraclePrepare... | true |
899,014 | 390,386 | 22,808,166 | static String fetchURLComposeExternPackageList(String urlpath, String pkglisturlpath) {
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (Malforme... | protected void init() throws MXQueryException {
String add = getStringValueOrEmpty(subIters[0]);
if (add == null) {
currentToken = BooleanToken.FALSE_TOKEN;
return;
}
URI uri;
if (!TypeLexicalConstraints.isValidURI(add)) throw new DynamicException(Erro... | false |
899,015 | 19,541,856 | 14,847,921 | @RequestMapping(value = "/image/{fileName}", method = RequestMethod.GET)
public void getImage(@PathVariable String fileName, HttpServletRequest req, HttpServletResponse res) throws Exception {
File file = new File(STORAGE_PATH + fileName + ".jpg");
res.setHeader("Cache-Control", "no-store");
... | protected static void copyFile(File from, File to) throws IOException {
if (!from.isFile() || !to.isFile()) {
throw new IOException("Both parameters must be files. from is " + from.isFile() + ", to is " + to.isFile());
}
FileChannel in = (new FileInputStream(from)).getChannel();
... | true |
899,016 | 23,496,079 | 36,860 | private void copyTemplate(String resource, OutputStream outputStream) throws IOException {
URL url = Tools.getResource(resource);
if (url == null) {
throw new IOException("could not find resource");
}
BufferedReader reader = new BufferedReader(new InputStreamReader(url.op... | 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... | false |
899,017 | 17,637,279 | 2,711,577 | private static void copy(File source, File dest) throws FileNotFoundException, IOException {
FileInputStream input = new FileInputStream(source);
FileOutputStream output = new FileOutputStream(dest);
System.out.println("Copying " + source + " to " + dest);
IOUtils.copy(input, output)... | private static void _checkConfigFile() throws Exception {
try {
String filePath = getUserManagerConfigPath() + "user_manager_config.properties";
boolean copy = false;
File from = new java.io.File(filePath);
if (!from.exists()) {
Properties prop... | true |
899,018 | 23,370,708 | 19,926,790 | private final long test(final boolean applyFilter, final int executionCount) throws NoSuchAlgorithmException, NoSuchPaddingException, FileNotFoundException, IOException, RuleLoadingException {
final boolean stripHtmlEnabled = true;
final boolean injectSecretTokensEnabled = true;
final boolea... | public void generateReport(AllTestsResult atr, AllConvsResult acr, File nwbConvGraph) {
ConvResult[] convs = acr.getConvResults();
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new FileReader(nwbConvGraph));
writ... | true |
899,019 | 4,707,507 | 14,632,238 | @Override
public HttpResponse execute() throws IOException {
if (this.method == HttpMethod.GET) {
String url = this.toString();
if (url.length() > this.cutoff) {
if (log.isLoggable(Level.FINER)) log.finer("URL length " + url.length() + " too long, converting GET t... | 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,020 | 16,289,496 | 1,685,861 | public static void reset() throws Exception {
Session session = DataStaticService.getHibernateSessionFactory().openSession();
try {
Connection connection = session.connection();
try {
Statement statement = connection.createStatement();
try {
... | public static String SHA(String s) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(s.getBytes(), 0, s.getBytes().length);
byte[] hash = md.digest();
StringBuilder sb = new StringBuilder();
int msb;
int lsb = 0;
... | false |
899,021 | 4,477,205 | 19,394,412 | private static void copyFile(File srcFile, File destFile, long chunkSize) throws IOException {
FileInputStream is = null;
FileOutputStream os = null;
try {
is = new FileInputStream(srcFile);
FileChannel iChannel = is.getChannel();
os = new FileOutputStream... | public static long checksum(IFile file) throws IOException {
InputStream contents;
try {
contents = file.getContents();
} catch (CoreException e) {
throw new CausedIOException("Failed to calculate checksum.", e);
}
CheckedInputStream in = new CheckedIn... | true |
899,022 | 9,186,582 | 16,008,963 | private static void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException {
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
return;
}
File outputFile = new File(outputDir, entry.getName());
if (!outputFile.g... | public static void unzip(final File file, final ZipFile zipFile, final File targetDirectory) throws PtException {
LOG.info("Unzipping zip file '" + file.getAbsolutePath() + "' to directory " + "'" + targetDirectory.getAbsolutePath() + "'.");
assert (file.exists() && file.isFile());
if (targe... | true |
899,023 | 13,522,884 | 4,424,457 | private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/html");
ServletContext ctx = getServletContext();
RequestDispatcher rd = ctx.getRequestDispatcher(SETUP_JSP);
HttpSession session = request.getSess... | public static void main(String[] args) throws IOException {
long start = System.currentTimeMillis();
FileResourceManager frm = CommonsTransactionContext.configure(new File("C:/tmp"));
try {
frm.start();
} catch (ResourceManagerSystemException e) {
throw new Ru... | true |
899,024 | 15,917,727 | 9,168,699 | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException nsae) {
nsae.printStackTrace();
}
}
try {
digest.up... | public void insertArchiveEntries(ArchiveEntry entries[]) throws WeatherMonitorException {
String sql = null;
try {
Connection con = getConnection();
Statement stmt = con.createStatement();
ResultSet rslt = null;
con.setAutoCommit(false);
fo... | false |
899,025 | 10,993,811 | 20,282,669 | Bitmap downloadImage(String uri) {
try {
mGetMethod.setURI(new URI(uri));
HttpResponse resp = mClient.execute(mGetMethod);
if (resp.getStatusLine().getStatusCode() < 400) {
InputStream is = resp.getEntity().getContent();
... | public void deleteSynchrnServerFile(SynchrnServerVO synchrnServerVO) throws Exception {
FTPClient ftpClient = new FTPClient();
ftpClient.setControlEncoding("euc-kr");
if (!EgovWebUtil.isIPAddress(synchrnServerVO.getServerIp())) {
throw new RuntimeException("IP is needed. (" + syn... | false |
899,026 | 8,917,665 | 21,570,957 | public static void copyAll(URL url, StringBuilder ret) {
Reader in = null;
try {
in = new InputStreamReader(new BufferedInputStream(url.openStream()));
copyAll(in, ret);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
... | private static long saveAndClosePDFDocument(PDDocument document, OutputStreamProvider outProvider) throws IOException, COSVisitorException {
File tempFile = null;
InputStream in = null;
OutputStream out = null;
try {
tempFile = File.createTempFile("temp", "pdf");
... | false |
899,027 | 11,903,969 | 567,313 | private ShaderProgram loadShaderProgram() {
ShaderProgram sp = null;
String vertexProgram = null;
String fragmentProgram = null;
Shader[] shaders = new Shader[2];
try {
ClassLoader cl = this.getClass().getClassLoader();
URL url = cl.getResource("Shader... | 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,028 | 12,914,531 | 2,046,158 | public int procesar() {
int mas = 0;
String uriOntologia = "", source = "", uri = "";
String fichOrigenHTML = "", fichOrigenLN = "";
String ficheroOutOWL = "";
md5 firma = null;
StringTokenV2 entra = null, entra2 = null, entra3 = null;
FileInputStream lengNat ... | String chooseHGVersion(String version) {
String line = "";
try {
URL connectURL = new URL("http://genome.ucsc.edu/cgi-bin/hgGateway?db=" + version);
InputStream urlStream = connectURL.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(u... | false |
899,029 | 17,981,986 | 7,872,661 | public void saveProjectFile(File aFile) {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
File destDir = new File(theProjectsDirectory, sdf.format(Calendar.getInstance().getTime()));
if (destDir.mkdirs()) {
File outFile = new File(destDir, "project.xml");
... | private static boolean genMovieRatingFile(String completePath, String masterFile, String CustLocationsFileName, String MovieRatingFileName) {
try {
File inFile1 = new File(completePath + fSep + "SmartGRAPE" + fSep + masterFile);
FileChannel inC1 = new FileInputStream(inFile1).getChan... | true |
899,030 | 12,544,033 | 10,062,078 | private File Gzip(File f) throws IOException {
if (f == null || !f.exists()) return null;
File dest_dir = f.getParentFile();
String dest_filename = f.getName() + ".gz";
File zipfile = new File(dest_dir, dest_filename);
GZIPOutputStream out = new GZIPOutputStream(new FileOutpu... | private void copy(File fin, File fout) throws IOException {
FileOutputStream out = null;
FileInputStream in = null;
try {
out = new FileOutputStream(fout);
in = new FileInputStream(fin);
byte[] buf = new byte[2048];
int read = in.read(buf);
... | true |
899,031 | 793,386 | 234,104 | public void bubbleSort(int[] arr) {
BasicProcessor.getInstance().getStartBlock();
BasicProcessor.getInstance().getVarDeclaration();
boolean swapped = true;
BasicProcessor.getInstance().getVarDeclaration();
int j = 0;
BasicProcessor.getInstance().getVarDeclaration();
... | public static void main(String[] argv) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (Exception e) {
e.printStackTrace();
}
md.update("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq".getBytes(), 0, 56);
... | false |
899,032 | 831,650 | 18,880,056 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static File extract(File source, String filename, File target) {
if (source.exists() == false || filename == null || filename.trim().length() < 1 || target == null) return null;
boolean isDirectory = (filename.lastIndexOf("/") == filename.length() - 1);
try {
Map contents ... | true |
899,033 | 301,804 | 3,298,287 | static String fetchURLComposeExternPackageList(String urlpath, String pkglisturlpath) {
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (Malforme... | public static String remove_tag(String sessionid, String absolutePathForTheSpesificTag) {
String resultJsonString = "some problem existed inside the create_new_tag() function if you see this string";
try {
Log.d("current running function name:", "remove_tag");
HttpClient http... | false |
899,034 | 7,996,909 | 17,615,292 | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | public BufferedImage processUsingTemp(InputStream input, DjatokaDecodeParam params) throws DjatokaException {
File in;
try {
in = File.createTempFile("tmp", ".jp2");
FileOutputStream fos = new FileOutputStream(in);
in.deleteOnExit();
IOUtils.copyStream... | false |
899,035 | 608,747 | 21,361,961 | 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 transform(CommandLine commandLine) throws IOException {
Reader reader;
if (commandLine.hasOption('i')) {
reader = createFileReader(commandLine.getOptionValue('i'));
} else {
reader = createStandardInputReader();
}
Writer writer;
if... | true |
899,036 | 7,872,663 | 5,704,569 | private static boolean prepareQualifyingFile(String completePath, String outputFile) {
try {
File inFile = new File(completePath + fSep + "qualifying.txt");
FileChannel inC = new FileInputStream(inFile).getChannel();
BufferedReader br = new BufferedReader(new FileReader(i... | public static void copy(File src, File dest) throws IOException {
if (!src.exists()) {
throw new IOException(StaticUtils.format(OStrings.getString("LFC_ERROR_FILE_DOESNT_EXIST"), new Object[] { src.getAbsolutePath() }));
}
FileInputStream fis = new FileInputStream(src);
d... | true |
899,037 | 2,711,645 | 10,891,166 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static Image getPluginImage(Object plugin, String name) {
try {
try {
URL url = getPluginImageURL(plugin, name);
if (m_URLImageMap.containsKey(url)) return m_URLImageMap.get(url);
InputStream is = url.openStream();
Image imag... | false |
899,038 | 12,690,725 | 20,028,789 | public void login(String a_username, String a_password) throws GB_SecurityException {
Exception l_exception = null;
try {
if (clientFtp == null) {
clientFtp = new FTPClient();
clientFtp.connect("ftp://" + ftp);
}
boolean b = clientF... | private static BundleInfo[] getBundleInfoArray(String location) throws IOException {
URL url = new URL(location + BUNDLE_LIST_FILE);
BufferedReader br = null;
List<BundleInfo> list = new ArrayList<BundleInfo>();
try {
br = new BufferedReader(new InputStreamReader(url.open... | false |
899,039 | 8,292,297 | 5,562,616 | public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("GET REQUEST OR RESPONSE - Send content: " + file.getAbsolutePath());
FileInputStream in = null;
try {
in = new FileInputStream(file);
... | public void convert(CSVReader reader, Writer writer, int nbTotalRows) throws IOException, InterruptedException {
Validate.notNull(reader, "CSVReader");
Validate.notNull(writer, "Writer");
Writer bufferedWriter = new BufferedWriter(writer);
File fileForColsDef = createTempFileForCss()... | true |
899,040 | 15,209,427 | 908,793 | private void bokActionPerformed(java.awt.event.ActionEvent evt) {
if (this.tfGeneralSubDivision.getText().trim().equals("")) {
this.showWarningMessage("Enter general sub division");
} else {
String[] patlib = newgen.presentation.NewGenMain.getAppletInstance().getPatronLibrary... | 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,041 | 2,602,107 | 3,265,819 | public OutputStream getAsOutputStream() throws IOException {
OutputStream out;
if (contentStream != null) {
File tmp = File.createTempFile(getId(), null);
out = new FileOutputStream(tmp);
IOUtils.copy(contentStream, out);
} else {
out = new Byt... | @Test
public void testLargePut() throws Throwable {
int size = CommonParameters.BLOCK_SIZE;
InputStream is = new FileInputStream(_fileName);
RepositoryFileOutputStream ostream = new RepositoryFileOutputStream(_nodeName, _putHandle, CommonParameters.local);
int readLen = 0;
... | true |
899,042 | 10,236,285 | 5,433,054 | @Override
protected Set<DataRecord> retrieveRecords(DataTemplate template) {
String query = template.getQuery();
if (query == null) {
query = topic;
}
String select = prefix + " SELECT ?resource WHERE { { ?resource rdf:type " + "<http://dbpedia.org/class/yago/" + Stri... | public static String getRefCatastral(String pURL) {
String result = new String();
String iniPC1 = "<pc1>";
String iniPC2 = "<pc2>";
String finPC1 = "</pc1>";
String finPC2 = "</pc2>";
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String in... | false |
899,043 | 22,075,089 | 21,929,693 | public static void executa(String arquivo, String filial, String ip) {
String drive = arquivo.substring(0, 2);
if (drive.indexOf(":") == -1) drive = "";
Properties p = Util.lerPropriedades(arquivo);
String servidor = p.getProperty("servidor");
String impressora = p.getPropert... | private void importUrl(String str) throws Exception {
URL url = new URL(str);
InputStream xmlStream = url.openStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
MessageHolder messages = MessageHolder.getInstance();
DocumentBuilder builder = facto... | false |
899,044 | 16,788,944 | 12,528,437 | private void refreshCacheFile(RepositoryFile file, File cacheFile) throws FileNotFoundException, IOException {
FileOutputStream fos = new FileOutputStream(cacheFile);
InputStream is = file.getInputStream();
int count = IOUtils.copy(is, fos);
logger.debug("============================... | public static void main(String[] args) throws Exception {
SocketConnector socketConnector = new SocketConnector();
socketConnector.setPort(6080);
SslSocketConnector sslSocketConnector = new SslSocketConnector();
sslSocketConnector.setPort(6443);
String serverKeystore = MockHt... | true |
899,045 | 17,116,113 | 5,903,539 | public void deleteSingle(String tbName, String idFld, String id) throws Exception {
String tmp = "";
PreparedStatement prepStmt = null;
try {
if (tbName == null || tbName.length() == 0 || id == null || id.length() == 0) throw new Exception("Invalid parameter");
con = ... | public int next() {
int sequenceValue = current();
try {
Update update = dbi.getUpdate();
update.setTableName(sequenceTable);
update.assignValue("SEQUENCE_VALUE", --sequenceValue);
Search search = new Search();
search.addAttributeCriteria(s... | true |
899,046 | 1,189,509 | 12,335,897 | 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... | protected void assignListeners() {
groupsList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
refreshInfo();
}
});
saveButton.addActionListener(new ActionListener() {
... | true |
899,047 | 7,366,687 | 16,532,304 | public static void DecodeMapFile(String mapFile, String outputFile) throws Exception {
byte magicKey = 0;
byte[] buffer = new byte[2048];
int nread;
InputStream map;
OutputStream output;
try {
map = new FileInputStream(mapFile);
} catch (Exception ... | private void putAlgosFromJar(File jarfile, AlgoDir dir, Model model) throws FileNotFoundException, IOException {
URLClassLoader urlLoader = new URLClassLoader(new URL[] { jarfile.toURI().toURL() });
JarInputStream jis = new JarInputStream(new FileInputStream(jarfile));
JarEntry entry = jis.g... | true |
899,048 | 6,569,409 | 21,781,575 | public String obfuscateString(String string) {
String obfuscatedString = null;
try {
MessageDigest md = MessageDigest.getInstance(ENCRYPTION_ALGORITHM);
md.update(string.getBytes());
byte[] digest = md.digest();
obfuscatedString = new String(Base64.enc... | 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,049 | 13,879,984 | 13,344,290 | public static String readFromURL(String urlStr) throws IOException {
URL url = new URL(urlStr);
StringBuilder sb = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != nul... | public static int best(int r, int n, int s) {
if ((n <= 0) || (r < 0) || (r > n) || (s < 0)) return 0;
int[] rolls = new int[n];
for (int i = 0; i < n; i++) rolls[i] = d(s);
boolean found;
do {
found = false;
for (int x = 0; x < n - 1; x++) {
... | false |
899,050 | 12,977,779 | 9,520,695 | public void run() {
FileInputStream src;
FileOutputStream dest;
try {
dest = new FileOutputStream(srcName);
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
}
FileChannel destC = dest.getChannel();
FileChanne... | public void parseFile(String dataurl, URL documentBase) {
DataInputStream in;
if (_debug > 2) System.out.println("PlotBox: parseFile(" + dataurl + " " + documentBase + ") _dataurl = " + _dataurl + " " + _documentBase);
if (dataurl == null || dataurl.length() == 0) {
in = new Data... | false |
899,051 | 14,287,646 | 11,200,354 | private String getStoreName() {
try {
final MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(protectionDomain.getBytes());
final byte[] bs = digest.digest();
final StringBuffer sb = new StringBuffer(bs.length * 2);
for (int i ... | private boolean authenticate(String reply) {
String user = reply.substring(0, reply.indexOf(" "));
String resp = reply.substring(reply.indexOf(" ") + 1);
if (!module.users.contains(user)) {
error = "so such user " + user;
return false;
}
try {
... | true |
899,052 | 7,110,836 | 5,375,381 | private void copyFile(File dir, File fileToAdd) {
try {
byte[] readBuffer = new byte[1024];
File file = new File(dir.getCanonicalPath() + File.separatorChar + fileToAdd.getName());
if (file.createNewFile()) {
FileInputStream fis = new FileInputStream(fileT... | public 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();
}
| true |
899,053 | 3,993,124 | 19,478,367 | private File getTempFile(DigitalObject object, String pid) throws Exception {
File directory = new File(tmpDir, object.getId());
File target = new File(directory, pid);
if (!target.exists()) {
target.getParentFile().mkdirs();
target.createNewFile();
}
... | public void init(String[] arguments) {
if (arguments.length < 1) {
printHelp();
return;
}
String[] valid_args = new String[] { "device*", "d*", "help", "h", "speed#", "s#", "file*", "f*", "gpsd*", "nmea", "n", "garmin", "g", "sirf", "i", "rawdata", "downloadtracks", "... | true |
899,054 | 8,063,675 | 7,419,810 | private static int ejecutaUpdate(String database, String SQL) throws Exception {
int i = 0;
DBConnectionManager dbm = null;
Connection bd = null;
try {
dbm = DBConnectionManager.getInstance();
bd = dbm.getConnection(database);
Statement st = bd.cre... | static void test() throws SQLException {
Connection conn = null;
Statement st = null;
ResultSet rs = null;
Savepoint sp = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
st = conn.createStatement();
Stri... | true |
899,055 | 5,145,801 | 9,176,940 | public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser("");
fc.setMultiSelectionEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int option = 0;
boolean save = m_data != null;
if (save) option = fc.showSaveDialog(this); else o... | public static void copyFile(File in, File out, boolean read, boolean write, boolean execute) throws FileNotFoundException, IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
File outFile = null;
if (out.isDirectory()) {
outFile = new File(out.getAbsoluteP... | true |
899,056 | 3,046,107 | 22,942,858 | public GGProvinces getListProvinces() throws IllegalStateException, GGException, Exception {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("method", "gg.photos.geo.getListProvinces"));
qparams.add(new BasicNameValuePair("key", this.key));
... | public void readHTMLFromURL(URL url) throws IOException {
InputStream in = url.openStream();
try {
readHTMLFromStream(new InputStreamReader(in));
} finally {
try {
in.close();
} catch (IOException ex) {
Logger.getLogger(HTML... | false |
899,057 | 22,626,443 | 15,599,609 | public static File jar(File in, String outArc, File tempDir, PatchConfigXML conf) {
FileOutputStream arcFile = null;
JarOutputStream jout = null;
DirectoryScanner ds = null;
ds = new DirectoryScanner();
ds.setCaseSensitive(true);
ds.setBasedir(in);
ds.scan();
... | private void addAuditDatastream() throws ObjectIntegrityException, StreamIOException {
if (m_obj.getAuditRecords().size() == 0) {
return;
}
String dsId = m_pid.toURI() + "/AUDIT";
String dsvId = dsId + "/" + DateUtility.convertDateToString(m_obj.getCreateDate());
... | true |
899,058 | 22,422,244 | 13,531,653 | protected Source getStylesheetSource(Resource stylesheetLocation) throws ApplicationContextException {
if (logger.isDebugEnabled()) {
logger.debug("Loading XSLT stylesheet from " + stylesheetLocation);
}
try {
URL url = stylesheetLocation.getURL();
String ... | private static String processRequest(String request, HttpMethod method) {
SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
URI uri = null;
try {
uri = new URI(request);
ClientHttpRequest clientHttpRequest = simpleCl... | false |
899,059 | 4,013,485 | 11,751,886 | void copyFileOnPeer(String path, RServerInfo peerserver, boolean allowoverwrite) throws IOException {
RFile file = new RFile(path);
OutputStream out = null;
FileInputStream in = null;
try {
in = fileManager.openFileRead(path);
out = localClient.openWrite(file,... | public void run() {
waiting(200);
try {
URL url = new URL(urlAddress);
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
... | false |
899,060 | 15,209,427 | 21,674,149 | private void bokActionPerformed(java.awt.event.ActionEvent evt) {
if (this.tfGeneralSubDivision.getText().trim().equals("")) {
this.showWarningMessage("Enter general sub division");
} else {
String[] patlib = newgen.presentation.NewGenMain.getAppletInstance().getPatronLibrary... | public static String md5(String text, String charset) {
MessageDigest msgDigest = null;
try {
msgDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("System doesn't support MD5 algorithm.");
}
... | false |
899,061 | 1,962,494 | 11,188,584 | public void widgetSelected(SelectionEvent event) {
try {
URL url = new URL(PKBMain.PRODUCT_WEBSITE + "/latest-version.txt");
Properties prop = new Properties();
prop.load(url.openStream());
Package currentPackage... | public static void loadPlugins() {
Logger.trace("Loading plugins");
Enumeration<URL> urls = null;
try {
urls = Play.classloader.getResources("play.plugins");
} catch (Exception e) {
}
while (urls != null && urls.hasMoreElements()) {
URL url = u... | false |
899,062 | 3,024,989 | 310,580 | @Test
public void testCopy_readerToOutputStream_Encoding_nullOut() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
Reader reader = new InputStreamReader(in, "US-ASCII");
try {
IOUtils.copy(reader, (OutputS... | 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,063 | 418,257 | 15,683,090 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | private void doUpload(UploadKind uploadKind, WriteKind writeKind) throws Exception {
int n = 512 * 1024;
AtomicInteger total = new AtomicInteger(0);
ServerSocket ss = startSinkServer(total);
URL url = new URL("http://localhost:" + ss.getLocalPort() + "/test1");
HttpURLConnect... | false |
899,064 | 841,792 | 17,340,376 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | private static String fetchImageViaHttp(URL imgUrl) throws IOException {
String sURL = imgUrl.toString();
String imgFile = imgUrl.getPath();
HttpURLConnection cnx = (HttpURLConnection) imgUrl.openConnection();
String uri = null;
try {
cnx.setAllowUserInteraction(f... | false |
899,065 | 18,893,033 | 17,083,224 | private void doDissemTest(String what, boolean redirectOK) throws Exception {
final int num = 30;
System.out.println("Getting " + what + " " + num + " times...");
int i = 0;
try {
URL url = new URL(BASE_URL + "/get/" + what);
for (i = 0; i < num; i++) {
... | public List<String> extractUrlList(String url) throws IOException, XPathExpressionException {
LinkedList<String> list = new LinkedList<String>();
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
Tidy tidy = new Tidy();
tidy.setErrout(new NullPrintWriter());... | false |
899,066 | 4,594,844 | 9,693,856 | @Override
public void execute() throws BuildException {
final String GC_USERNAME = "google-code-username";
final String GC_PASSWORD = "google-code-password";
if (StringUtils.isBlank(this.projectName)) throw new BuildException("undefined project");
if (this.file == null) throw new... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
899,067 | 7,532,475 | 13,243,880 | private String getLatestVersion(URL url) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.connect();
BufferedReader br = new BufferedReader(new InputStreamReader(new BufferedInputStream(con.getInputStream())));
String lines = "";
Stri... | public int[] bubbleSort(int[] data) {
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data.length - i - 1; j++) {
if (data[j] > data[j + 1]) {
int temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
... | false |
899,068 | 21,868,018 | 14,275,711 | public void process() throws Exception {
String searchXML = FileUtils.readFileToString(new File(getSearchRequestRelativeFilePath()));
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put("searchXML", searchXML);
String proxyHost = null;
int pro... | private void initSerializerFiles(String fileName, HashSet<String> fileList, HashMap<Class, Class> classMap, Class type) {
try {
ClassLoader classLoader = getClassLoader();
if (classLoader == null) return;
Enumeration iter;
iter = classLoader.getResources(fileN... | false |
899,069 | 16,830,463 | 1,977,837 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (log.isTraceEnabled()) {
log.trace("doGet(requestURI=" + request.getRequestURI() + ")");
}
ServletConfig sc = getServletConfig();
String ... | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | false |
899,070 | 16,375,558 | 21,609,545 | private void sort() {
for (int i = 0; i < density.length; i++) {
for (int j = density.length - 2; j >= i; j--) {
if (density[j] > density[j + 1]) {
KDNode n = nonEmptyNodesArray[j];
nonEmptyNodesArray[j] = nonEmptyNodesArray[j + 1];
... | public static JSONObject update(String name, String uid, double lat, double lon, boolean online) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpPost post = new HttpPost(UPDATE_URI);
List<NameValuePair> parameters = new Arra... | false |
899,071 | 892,621 | 658,771 | 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 main(String[] args) throws Exception {
String codecClassname = args[0];
Class<?> codecClass = Class.forName(codecClassname);
Configuration conf = new Configuration();
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, conf);
... | true |
899,072 | 3,400,236 | 23,004,976 | public boolean verifySignature() {
try {
byte[] data = readFile(name + ".tmp1.bin");
if (data == null) return false;
if (data[data.length - 0x104] != 'N' || data[data.length - 0x103] != 'G' || data[data.length - 0x102] != 'I' || data[data.length - 0x101] != 'S') return fa... | static String hash(String text) {
try {
StringBuffer plugins = new StringBuffer();
for (PlayPlugin plugin : Play.plugins) {
plugins.append(plugin.getClass().getName());
}
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
... | true |
899,073 | 536,114 | 10,220,823 | 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... | @Test
public void testCopy() throws IOException {
final byte[] input = { 0x00, 0x01, 0x7F, 0x03, 0x40 };
final byte[] verification = input.clone();
Assert.assertNotSame("Expecting verification to be a new array.", input, verification);
final ByteArrayInputStream in = new ByteArra... | true |
899,074 | 15,957,269 | 21,318,345 | public void read() throws LogicException {
try {
File file = new File(filename);
URL url = file.toURI().toURL();
source = new Source(url.openConnection());
} catch (Exception e) {
throw new LogicException("Failed to read " + filename + " !", e);
... | public static void loadMemcachedConfigFromURL(URL url, XMLInputFactory factory, List<MemcachedClientConfig> memcachedClientconfigs, List<MemcachedClientSocketPoolConfig> memcachedClientSocketPoolConfigs, List<MemcachedClientClusterConfig> memcachedClientClusterConfig) {
MemcachedClientConfig node = null;
... | false |
899,075 | 7,321,949 | 5,428,177 | private boolean saveLOBDataToFileSystem() {
if ("".equals(m_attachmentPathRoot)) {
log.severe("no attachmentPath defined");
return false;
}
if (m_items == null || m_items.size() == 0) {
setBinaryData(null);
return true;
}
final ... | public void invoke() throws IOException {
String[] command = new String[files.length + options.length + 2];
command[0] = chmod;
System.arraycopy(options, 0, command, 1, options.length);
command[1 + options.length] = perms;
for (int i = 0; i < files.length; i++) {
... | true |
899,076 | 4,988,270 | 23,053,699 | 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... | public void copy(File from, String to) throws SystemException {
assert from != null;
File dst = new File(folder, to);
dst.getParentFile().mkdirs();
FileChannel in = null;
FileChannel out = null;
try {
if (!dst.exists()) dst.createNewFile();
in ... | true |
899,077 | 6,198,171 | 4,673,959 | public static JSONObject doJSONQuery(String urlstr) throws IOException, MalformedURLException, JSONException, SolrException {
URL url = new URL(urlstr);
HttpURLConnection con = null;
try {
con = (HttpURLConnection) url.openConnection();
BufferedReader in = new Buffere... | public static String createRecoveryContent(String password) {
try {
password = encryptGeneral1(password);
String data = URLEncoder.encode("key", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
URL url = new URL("https://mypasswords-server.appspot.com/recovery_file"... | true |
899,078 | 18,723,566 | 411,631 | public String performRequest(TreeMap<String, String> params, boolean isAuthenticated) {
params.put("format", "json");
try {
URL url = new URL(getApiUrl(params, isAuthenticated));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMet... | 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.... | false |
899,079 | 3,086,853 | 17,597,670 | protected Icon newIcon(String iconName) {
URL url = Utils.getResource(getFullPath(iconName, "/"), getClass());
if (url == null) {
if (getParent() != null) return getParent().getIcon(iconName);
return null;
}
try {
MethodCall getImage = new MethodCa... | @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... | false |
899,080 | 1,977,263 | 18,972,686 | private String fetchCompareContent() throws IOException {
URL url = new URL(compareTo);
StringWriter sw = new StringWriter();
IOUtils.copy(url.openStream(), sw);
return sw.getBuffer().toString();
}
| public void jsFunction_addFile(ScriptableFile infile) throws IOException {
if (!infile.jsFunction_exists()) throw new IllegalArgumentException("Cannot add a file that doesn't exists to an archive");
ZipArchiveEntry entry = new ZipArchiveEntry(infile.getName());
entry.setSize(infile.jsFunctio... | true |
899,081 | 13,826,024 | 6,298,465 | public static void copyFile(String source, String destination, boolean overwrite) {
File sourceFile = new File(source);
try {
File destinationFile = new File(destination);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(sourceFile));
Buffered... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
if (System.getProperty("os.name").toUpperCase().indexOf("WIN") != -1) {
... | true |
899,082 | 4,932,274 | 10,685,269 | public void testCommitRollback() throws Exception {
Statement stmt = con.createStatement();
assertNotNull(stmt);
assertTrue(con.getAutoCommit());
stmt.execute("CREATE TABLE #TESTCOMMIT (id int primary key)");
con.setAutoCommit(false);
assertFalse(con.getAutoCommit());... | public static void copy(FileInputStream source, FileOutputStream target) throws IOException {
FileChannel sourceChannel = source.getChannel();
FileChannel targetChannel = target.getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChannel);
sourceChannel.close();
... | false |
899,083 | 22,538,273 | 13,216,961 | 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 void actionPerformed(ActionEvent ev) {
if (fileChooser == null) {
fileChooser = new JFileChooser();
ExtensionFileFilter fileFilter = new ExtensionFileFilter("Device profile (*.jar, *.zip)");
fileFilter.addExtension("jar");
fileFi... | true |
899,084 | 19,579,830 | 5,258,165 | 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 {
... | private static boolean copyFile(File src, File dest) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
for (int c = fis.read(); c != -1; c = fis.read()) fos.write(c);
... | true |
899,085 | 8,317,691 | 7,039,646 | protected void copyFile(File src, File dest) throws Exception {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel destChannel = new FileOutputStream(dest).getChannel();
long transferred = destChannel.transferFrom(srcChannel, 0, srcChannel.size());
... | private static final void cloneFile(File origin, File target) throws IOException {
FileChannel srcChannel = null;
FileChannel destChannel = null;
try {
srcChannel = new FileInputStream(origin).getChannel();
destChannel = new FileOutputStream(target).getChannel();
... | true |
899,086 | 4,262,083 | 20,881,388 | @Override
public boolean exists() {
if (local_file.exists()) {
return true;
} else {
try {
URLConnection c = remote_url.openConnection();
try {
c.setConnectTimeout(CIO.getLoadingTimeOu... | public static String md5(String str) {
if (str == null) {
System.err.println("Stringx.md5 (String) : null string.");
return "";
}
String rt = "";
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(str.getBytes("gb231... | false |
899,087 | 11,958,349 | 15,519,967 | public static void makeLPKFile(String[] srcFilePath, String makeFilePath, LPKHeader header) {
FileOutputStream os = null;
DataOutputStream dos = null;
try {
LPKTable[] fileTable = new LPKTable[srcFilePath.length];
long fileOffset = outputOffset(header);
fo... | 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,088 | 14,776,145 | 2,614,788 | private void addPNMLFileToLibrary(File selected) {
try {
FileChannel srcChannel = new FileInputStream(selected.getAbsolutePath()).getChannel();
FileChannel dstChannel = new FileOutputStream(new File(matchingOrderXML).getParent() + "/" + selected.getName()).getChannel();
d... | public String parse() {
try {
URL url = new URL(mUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.connect();
BufferedReader reade... | false |
899,089 | 901,348 | 16,183,460 | 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;
... | protected void createDb() {
File rootFolder = new File(dbFolderPath);
if (!rootFolder.exists()) {
rootFolder.mkdirs();
}
openConnection();
try {
Statement stat = connection.createStatement();
ResourceBundle bundle = ResourceBundle.getBundle... | false |
899,090 | 19,446,033 | 3,749,038 | protected void givenTestRepository(String repositoryId) throws Exception {
HttpResponse response = executeDeleteWithResponse("/repositories/" + repositoryId);
consume(response.getEntity());
response = executePost("/repositories", createRepositoryXml(repositoryId));
assertEquals(conte... | public MapInfo getMap(double latitude, double longitude, double wanted_mapblast_scale, int image_width, int image_height, String file_path_wo_extension, ProgressListener progress_listener) throws IOException {
try {
if (web_request_ == null) {
web_request_ = new HttpRequester(HOS... | false |
899,091 | 692,680 | 22,300,980 | 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]... | @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,092 | 1,156,882 | 16,925,759 | @Override
public void onClick(View v) {
Log.d(Config.SS_TAG, "Sending POST request to server...");
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(Config.RPC_SERVLET_URL);
JSONObject requestJ... | public void run() {
try {
URL url = new URL("http://mydiversite.appspot.com/version.html");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
System.ou... | true |
899,093 | 18,942,519 | 1,162,904 | public void deleteRole(AuthSession authSession, RoleBean roleBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (roleBean.getRoleId() == null) throw new IllegalArgumentException("role id is null");
... | public byte[] computeMD5(String plainText) throws VHException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw new VHException("The MD5 hash algorithm is not available.", ex);
}
try {... | false |
899,094 | 22,170,050 | 345,995 | private void copyTemplates(ProjectPath pPath) {
String sourceAntPath = pPath.sourceAntPath();
final String moduleName = projectOperations.getFocusedTopLevelPackage().toString();
logger.info("Module Name: " + moduleName);
String targetDirectory = pPath.canonicalFileSystemPath(projectO... | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | false |
899,095 | 6,644,756 | 19,905,565 | public void alterar(Cliente cliente) throws Exception {
Connection connection = criaConexao(false);
String sql = "update cliente set nome = ?, sexo = ?, cod_cidade = ? where cod_cliente = ?";
PreparedStatement stmt = null;
try {
stmt = connection.prepareStatement(sql);
... | public static String sha1(String in) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
byte[] data = new byte[40];
try {
md.update(in.getBytes("is... | false |
899,096 | 15,873,054 | 7,020,500 | 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... | 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,097 | 756,962 | 12,909,291 | 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 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,098 | 15,659,812 | 282,874 | private static void generateTIFF(Connection con, String category, String area_code, String topic_code, String timeseries, String diff_timeseries, Calendar time, String area_label, String raster_label, String image_label, String note, Rectangle2D bounds, Rectangle2D raster_bounds, String source_filename, String diff... | public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | true |
899,099 | 9,979,752 | 19,693,366 | public static MMissing load(URL url) throws IOException {
MMissing ret = new MMissing();
InputStream is = url.openStream();
try {
Reader r = new InputStreamReader(is);
BufferedReader br = new BufferedReader(r);
String line;
while ((line = br.re... | @Override
public void exec() {
BufferedReader in = null;
try {
URL url = new URL(getUrl());
in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer result = new StringBuffer();
String str;
while ((str = in.readLin... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.