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 |
|---|---|---|---|---|---|
900,700 | 5,450,104 | 16,891,145 | private static void grab(String urlString) throws MalformedURLException, IOException {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = null;
StringBuffer sb = new StringBuffer();
in =... | public static byte[] expandPasswordToKeySSHCom(String password, int keyLen) {
try {
if (password == null) {
password = "";
}
MessageDigest md5 = MessageDigest.getInstance("MD5");
int digLen = md5.getDigestLength();
byte[] buf = new ... | false |
900,701 | 3,229,361 | 6,751,999 | 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 void main(String[] args) throws Exception {
TripleDES tdes = new TripleDES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\testTDESENC.txt"));
SingleKey ... | true |
900,702 | 16,294,877 | 20,696,811 | public static void copierFichier(URL url, File destination) throws CopieException, IOException {
if (destination.exists()) {
throw new CopieException("ERREUR : Copie du fichier '" + url.getPath() + "' vers '" + destination.getPath() + "' impossible!\n" + "CAUSE : Le fichier destination existe d... | private static boolean insereTutorial(final Connection con, final Tutorial tut, final Autor aut, final Descricao desc) {
try {
con.setAutoCommit(false);
Statement smt = con.createStatement();
if (aut.getCodAutor() == 0) {
GeraID.gerarCodAutor(con, aut);
... | false |
900,703 | 1,854,053 | 2,285,646 | @Override
public void handle(String s, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, int i) throws IOException, ServletException {
expected = new StringBuilder();
System.out.println("uri: " + httpServletRequest.getRequestURI());
... | protected void sendDoc(File indir, File outdir, File orig, Document doc, ServiceEndpoint ep) {
ep.setMethod("simpleDocumentTransfer");
Document response = null;
try {
response = protocolHandler.sendMessage(ep, doc);
} catch (TransportException e) {
logger.warn... | true |
900,704 | 1,775,942 | 1,563,482 | @Override
public void run() {
HttpGet httpGet = null;
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
DataModel model = DataModel.getInstance();
for (City city : citiesToBeUpdated) {
String preferredUnitType = PreferenceManager.ge... | public StringBuffer get(URL url) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer page = new StringBuffer();
String line = null;
while ((line = bufferedReader.readLine()) != null) {
String utf =... | false |
900,705 | 8,174,539 | 12,908,232 | public static void invokeServlet(String op, String user) throws Exception {
boolean isSayHi = true;
try {
if (!"sayHi".equals(op)) {
isSayHi = false;
}
URL url = new URL("http://localhost:9080/helloworld/*.do");
HttpURLConnection conn =... | private void readFromObjectInput(String filename) {
try {
URL url = new URL(getCodeBase(), filename);
InputStream stream = url.openStream();
ObjectInput input = new ObjectInputStream(stream);
fDrawing.release();
fDrawing = (Drawing) input.readObjec... | false |
900,706 | 19,292,974 | 1,889,366 | public void write(PDDocument doc) throws COSVisitorException {
document = doc;
SecurityHandler securityHandler = document.getSecurityHandler();
if (securityHandler != null) {
try {
securityHandler.prepareDocumentForEncryption(document);
this.willEn... | public String hash(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
log.info("No sha-256 available");
try {
digest = MessageDigest.getInstance("SHA-... | true |
900,707 | 3,636,960 | 12,883,277 | public void display(WebPage page, HttpServletRequest req, HttpServletResponse resp) throws DisplayException {
page.getDisplayInitialiser().initDisplay(new HttpRequestDisplayContext(req), req);
StreamProvider is = (StreamProvider) req.getAttribute(INPUTSTREAM_KEY);
if (is == null) {
... | private void createWikiPages(WikiContext context) throws PluginException {
OntologyWikiPageName owpn = new OntologyWikiPageName(omemo.getFormDataAlias().toUpperCase(), omemo.getFormDataVersionDate());
String wikiPageFullFileName = WikiPageName2FullFileName(context, owpn.toString());
String r... | true |
900,708 | 3,461,227 | 4,005,293 | private void calculateCoverageAndSpecificity(String mainCat) throws IOException, JSONException {
for (String cat : Rules.categoryTree.get(mainCat)) {
for (String queryString : Rules.queries.get(cat)) {
String urlEncodedQueryString = URLEncoder.encode(queryString, "UTF-8");
... | public static String translate(String s, String type) {
try {
String result = null;
URL url = new URL("http://www.excite.co.jp/world/english/");
URLConnection connection = url.openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatib... | true |
900,709 | 901,348 | 22,165,218 | 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 String readHtmlFile(String htmlFileName) {
StringBuffer buffer = new StringBuffer();
java.net.URL url = getClass().getClassLoader().getResource("freestyleLearning/homeCore/help/" + htmlFileName);
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.o... | true |
900,710 | 3,732,741 | 13,988,822 | private String digest(String message) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(message.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String hpassword = hash.toString(16);
return hpassword;
} ... | private void getServiceReponse(String service, NameSpaceDefinition nsDefinition) throws Exception {
Pattern pattern = Pattern.compile("(?i)(?:.*(xmlns(?:\\:\\w+)?=\\\"http\\:\\/\\/www\\.ivoa\\.net\\/.*" + service + "[^\\\"]*\\\").*)");
pattern = Pattern.compile(".*xmlns(?::\\w+)?=(\"[^\"]*(?i)(?:" +... | false |
900,711 | 2,962,800 | 3,766,029 | private void loadProperties() {
if (properties == null) {
properties = new Properties();
try {
URL url = getClass().getResource(propsFile);
properties.load(url.openStream());
} catch (IOException ioe) {
ioe.printStackTrace()... | public String uploadZtree(ArrayList c) {
try {
String id = generateRandomId();
Iterator iter = c.iterator();
URL url = new URL(ZorobotSystem.props.getProperty("zoro.url") + "auplo1.jsp");
URLConnection connection = url.openConnection();
connection.... | false |
900,712 | 12,909,291 | 621,362 | 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... | 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 |
900,713 | 13,845,913 | 10,271,560 | public synchronized boolean copyTmpDataFile(String fpath) throws IOException {
if (tmpDataOutput != null) tmpDataOutput.close();
tmpDataOutput = null;
if (tmpDataFile == null) return false;
File nfp = new File(fpath);
if (nfp.exists()) nfp.delete();
FileInputStream sr... | private void processStylesheetFile() {
InputStream in = null;
OutputStream out = null;
try {
String filename;
if (line.hasOption("stylesheetfile")) {
filename = line.getOptionValue("stylesheetfile");
in = new FileInputStream(filename);
... | true |
900,714 | 658,771 | 16,851,954 | 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);
... | @Test
public void testTrainingQuickprop() throws IOException {
File temp = File.createTempFile("fannj_", ".tmp");
temp.deleteOnExit();
IOUtils.copy(this.getClass().getResourceAsStream("xor.data"), new FileOutputStream(temp));
List<Layer> layers = new ArrayList<Layer>();
l... | true |
900,715 | 22,423,727 | 19,002,330 | public void copyFile(String source_file_path, String destination_file_path) {
FileWriter fw = null;
FileReader fr = null;
BufferedReader br = null;
BufferedWriter bw = null;
File source = null;
try {
fr = new FileReader(source_file_path);
fw = ... | public static void copyFile(File src, File dst) throws ResourceNotFoundException, ParseErrorException, Exception {
if (src.getAbsolutePath().endsWith(".vm")) {
copyVMFile(src, dst.getAbsolutePath().substring(0, dst.getAbsolutePath().lastIndexOf(".vm")));
} else {
FileInputStr... | true |
900,716 | 13,883,878 | 10,806,987 | PathElement(String path) throws MaxError {
this.path = path;
if (path.startsWith("http:")) {
try {
url = new URL(path);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("HEAD... | public final Matrix3D<E> read(final URL url) throws IOException {
if (url == null) {
throw new IllegalArgumentException("url must not be null");
}
InputStream inputStream = null;
try {
inputStream = url.openStream();
return read(inputStream);
... | false |
900,717 | 10,178,931 | 13,999,345 | public String encrypt(String plaintext) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new Exception(e.getMessage());
}
try {
md.update(plaintext.getByte... | private void writeFile(String name, URL url) throws IOException {
Location location = resourcesHome.resolve(name);
InputStream input = url.openStream();
OutputStream output = location.getOutputStream();
try {
byte buf[] = new byte[1024];
int read;
... | false |
900,718 | 18,349,315 | 14,075,761 | public static boolean copyFile(File from, File to, byte[] buf) {
if (buf == null) buf = new byte[BUFFER_SIZE];
FileInputStream from_s = null;
FileOutputStream to_s = null;
try {
from_s = new FileInputStream(from);
to_s = new FileOutputStream(to);
f... | private static String md5(String digest, String data) throws IOException {
MessageDigest messagedigest;
try {
messagedigest = MessageDigest.getInstance(digest);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
messagedigest.updat... | false |
900,719 | 480,017 | 14,899,566 | 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 createZip(File zipFileName, Vector<File> selected) {
try {
byte[] buffer = new byte[4096];
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFileName), 8096));
out.setLevel(Deflater.BEST_COMPRESSION);
out.se... | true |
900,720 | 967,161 | 2,324,866 | private static FacesBean.Type _createType() {
try {
ClassLoader cl = _getClassLoader();
URL url = cl.getResource("META-INF/faces-bean-type.properties");
if (url != null) {
Properties properties = new Properties();
InputStream is = url.openS... | public SpreadSheetFrame(FileManager owner, File file, Delimiter delim) {
super(owner, file.getPath());
JPanel pane = new JPanel(new BorderLayout());
super.contentPane.add(pane);
this.tableModel = new BigTableModel(file, delim);
this.table = new JTable(tableModel);
thi... | false |
900,721 | 19,279,420 | 21,337,941 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final FileManager fmanager = FileManager.getFileManager(request, leechget);
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter;
try {
... | public static void main(String[] argv) throws IOException {
int i;
for (i = 0; i < argv.length; i++) {
if (argv[i].charAt(0) != '-') break;
++i;
switch(argv[i - 1].charAt(1)) {
case 'b':
try {
flag_predic... | true |
900,722 | 23,537,682 | 10,923,940 | public static byte[] readResource(Class owningClass, String resourceName) {
final URL url = getResourceUrl(owningClass, resourceName);
if (null == url) {
throw new MissingResourceException(owningClass.toString() + " key '" + resourceName + "'", owningClass.toString(), resourceName);
... | private void request() {
try {
connection = (HttpURLConnection) new URL(url).openConnection();
if (isCometConnection) {
connection.setReadTimeout(0);
} else {
connection.setReadTimeout(30000);
}
connection.setInstanc... | false |
900,723 | 16,586,894 | 5,428,177 | public void test3() throws FileNotFoundException, IOException {
Decoder decoder1 = new MP3Decoder(new FileInputStream("/home/marc/tmp/test1.mp3"));
Decoder decoder2 = new OggDecoder(new FileInputStream("/home/marc/tmp/test1.ogg"));
FileOutputStream out = new FileOutputStream("/home/marc/tmp/... | 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 |
900,724 | 13,514,558 | 854,534 | public void load(String filename) throws VisbardException {
String defaultFilename = VisbardMain.getSettingsDir() + File.separator + DEFAULT_SETTINGS_FILE;
File defaultFile = new File(defaultFilename);
InputStream settingsInStreamFromFile = null;
try {
sLogger.info("Loadi... | 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 |
900,725 | 14,152,188 | 12,909,291 | public static boolean filecopy(final File source, final File target) {
boolean out = false;
if (source.isDirectory() || !source.exists() || target.isDirectory() || source.equals(target)) return false;
try {
target.getParentFile().mkdirs();
target.createNewFile();
... | 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 |
900,726 | 16,289,496 | 384,844 | public static void reset() throws Exception {
Session session = DataStaticService.getHibernateSessionFactory().openSession();
try {
Connection connection = session.connection();
try {
Statement statement = connection.createStatement();
try {
... | 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 |
900,727 | 3,236,017 | 15,571,542 | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | 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 |
900,728 | 5,951,609 | 11,650,020 | public void testCryptHash() {
Log.v("Test", "[*] testCryptHash()");
String testStr = "Hash me";
byte messageDigest[];
MessageDigest digest = null;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(testStr.getBytes());
... | public static String encrypt(String message) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(message.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(digest.digest());
} catch (NoSuchAlgorit... | true |
900,729 | 19,549,575 | 9,068,428 | protected InputStream callApiGet(String apiUrl, int expected) {
try {
URL url = new URL(apiUrl);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
if (ApplicationConstants.CONNECT_TIMEOUT > -1) {
request.setConnectTimeout(ApplicationCon... | public static String getTextFileFromURL(String urlName) {
try {
StringBuffer textFile = new StringBuffer("");
String line = null;
URL url = new URL(urlName);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
while... | true |
900,730 | 13,098,121 | 11,018,792 | private URLConnection openConnection(final URL url) throws IOException {
try {
return (URLConnection) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws IOException {
return url.openConnection();
}
... | public static String encryptePassword(String md5key, String passwordAccount, String encryptedPassword, int passwdenc) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(Constants.ALGORITHM);
switch(passwdenc) {
case 1:
... | false |
900,731 | 16,588,230 | 22,447,616 | public static void main(String[] args) throws IOException {
MSPack pack = new MSPack(new FileInputStream(args[0]));
String[] files = pack.getFileNames();
for (int i = 0; i < files.length; i++) System.out.println(i + ": " + files[i] + ": " + pack.getLengths()[i]);
System.out.println("... | public Usuario insertUsuario(IUsuario usuario) throws SQLException {
Connection conn = null;
String insert = "insert into Usuario (idusuario, nome, email, telefone, cpf, login, senha) " + "values " + "(nextval('seq_usuario'), '" + usuario.getNome() + "', '" + usuario.getEmail() + "', " + "'" + usuar... | false |
900,732 | 12,048,547 | 916,271 | public static void importDB(String input, String output) {
try {
Class.forName("org.sqlite.JDBC");
String fileName = output + File.separator + G.databaseName;
File dataBase = new File(fileName);
if (!dataBase.exists()) {
G.conn = DriverManager.... | 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 |
900,733 | 18,960,732 | 19,394,412 | protected void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, DocumentFormat outputFormat) {
File inputFile = null;
File outputFile = null;
try {
inputFile = File.createTempFile("document", "." + inputFormat.getFileExtension());
... | 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 |
900,734 | 12,524,253 | 7,119,938 | public DialogSongList(JFrame frame) {
super(frame, "Menu_SongList", "songList");
setMinimumSize(new Dimension(400, 200));
JPanel panel, spanel;
Container contentPane;
(contentPane = getContentPane()).add(songSelector = new SongSelector(configKey, null, true));
songSel... | public void putFile(CompoundName file, FileInputStream fileInput) throws IOException {
File fullDir = new File(REMOTE_BASE_DIR.getCanonicalPath());
for (int i = 0; i < file.size() - 1; i++) fullDir = new File(fullDir, file.get(i));
fullDir.mkdirs();
File outputFile = new File(fullDir... | true |
900,735 | 17,386,977 | 21,273,059 | private void checkUrl(URL url) throws IOException {
File urlFile = new File(url.getFile());
assertEquals(file.getCanonicalPath(), urlFile.getCanonicalPath());
System.out.println("Using url " + url);
InputStream openStream = url.openStream();
assertNotNull(openStream);
}
| public RobotList<Location> sort_incr_Location(RobotList<Location> list, String field) {
int length = list.size();
Index_value[] enemy_dist = new Index_value[length];
Location cur_loc = this.getLocation();
for (int i = 0; i < length; i++) {
enemy_dist[i] = new Index_value(... | false |
900,736 | 17,944,691 | 7,872,660 | public static void uploadAsync(final ArrayList<RecordedGeoPoint> recordedGeoPoints) {
new Thread(new Runnable() {
@Override
public void run() {
try {
if (!Util.isSufficienDataForUpload(recordedGeoPoints)) return;
final InputStr... | private static boolean genCustomerLocationsFileAndCustomerIndexFile(String completePath, String masterFile, String CustLocationsFileName, String CustIndexFileName) {
try {
TIntObjectHashMap CustInfoHash = new TIntObjectHashMap(480189, 1);
File inFile = new File(completePath + fSep + ... | false |
900,737 | 1,008,324 | 653,395 | public void copyHashAllFilesToDirectory(String baseDirStr, Hashtable newNamesTable, String destDirStr) throws Exception {
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.endsWith(sep)) {
destDirStr = dest... | public static boolean downloadFile(String url, String destination) throws Exception {
BufferedInputStream bi = null;
BufferedOutputStream bo = null;
File destfile;
java.net.URL fileurl;
fileurl = new java.net.URL(url);
bi = new BufferedInputStream(fileurl.openStream()... | false |
900,738 | 7,663,603 | 18,488,106 | public synchronized String encrypt(String plaintext) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new MyException(e.getMessage());
}
try {
md.update(pl... | public static Document validateXml(File messageFile, URL inputUrl, String[] catalogs) throws IOException, ParserConfigurationException, Exception, SAXException, FileNotFoundException {
InputSource source = new InputSource(inputUrl.openStream());
Document logDoc = DomUtil.getNewDom();
XMLRead... | false |
900,739 | 19,483,244 | 16,485,992 | public static void copyFile(String original, String destination) throws Exception {
File original_file = new File(original);
File destination_file = new File(destination);
if (!original_file.exists()) throw new Exception("File with path " + original + " does not exist.");
if (destina... | private void sendBinaryFile(File file) throws IOException, CVSException {
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
if (m_bCompressFiles) {
GZIPOutputStream gzipOut = null;
InputStream gzipIn ... | true |
900,740 | 3,253,024 | 10,337,387 | private static void recurseFiles(File root, File file, TarArchiveOutputStream taos, boolean absolute) throws IOException {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File file2 : files) {
recurseFiles(root, file2, taos, absolute);
}
... | protected void zipDirectory(File dir, File zipfile) throws IOException, IllegalArgumentException {
if (!dir.isDirectory()) throw new IllegalArgumentException("Compress: not a directory: " + dir);
String[] entries = dir.list();
byte[] buffer = new byte[4096];
int bytes_read;
... | true |
900,741 | 13,964,423 | 22,186,637 | private String signMethod() {
String str = API.SHARED_SECRET;
Vector<String> v = new Vector<String>(parameters.keySet());
Collections.sort(v);
for (String key : v) {
str += key + parameters.get(key);
}
MessageDigest m = null;
try {
m = ... | public static boolean processUrl(String urlPath, UrlLineHandler handler) {
boolean ret = true;
URL url;
InputStream in = null;
BufferedReader bin = null;
try {
url = new URL(urlPath);
in = url.openStream();
bin = new BufferedReader(new Inpu... | false |
900,742 | 21,456,509 | 10,934,628 | private HashMap<String, GCVote> getVotes(ArrayList<String> waypoints, boolean blnSleepBeforeDownload) {
if (blnSleepBeforeDownload) {
try {
Thread.sleep(PACKET_SLEEP_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
}... | public static void main(String[] args) {
try {
{
byte[] bytes1 = { (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
byte[] bytes2 = { (byte) 99, (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
System.out.println("Bytes 2,2,3,0,9 as Base64: "... | false |
900,743 | 16,687,411 | 18,921,331 | private ByteBuffer readProgram(URL url) throws IOException {
StringBuilder program = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = in.readLine()) != null) ... | public void init() {
this.setFormulaCalculationMode(WorkBookHandle.CALCULATE_ALWAYS);
try {
if (memeId < 0) {
} else {
conurl = new URL(ServerURL + "?meme_id=" + memeId);
java.io.InputStream xmlstr = conurl.openStream();
this.re... | false |
900,744 | 4,822,222 | 1,849,897 | public static void copy(String srcFileName, String destFileName) throws IOException {
if (srcFileName == null) {
throw new IllegalArgumentException("srcFileName is null");
}
if (destFileName == null) {
throw new IllegalArgumentException("destFileName is null");
... | public String parseInOneLine() throws Exception {
BufferedReader br = null;
InputStream httpStream = null;
if (url.startsWith("http")) {
URL fileURL = new URL(url);
URLConnection urlConnection = fileURL.openConnection();
httpStream = urlConnection.getInput... | false |
900,745 | 19,922,657 | 783,717 | 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 main(String[] args) throws Exception {
String uri = args[0];
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
FSDataInputStream in = null;
try {
in = fs.open(new Path(uri));
IOUtils.cop... | true |
900,746 | 15,102,903 | 2,109,483 | public static void translateTableAttributes(String baseDir, String tableName, NameSpaceDefinition nsDefinition) throws Exception {
setVosiNS(baseDir, "table_att", nsDefinition);
String filename = baseDir + "table_att.xsl";
Scanner s = new Scanner(new File(filename));
PrintWriter fw =... | @Override
public LispObject execute(LispObject first, LispObject second) throws ConditionThrowable {
Pathname zipfilePathname = coerceToPathname(first);
byte[] buffer = new byte[4096];
try {
String zipfileNamestring = zipfilePathname.getNamestring();
if (zipfileNa... | true |
900,747 | 2,930,278 | 22,704,165 | public static void connectServer() {
if (ftpClient == null) {
int reply;
try {
setArg(configFile);
ftpClient = new FTPClient();
ftpClient.setDefaultPort(port);
ftpClient.configure(getFtpConfig());
ftpClie... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel.size(), destinationChanne... | false |
900,748 | 23,585,932 | 21,900,384 | public static void concatenateOutput(File[] inputFiles, File outputFile) {
int numberOfInputFiles = inputFiles.length;
byte lf = (byte) '\n';
try {
FileOutputStream fos = new FileOutputStream(outputFile);
FileChannel outfc = fos.getChannel();
System.out.pr... | @Override
protected ActionForward executeAction(ActionMapping mapping, ActionForm form, User user, HttpServletRequest request, HttpServletResponse response) throws Exception {
long resourceId = ServletRequestUtils.getLongParameter(request, "resourceId", 0L);
String attributeIdentifier = request.... | true |
900,749 | 5,590,065 | 11,343,453 | protected String readFileUsingHttp(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProper... | public static String getWebpage(String url) {
String content = "";
if (!url.trim().toLowerCase().startsWith("http://")) {
url = "http://" + url;
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
S... | true |
900,750 | 21,092,152 | 22,382,481 | public static boolean update(ItemNotaFiscal objINF) {
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
int result;
CelulaFinanceira objCF = null;
if (c == null) {
return false;
}
if (objINF == null) {
ret... | public boolean ReadFile() {
boolean ret = false;
FilenameFilter FileFilter = null;
File dir = new File(fDir);
String[] FeeFiles;
int Lines = 0;
BufferedReader FeeFile = null;
PreparedStatement DelSt = null, InsSt = null;
String Line = null, Term = null... | true |
900,751 | 12,104,132 | 17,267,601 | @Override
public void render(Output output) throws IOException {
output.setStatus(statusCode, statusMessage);
if (headersMap != null) {
Iterator<Entry<String, String>> iterator = headersMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, ... | public void setBckImg(String newPath) {
try {
File inputFile = new File(getPath());
File outputFile = new File(newPath);
if (!inputFile.getCanonicalPath().equals(outputFile.getCanonicalPath())) {
FileInputStream in = new FileInputStream(inputFile);
... | true |
900,752 | 8,086,217 | 12,544,033 | public void write(OutputStream out, String className, InputStream classDefStream) throws IOException {
ByteArrayOutputStream a = new ByteArrayOutputStream();
IOUtils.copy(classDefStream, a);
a.close();
DataOutputStream da = new DataOutputStream(out);
da.writeUTF(className);
... | 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... | true |
900,753 | 21,752,108 | 4,660,318 | private void copy(File from, File to) {
if (from.isDirectory()) {
File[] files = from.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
File newTo = new File(to.getPath() + File.separator + files[i].getName());
... | public static void main(String argv[]) {
Matrix A, B, C, Z, O, I, R, S, X, SUB, M, T, SQ, DEF, SOL;
int errorCount = 0;
int warningCount = 0;
double tmp, s;
double[] columnwise = { 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12. };
double[] rowwise = { 1., 4., 7., 1... | true |
900,754 | 22,416,749 | 2,520,215 | private int getRootNodeId(DataSource dataSource) throws SQLException {
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String query = null;
try {
conn = dataSource.getConnection();
st = conn.createStatement();
query = "sel... | public synchronized String encrypt(String plaintext) {
if (plaintext == null) plaintext = "";
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
... | false |
900,755 | 12,798,072 | 15,826,300 | public static String encrypt(String txt) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(txt.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
| public static Map<String, List<String>> getResponseHeader(String address) {
System.out.println(address);
URLConnection conn = null;
Map<String, List<String>> responseHeader = null;
try {
URL url = new URL(address);
conn = url.openConnection();
resp... | false |
900,756 | 14,090,536 | 18,488,919 | private String[] read(String path) throws Exception {
final String[] names = { "index.txt", "", "index.html", "index.htm" };
String[] list = null;
for (int i = 0; i < names.length; i++) {
URL url = new URL(path + names[i]);
try {
BufferedReader in = ne... | private void insert(Connection c) throws SQLException {
if (m_fromDb) throw new IllegalStateException("The record already exists in the database");
StringBuffer names = new StringBuffer("INSERT INTO ifServices (nodeID,ipAddr,serviceID");
StringBuffer values = new StringBuffer("?,?,?");
... | false |
900,757 | 7,174,662 | 9,830,269 | private void loadInitialDbState() throws IOException {
InputStream in = SchemaAndDataPopulator.class.getClassLoader().getResourceAsStream(resourceName);
StringWriter writer = new StringWriter();
IOUtils.copy(in, writer);
for (String statement : writer.toString().split(SQL_STATEMENT_D... | public final void deliver(final String from, final String recipient, final InputStream data) throws TooMuchDataException, IOException {
System.out.println("FROM: " + from);
System.out.println("TO: " + recipient);
final File tmpD... | true |
900,758 | 6,190,160 | 840,277 | public void xtest1() throws Exception {
InputStream input = new FileInputStream("C:/Documentos/j931_01.pdf");
InputStream tmp = new ITextManager().cut(input, 3, 8);
FileOutputStream output = new FileOutputStream("C:/temp/split.pdf");
IOUtils.copy(tmp, output);
input.close();
... | 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 |
900,759 | 2,373,293 | 10,480,050 | public static void copyFile(final File in, final File out) throws IOException {
final FileChannel sourceChannel = new FileInputStream(in).getChannel();
final FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destination... | public static SearchItem loadRecord(String id, boolean isContact) {
String line = null;
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(isContact ? URL_RECORD_CONTACT : URL_RECORD_COMPANY);
List<NameValuePair> nameVal... | false |
900,760 | 15,260,218 | 14,675,462 | public static String md5Encode16(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes("utf-8"));
byte b[] = md.digest();
int i;
StringBuilder buf = new StringBuilder("");
for (int offset = 0; offse... | public static byte[] encrypt(String passphrase, byte[] data) throws Exception {
byte[] dataTemp;
try {
Security.addProvider(new com.sun.crypto.provider.SunJCE());
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(passphrase.getBytes());
DE... | true |
900,761 | 2,461,168 | 20,192,098 | 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 Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException {
if (log.isTraceEnabled()) log.trace("Read input stream with metadata=" + metadata);
Integer resCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
String resMessage = (Strin... | true |
900,762 | 6,513,769 | 1,995,571 | @Before
public void BeforeTheTest() throws Exception {
URL url = ProfileParserTest.class.getClassLoader().getResource("ca/uhn/hl7v2/conf/parser/tests/example_ack.xml");
URLConnection conn = url.openConnection();
InputStream instream = conn.getInputStream();
if (instream == null) ... | protected Source resolveRepositoryURI(String path) throws TransformerException {
Source resolvedSource = null;
try {
if (path != null) {
URL url = new URL(path);
InputStream in = url.openStream();
if (in != null) {
resol... | false |
900,763 | 8,416,636 | 19,532,000 | private static byte[] Md5f(String plainText) {
byte[] ab = new byte[16];
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
ab = b;
} catch (NoSuchAlgorithmException e) {
... | static MenuListener openRecentHandler() {
MenuListener handler = new MenuListener() {
public void menuSelected(final MenuEvent event) {
final JMenu menu = (JMenu) event.getSource();
menu.removeAll();
String[] recentURLSpecs = Application.getApp().... | false |
900,764 | 16,227,459 | 16,946,193 | public CmsSetupTestResult execute(CmsSetupBean setupBean) {
CmsSetupTestResult testResult = new CmsSetupTestResult(this);
String basePath = setupBean.getWebAppRfsPath();
if (!basePath.endsWith(File.separator)) {
basePath += File.separator;
}
File file1;
Ra... | public void deploy(final File extension) {
log.info("Deploying new extension from {}", extension.getPath());
RequestContextHolder.setRequestContext(new RequestContext(SZoneConfig.getDefaultZoneName(), SZoneConfig.getAdminUserName(SZoneConfig.getDefaultZoneName()), new BaseSessionContext()));
... | true |
900,765 | 10,271,558 | 3,318,214 | private void processBasicContent() {
String[] packageNames = sourceCollector.getPackageNames();
for (int i = 0; i < packageNames.length; i++) {
XdcSource[] sources = sourceCollector.getXdcSources(packageNames[i]);
File dir = new File(outputDir, packageNames[i]);
d... | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | true |
900,766 | 15,193 | 14,959,919 | 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("Copy: no such source file: " + fromFileName);
if (!fromFile.canRead()) throw... | public final void build() {
if (!built_) {
built_ = true;
final boolean[] done = new boolean[] { false };
Runnable runnable = new Runnable() {
public void run() {
try {
exists_ = true;
UR... | false |
900,767 | 12,524,253 | 5,673,928 | public DialogSongList(JFrame frame) {
super(frame, "Menu_SongList", "songList");
setMinimumSize(new Dimension(400, 200));
JPanel panel, spanel;
Container contentPane;
(contentPane = getContentPane()).add(songSelector = new SongSelector(configKey, null, true));
songSel... | void loadImage(Frame frame, URL url) throws Exception {
URLConnection conn = url.openConnection();
String mimeType = conn.getContentType();
long length = conn.getContentLength();
InputStream is = conn.getInputStream();
loadImage(frame, is, length, mimeType);
}
| false |
900,768 | 13,828,673 | 18,519,246 | protected void find(final String pckgname, final boolean recursive) {
URL url;
String name = pckgname;
name = name.replace('.', '/');
url = ResourceLocatorTool.getClassPathResource(ExampleRunner.class, name);
File directory;
try {
... | public List<PathObject> fetchPath(BoardObject board) throws NetworkException {
if (boardPathMap.containsKey(board.getId())) {
return boardPathMap.get(board.getId()).getChildren();
}
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(HttpConfig.bbsURL(... | false |
900,769 | 18,253,220 | 13,961,100 | public boolean downloadFTP(String ipFTP, String loginFTP, String senhaFTP, String diretorioFTP, String diretorioAndroid, String arquivoFTP) throws SocketException, IOException {
boolean retorno = false;
FileOutputStream arqReceber = null;
try {
ftp.connect(ipFTP);
Log... | public void initialize(IProgressMonitor monitor) throws JETException {
IProgressMonitor progressMonitor = monitor;
progressMonitor.beginTask("", 10);
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_GeneratingJETEmitterFor_message", new Object[] { getTemplateURI() }));
... | false |
900,770 | 19,886,621 | 3,024,978 | private void doPOST(HttpURLConnection connection, InputStream inputXML) throws MessageServiceException {
try {
OutputStream requestStream = new BufferedOutputStream(connection.getOutputStream());
IOUtils.copyAndClose(inputXML, requestStream);
connection.connect();
... | @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 |
900,771 | 12,049,052 | 20,805,884 | private Collection<Class<? extends Plugin>> loadFromResource(ClassLoader classLoader, String resource) throws IOException {
Collection<Class<? extends Plugin>> pluginClasses = new HashSet<Class<? extends Plugin>>();
Enumeration providerFiles = classLoader.getResources(resource);
if (!provide... | public String preProcessHTML(String uri) {
final StringBuffer buf = new StringBuffer();
try {
HTMLDocument doc = new HTMLDocument() {
public HTMLEditorKit.ParserCallback getReader(int pos) {
return new HTMLEditorKit.ParserCallback() {
... | false |
900,772 | 3,229,361 | 3,594,612 | 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 String[] check() throws Exception {
if (currentVersion == null) throw new Exception();
URL url = new URL(versionURL);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
String str = "";
BufferedReader br = new BufferedReader(new InputStreamReader(... | false |
900,773 | 13,753,266 | 416,235 | public static void s_copy(FileInputStream fis, FileOutputStream fos) throws Exception {
FileChannel in = fis.getChannel();
FileChannel out = fos.getChannel();
in.transferTo(0, in.size(), out);
if (in != null) in.close();
if (out != null) out.close();
}
| 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... | false |
900,774 | 12,202,844 | 17,337,015 | private String getMD5(String data) {
try {
MessageDigest md5Algorithm = MessageDigest.getInstance("MD5");
md5Algorithm.update(data.getBytes(), 0, data.length());
byte[] digest = md5Algorithm.digest();
StringBuffer hexString = new StringBuffer();
St... | public boolean downloadFile(String webdir, String fileName, String localdir) {
boolean result = false;
checkDownLoadDirectory(localdir);
FTPClient ftp = new FTPClient();
try {
ftp.connect(url);
ftp.login(username, password);
if (!"".equals(webdir.t... | false |
900,775 | 11,904,056 | 14,770,723 | public static void convertEncoding(File infile, File outfile, String from, String to) throws IOException, UnsupportedEncodingException {
InputStream in;
if (infile != null) in = new FileInputStream(infile); else in = System.in;
OutputStream out;
outfile.createNewFile();
if (o... | public static boolean copyFile(File dest, File source) {
FileInputStream fis = null;
FileOutputStream fos = null;
boolean rv = false;
byte[] buf = new byte[1000000];
int bytesRead = 0;
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
try {
... | true |
900,776 | 3,167,464 | 8,917,665 | public void adicionaCliente(ClienteBean cliente) {
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "insert into cliente(nome,cpf,telefone,cursoCargo,bloqueado,ativo,tipo) values(?,?,?,?,?,?,?)";
try {
pstmt = connection.prepareStatement(sql, Statement.RE... | public static void copyAll(URL url, StringBuilder ret) {
Reader in = null;
try {
in = new InputStreamReader(new BufferedInputStream(url.openStream()));
copyAll(in, ret);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
... | false |
900,777 | 20,438,542 | 20,965,286 | public static Shader loadShader(String vspath, String fspath, int textureUnits, boolean separateCam, boolean fog) throws ShaderProgramProcessException {
if (vspath == "" || fspath == "") return null;
BufferedReader in;
String vert = "", frag = "";
try {
URL v_url = Graphi... | public void openAndClose(ZKEntry zke, LinkedList toOpen, LinkedList toRemove) throws SQLException {
conn.setAutoCommit(false);
try {
Statement stm = conn.createStatement();
ResultSet rset = stm.executeQuery("SELECT now();");
rset.next();
Timestamp now ... | false |
900,778 | 3,345,991 | 12,863,885 | private String calculatePassword(String string) {
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
md5.update(nonce.getBytes());
md5.update(string.getBytes());
return toHexString(md5.digest());
} catch (NoSuchAlgorithmException e) {
... | private static String md5(String input) {
String res = "";
try {
MessageDigest cript = MessageDigest.getInstance("MD5");
cript.reset();
cript.update(input.getBytes());
byte[] md5 = cript.digest();
String tmp = "";
for (int i = 0... | true |
900,779 | 4,309,920 | 8,561,731 | public InputStream doRemoteCall(NamedList<String> params) throws IOException {
String protocol = "http";
String host = getHost();
int port = Integer.parseInt(getPort());
StringBuilder sb = new StringBuilder();
for (Map.Entry entry : params) {
Object key = entry.ge... | public boolean actualizarEstadoDivision(division div) {
int intResult = 0;
String sql = "UPDATE divisionxTorneo " + " SET terminado = '1' " + " WHERE idDivisionxTorneo = " + div.getidDivision();
try {
connection = conexionBD.getConnection();
connection.setAutoCommit(f... | false |
900,780 | 8,788,331 | 22,966,596 | 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... | public static void copyFile(String oldPath, String newPath) throws IOException {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPath);
FileOutputStream fs = new FileOut... | true |
900,781 | 21,273,059 | 3,495,456 | public RobotList<Location> sort_incr_Location(RobotList<Location> list, String field) {
int length = list.size();
Index_value[] enemy_dist = new Index_value[length];
Location cur_loc = this.getLocation();
for (int i = 0; i < length; i++) {
enemy_dist[i] = new Index_value(... | public boolean crear() {
int result = 0;
String sql = "insert into ronda" + "(divisionxTorneo_idDivisionxTorneo, fechaRonda, nRonda, estado ) " + "values (?, ?, ?, ?)";
try {
connection = conexionBD.getConnection();
connection.setAutoCommit(false);
ps = co... | false |
900,782 | 18,675,737 | 17,987,049 | private void post(String title, Document content, Set<String> tags) throws HttpException, IOException, TransformerException {
PostMethod method = null;
try {
method = new PostMethod("http://www.blogger.com/feeds/" + this.blogId + "/posts/default");
method.addRequestHeader("GD... | private boolean writeResource(PluginProxy eclipseInstallPlugin, ResourceProxy translation, LocaleProxy locale) throws Exception {
String translationResourceName = determineTranslatedResourceName(translation, locale);
String pluginNameInDirFormat = eclipseInstallPlugin.getName().replace(Messages.getS... | true |
900,783 | 10,177,034 | 17,197,906 | public static synchronized BaseFont getL2BaseFont() {
if (l2baseFont == null) {
final ConfigProvider conf = ConfigProvider.getInstance();
try {
final ByteArrayOutputStream tmpBaos = new ByteArrayOutputStream();
String fontPath = conf.getNotEmptyPropert... | public void run() {
LogPrinter.log(Level.FINEST, "Started Download at : {0, date, long}", new Date());
if (!PipeConnected) {
throw new IllegalStateException("You should connect the pipe before with getInputStream()");
}
InputStream ins = null;
if (IsAlreadyDownloa... | true |
900,784 | 17,141,933 | 17,829,989 | public static InputSource getInputSource(URL url) throws IOException {
String proto = url.getProtocol().toLowerCase();
if (!("http".equals(proto) || "https".equals(proto))) throw new IllegalArgumentException("OAI-PMH only allows HTTP(S) as network protocol!");
HttpURLConnection conn = (HttpU... | @Override
public void run() {
File dir = new File(loggingDir);
if (!dir.isDirectory()) {
logger.error("Logging directory \"" + dir.getAbsolutePath() + "\" does not exist.");
return;
}
File file = new File(dir, new Date().toS... | false |
900,785 | 433,062 | 120,707 | 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 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 |
900,786 | 21,456,138 | 3,767,763 | @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "getServerCertificates", args = { })
public final void test_getServerCertificates() throws Exception {
try {
URL url = new URL("https://localhost:55555");
HttpsURLConnection connection = (HttpsURLConnection) url.ope... | @Override
public long insertStatement(String sql) {
Statement statement = null;
try {
statement = getConnection().createStatement();
long result = statement.executeUpdate(sql.toString());
if (result == 0) log.warn(sql + " result row count is 0");
g... | false |
900,787 | 5,751,313 | 13,396,233 | 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 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... | true |
900,788 | 12,232,011 | 17,726,029 | 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... | private String getRandomGUID(final boolean secure) {
MessageDigest md5 = null;
final StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
... | false |
900,789 | 6,166,363 | 20,306,674 | private static byte[] gerarHash(String frase) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(frase.getBytes());
return md.digest();
} catch (Exception e) {
return null;
}
}
| 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 |
900,790 | 13,048,962 | 14,267,319 | public final void saveAsCopy(String current_image, String destination) {
BufferedInputStream from = null;
BufferedOutputStream to = null;
String source = temp_dir + key + current_image;
try {
from = new BufferedInputStream(new FileInputStream(source));
to = ne... | public void run() {
BufferedInputStream bis = null;
URLConnection url = null;
String textType = null;
StringBuffer sb = new StringBuffer();
try {
if (!location.startsWith("http://")) {
location = "http://" + location;
}
url ... | false |
900,791 | 12,243,391 | 21,609,544 | private byte[] getMD5(String string) throws IMException {
byte[] buffer = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(string.getBytes("utf-8"));
buffer = md.digest();
buffer = getHexString(buffer);
} catch (NoSuch... | public static JSONObject delete(String uid) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpGet get = new HttpGet(DELETE_URI + "?uid=" + uid);
HttpResponse response = client.execute(get);
if (response.getStatusLine()... | false |
900,792 | 5,953,607 | 2,252,378 | 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... | private 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 (IOExce... | true |
900,793 | 10,076,077 | 20,265,649 | @Override
public void save(String arxivId, InputStream inputStream, String encoding) {
String filename = StringUtil.arxivid2filename(arxivId, "tex");
try {
Writer writer = new OutputStreamWriter(new FileOutputStream(String.format("%s/%s", LATEX_DOCUMENT_DIR, filename)), encoding);
... | public static void setFinishedFlag(String ip, String port, String user, String dbname, String password, int flag) throws Exception {
String sql = "update flag set flag = " + flag;
Connection conn = CubridDBCenter.getConnection(ip, port, dbname, user, password);
System.out.println("====:::===... | false |
900,794 | 22,564,546 | 1,577,152 | public void unzip(String resource) {
File f = new File(resource);
if (!f.exists()) throw new RuntimeException("The specified resources does not exist (" + resource + ")");
String parent = f.getParent().toString();
try {
BufferedOutputStream dest = null;
FileIn... | public void run() {
try {
File inf = new File(dest);
if (!inf.exists()) {
inf.getParentFile().mkdirs();
}
FileChannel in = new FileInputStream(src).getChannel();
FileCh... | true |
900,795 | 4,228,617 | 5,537,139 | public static String createHash(String seed) {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Can't happen!", e);
}
try {
md.update(seed.getBytes(CHARSET));
... | public static String getDigest(String seed, byte[] code) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(seed.getBytes("UTF-8"));
byte[] passwordMD5Byte = md.digest(code);
StringBuffer sb = new StringBuffer();
for (int i = 0;... | true |
900,796 | 276,152 | 14,409,851 | public static void main(String[] args) throws Exception {
String linesep = System.getProperty("line.separator");
FileOutputStream fos = new FileOutputStream(new File("lib-licenses.txt"));
fos.write(new String("JCP contains the following libraries. Please read this for comments on copyright e... | public void test() throws Exception {
File temp = File.createTempFile("test", ".test");
temp.deleteOnExit();
StorageFile s = new StorageFile(temp, "UTF-8");
s.addText("Test");
s.getOutputStream().write("ing is important".getBytes("UTF-8"));
s.getWriter().write(" but o... | true |
900,797 | 22,259,089 | 10,760,907 | private ChangeCapsule fetchServer(OWLOntology ontologyURI, Long sequenceNumber) throws IOException {
String requestString = "http://" + InetAddress.getLocalHost().getHostName() + ":8080/ChangeServer";
requestString += "?fetch=" + URLEncoder.encode(ontologyURI.getURI().toString(), "UTF-8");
r... | public void send(org.hibernate.Session hsession, Session session, String repositoryName, Vector files, int label, String charset) throws FilesException {
ByteArrayInputStream bais = null;
FileOutputStream fos = null;
try {
if ((files == null) || (files.size() <= 0)) {
... | false |
900,798 | 3,474,688 | 9,593,394 | public void connect(final URLConnectAdapter urlAdapter) {
if (this.connectSettings == null) {
throw new IllegalStateException("Invalid Connect Settings (is null)");
}
final HttpURLConnection httpConnection = (HttpURLConnection) urlAdapter.openConnection();
BufferedReader ... | private RatingServiceSelectionResponseType contactService(String xmlInputString) throws Exception {
OutputStream outputStream = null;
RatingServiceSelectionResponseType rType = null;
try {
URL url = new URL(ENDPOINT_URL);
HttpURLConnection connection = (HttpURLConnect... | false |
900,799 | 9,891,128 | 10,482,004 | private static void readIzvestiyaArticles() throws IOException {
CsvReader reader = new CsvReader(new InputStreamReader(IzvestiyaUtil.class.getClassLoader().getResourceAsStream("mathnet_izvestiya.csv")), ';');
reader.setTrimWhitespace(true);
try {
while (reader.readRecord()) {
... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.