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 |
|---|---|---|---|---|---|
898,000 | 19,340,061 | 8,504,461 | public String[] fetchAutocomplete(String text) {
String[] result = new String[0];
String url = NbBundle.getMessage(MrSwingDataFeed.class, "MrSwingDataFeed.autocomplete.url", text);
HttpContext context = new BasicHttpContext();
HttpGet method = new HttpGet(url);
try {
... | @Override
protected String doInBackground(Void... params) {
try {
HttpGet request = new HttpGet(UPDATE_URL);
request.setHeader("Accept", "text/plain");
HttpResponse response = MyMovies.getHttpClient().execute(request);
int statusCode = response.getStatusLi... | false |
898,001 | 10,287,986 | 10,348,730 | 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.... | private void installBinaryFile(File source, File destination) {
byte[] buffer = new byte[8192];
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
int read;
... | true |
898,002 | 22,755,555 | 15,527,452 | private static HttpURLConnection _getConnection(HttpPrincipal httpPrincipal) throws IOException {
if (httpPrincipal == null || httpPrincipal.getUrl() == null) {
return null;
}
URL url = null;
if ((httpPrincipal.getUserId() <= 0) || (httpPrincipal.getPassword() == null)) {... | public static void copy(File source, File dest) throws IOException {
if (dest.isDirectory()) {
dest = new File(dest + File.separator + source.getName());
}
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out ... | false |
898,003 | 4,854,974 | 10,891,166 | public void GetFile(ClientConnector cc, Map<String, String> attributes) throws Exception {
log.debug("Starting FTP FilePull");
String sourceNode = attributes.get("src_name");
String sourceUser = attributes.get("src_user");
String sourcePassword = attributes.get("src_password");
... | 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 |
898,004 | 8,023,601 | 2,329,317 | protected static List<Pattern> getBotPatterns() {
List<Pattern> patterns = new ArrayList<Pattern>();
try {
Enumeration<URL> urls = AbstractPustefixRequestHandler.class.getClassLoader().getResources("META-INF/org/pustefixframework/http/bot-user-agents.txt");
while (urls.hasMor... | public ArrayList loadIndexes() {
JSONObject job = new JSONObject();
ArrayList al = new ArrayList();
try {
String req = job.put("OperationId", "1").toString();
InputStream is = null;
String result = "";
JSONObject jArray = null;
try ... | true |
898,005 | 23,149,062 | 7,276,772 | public static boolean insert(final CelulaFinanceira objCelulaFinanceira) {
int result = 0;
final Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
if (c == null) {
return false;
}
try {
c.setAutoCommit(false);
... | public void testBlobB() {
ResultSet rs;
byte[] ba;
byte[] baR1 = new byte[] { (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5, (byte) 0xF6, (byte) 0xF7, (byte) 0xF8, (byte) 0xF9, (byte) 0xFA, (byte) 0xFB };
byte[] baR2 = new byte[] { (byte) 0xE1, (byte) 0xE2, (byte) 0... | true |
898,006 | 889,519 | 6,037,299 | 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... | public void copyAffix(MailAffix affix, long mailId1, long mailId2) throws Exception {
File file = new File(this.getResDir(mailId1) + affix.getAttachAlias());
if (file.exists()) {
File file2 = new File(this.getResDir(mailId2) + affix.getAttachAlias());
if (!file2.exists()) {
... | true |
898,007 | 19,392,393 | 11,617,413 | private void addIngredients(Recipe recipe, int id) throws Exception {
PreparedStatement pst = null;
try {
conn = getConnection();
pst = conn.prepareStatement("INSERT INTO ingredients (recipe_id, name, amount, measure_id, shop_flag) VALUES (?,?,?,?,?)");
Ingredient... | private boolean postCorrecao() {
boolean valido = false;
Integer newCodCorrecao = null;
String sqlmaxac = "SELECT MAX(SEQAC) FROM PPOPACAOCORRET WHERE CODEMP=? AND CODFILIAL=? AND CODOP=? AND SEQOP=?";
String sqlmaxcq = "SELECT MAX(SEQOPCQ) + 1 FROM PPOPCQ WHERE CODEMP=? AND CODFILIA... | true |
898,008 | 2,516,458 | 13,987,172 | protected TaobaoResponse _fetch(HttpPost post, Map<String, CharSequence> payload, File file) throws IOException {
Set<Entry<String, CharSequence>> entries = payload.entrySet();
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
for (Entry<String, CharSequence> entry : entries) {
... | public void sendMessageToServer(String msg, Map<String, String> args, StringCallback cb, URLConstructor ctor) {
try {
int tmpPort = port;
for (; tmpPort < port + 10; tmpPort++) {
Socket tmpSock;
try {
tmpSock = socketsManager.connec... | false |
898,009 | 22,271,847 | 13,438,575 | public static String encryptPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
byte[] hash = md.digest();
int hashLength = hash.length;
StringBuffer hashStringBuf = new StringBuffe... | private static void serveHTML() throws Exception {
Bus bus = BusFactory.getDefaultBus();
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
Endpoi... | false |
898,010 | 21,382,198 | 8,587,767 | private void initializeTree() {
InputStreamReader reader = null;
BufferedReader buffReader = null;
try {
for (int i = 0; i < ORDER.length; i++) {
int index = ORDER[i];
String indexName = index < 10 ? "0" + index : (index > 20 ? "big" : "" + index);... | public static String encodeMD5(String input) {
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("NoSu... | false |
898,011 | 21,565,624 | 98,368 | public static String encryption(String oldPass) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
md.update(oldPass.getBytes());
byte b[] = md.digest();
... | 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 |
898,012 | 16,410,666 | 820,872 | public void backup(File source) throws BackupException {
try {
int index = source.getAbsolutePath().lastIndexOf(".");
if (index == -1) return;
File dest = new File(source.getAbsolutePath().substring(0, index) + ".bak");
FileChannel srcChannel = new FileInputSt... | 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 |
898,013 | 9,525,318 | 21,575,639 | private void copyFile(File in, File out) {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | protected byte[] readGZippedBytes(TupleInput in) {
final boolean is_compressed = in.readBoolean();
byte array[] = readBytes(in);
if (array == null) return null;
if (!is_compressed) {
return array;
}
try {
ByteArrayInputStream bais = new ByteArr... | true |
898,014 | 14,868,224 | 8,300,620 | Library(MainFrame mf, boolean newLibrary, String templateName, String newFileName) throws Exception {
mainFrame = mf;
trackMap = new HashMap<String, LibraryTrack>();
trackVec = new Vector<LibraryTrack>();
String propFileName = null;
File propFile = null;
String notExi... | @Override
public void copierPhotos(FileInputStream fichierACopier, FileOutputStream fichierDestination) {
FileChannel in = null;
FileChannel out = null;
try {
in = fichierACopier.getChannel();
out = fichierDestination.getChannel();
in.transferTo(0, in.... | true |
898,015 | 12,706,520 | 17,930,256 | private FTPClient connect() throws IOException {
FTPClient client = null;
Configuration conf = getConf();
String host = conf.get("fs.ftp.host");
int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
String user = conf.get("fs.ftp.user." + host);
String passwor... | private JButton getButtonImagen() {
if (buttonImagen == null) {
buttonImagen = new JButton();
buttonImagen.setText("Cargar Imagen");
buttonImagen.setIcon(new ImageIcon(getClass().getResource("/data/icons/view_sidetree.png")));
buttonImagen.addActionListener(ne... | false |
898,016 | 8,288,993 | 13,680,437 | private SecretKey getSecretKey() {
try {
String path = "/org.dbreplicator/repconsole/secretKey.obj";
java.net.URL url1 = getClass().getResource(path);
ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(url1.openStream()));
SecretKey sk = (Se... | public static void writeFromURL(String urlstr, String filename) throws Exception {
URL url = new URL(urlstr);
InputStream in = url.openStream();
BufferedReader bf = null;
StringBuffer sb = new StringBuffer();
try {
bf = new BufferedReader(new InputStreamReader(in,... | false |
898,017 | 9,668,598 | 9,477,468 | public static Properties parse() {
try {
String userHome = System.getProperty("user.home");
File dsigFolder = new File(userHome, ".dsig");
if (!dsigFolder.exists() && !dsigFolder.mkdir()) {
throw new IOException("Could not create .dsig folder in user home ... | public void test() throws Exception {
StringDocument doc = new StringDocument("Test", "UTF-8");
doc.open();
try {
assertEquals("UTF-8", doc.getCharacterEncoding());
assertEquals("Test", doc.getText());
InputStream input = doc.getInputStream();
... | true |
898,018 | 20,661,433 | 14,469,218 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | public static boolean copyFileToContentFolder(String source, LearningDesign learningDesign) {
File inputFile = new File(source);
File outputFile = new File(getRootFilePath(learningDesign) + inputFile.getName());
FileReader in;
try {
in = new FileReader(inputFile);
... | true |
898,019 | 5,244,020 | 1,983,098 | public static AddUserResponse napiUserAdd(String user, String pass, String email) throws TimeoutException, InterruptedException, IOException {
if (user.matches("^[a-zA-Z0-9]{2,20}$") == false) {
return AddUserResponse.NAPI_ADD_USER_BAD_LOGIN;
}
if (pass.equals("")) {
... | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | false |
898,020 | 8,898,759 | 106,595 | public static List<String> getFiles(int year, int month, int day, String type) throws Exception {
ArrayList<String> list = new ArrayList<String>();
URL url = new URL(baseUrl + "/" + year + "/" + ((month > 9) ? month : ("0" + month)) + "/" + ((day > 9) ? day : ("0" + day)));
BufferedReader br... | 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 |
898,021 | 2,717,106 | 2,831,663 | private void performDownload() {
List<String> selected = filesPane.getSelectedValuesList();
if (selected == null || selected.isEmpty() || selected.size() != 1) {
JOptionPane.showMessageDialog(this, "Please select one path");
return;
}
RFile file = new RFile(se... | public void onMessage(Message message) {
LOG.debug("onMessage");
DownloadMessage downloadMessage;
try {
downloadMessage = new DownloadMessage(message);
} catch (JMSException e) {
LOG.error("JMS error: " + e.getMessage(), e);
return;
}
... | true |
898,022 | 10,817,170 | 3,569,939 | private void extractByParsingHtml(String refererURL, String requestURL) throws MalformedURLException, IOException {
URL url = new URL(refererURL);
InputStream is = url.openStream();
mRefererURL = refererURL;
if (requestURL.startsWith("http://www.")) {
mRequestURLWWW = req... | public void connect() throws FTPException {
try {
ftp = new FTPClient();
ftp.connect(host);
if (FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
ftp.login(this.username, this.password);
} else {
ftp.disconnect();
... | false |
898,023 | 9,871,231 | 337,322 | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | true |
898,024 | 15,712,380 | 16,944,401 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Specify name of the file, just one entry per line");
System.exit(0);
}
File inFile = new File(args[0]);
BufferedReader myBR = null;
File outFile = new File(args[0] + "... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel.size(), destinationChanne... | true |
898,025 | 6,527,977 | 9,913,167 | public static void copy(File in, File out) throws IOException {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
}
| private Image getIcon(Element e) {
if (!addIconsToButtons) {
return null;
} else {
NodeList nl = e.getElementsByTagName("rc:iconURL");
if (nl.getLength() > 0) {
String urlString = nl.item(0).getTextContent();
try {
... | false |
898,026 | 10,848,568 | 21,161,481 | private static void main(String mp3Path) throws IOException {
String convPath = "http://android.adinterest.biz/wav2mp3.php?k=";
String uri = convPath + mp3Path;
URL rssurl = new URL(uri);
InputStream is = rssurl.openStream();
BufferedReader br = new BufferedReader(new InputSt... | public static void toZip(File zippedFile, File[] filesToZip, String zipComment, boolean savePath, int compressionLevel) throws IOException, FileNotFoundException, ZipException {
if (zippedFile != null && filesToZip != null) {
new File(zippedFile.getParent()).mkdirs();
ZipOutputStream... | false |
898,027 | 19,657,659 | 14,038,399 | public Download(URL url, int segs) {
this.url = url;
Mediator.register(this);
status = "Starting...";
try {
totalSize = url.openConnection().getContentLength();
name = url.getPath().substring(url.getPath().lastIndexOf('/') + 1);
if (name.isEmpty())... | private void run(String[] args) throws Throwable {
ArgParser parser = new ArgParser("Run an experiment");
parser.addOptions(this, true);
args = parser.matchAllArgs(args, 0, ArgParserOption.EXIT_ON_ERROR, ArgParserOption.STOP_FIRST_UNMATCHED);
if (log4jFile != null) {
logg... | false |
898,028 | 19,040,459 | 16,236,980 | public static String getMD5(final String text) {
if (null == text) return null;
final MessageDigest algorithm;
try {
algorithm = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
algorithm... | public void loadProperties() {
try {
java.util.Properties props = new java.util.Properties();
java.net.URL url = ClassLoader.getSystemResource("env.properties");
props.load(url.openStream());
this.proxyCertificatePath = props.getProperty("proxy.certificate.pat... | false |
898,029 | 23,647,361 | 21,680,551 | public static void main(String[] args) {
String url = "jdbc:mysql://localhost/test";
String user = "root";
String password = "password";
String imageLocation = "C:\\Documents and Settings\\EddyM\\Desktop\\Nick\\01100002.tif";
String imageLocation2 = "C:\\Documents and Setting... | private static File createTempWebXml(Class portletClass, File portletDir, String appName, String portletName) throws IOException, FileNotFoundException {
File pathToWebInf = new File(portletDir, "WEB-INF");
File tempWebXml = File.createTempFile("web", ".xml", pathToWebInf);
tempWebXml.delete... | true |
898,030 | 9,935,769 | 22,950,125 | public static InputSource openInputSource(String resource) {
InputSource src = null;
URL url = findResource(resource);
if (url != null) {
try {
InputStream in = url.openStream();
src = new InputSource(in);
src.setSystemId(url.toExte... | private boolean importPKC(String keystoreLocation, String pw, String pkcFile, String alias) {
boolean imported = false;
KeyStore ks = null;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new BufferedInputStream(new FileInputStream(keystoreLocation... | false |
898,031 | 16,586,894 | 567,313 | 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/... | 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 |
898,032 | 8,678,081 | 5,198,623 | public static String encrypt(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.update(password.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(digest.digest());
} catch (NoSuchA... | public void unzip(final File outDir) throws IOException {
ZipInputStream input = new ZipInputStream(new ByteArrayInputStream(this.bytes));
ZipEntry entry = input.getNextEntry();
while (entry != null) {
entry = input.getNextEntry();
if (entry != null) {
... | false |
898,033 | 8,841,555 | 12,614,305 | public String getMd5CodeOf16(String str) {
StringBuffer buf = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte b[] = md.digest();
int i;
buf = new StringBuffer("");
for (int offset... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | false |
898,034 | 6,697,724 | 369,572 | private void copyFile(File sourceFile, File targetFile) {
beNice();
dispatchEvent(SynchronizationEventType.FileCopy, sourceFile, targetFile);
File temporaryFile = new File(targetFile.getPath().concat(".jnstemp"));
while (temporaryFile.exists()) {
try {
beN... | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | true |
898,035 | 21,575,638 | 16,466,519 | protected void writeGZippedBytes(byte array[], TupleOutput out) {
if (array == null || array.length == 0) {
out.writeBoolean(false);
writeBytes(array, out);
return;
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(array.length);
... | 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 |
898,036 | 19,295,736 | 2,963,526 | public void setTableBraille(String tableBraille, boolean sys) {
fiConf.setProperty(OptNames.fi_braille_table, tableBraille);
fiConf.setProperty(OptNames.fi_is_sys_braille_table, Boolean.toString(sys));
FileChannel in = null;
FileChannel out = null;
try {
String fi... | public static void write(File file, InputStream source) throws IOException {
OutputStream outputStream = null;
assert file != null : "file must not be null.";
assert file.isFile() : "file must be a file.";
assert file.canWrite() : "file must be writable.";
assert source != nu... | true |
898,037 | 18,942,525 | 16,116,703 | public void updateUserInfo(AuthSession authSession, AuthUserExtendedInfo infoAuth) {
log.info("Start update auth");
PreparedStatement ps = null;
DatabaseAdapter db = null;
try {
db = DatabaseAdapter.getInstance();
String sql = "update WM_AUTH_USER " + "set " +... | private void save() {
int[] selection = list.getSelectionIndices();
String dir = System.getProperty("user.dir");
for (int i = 0; i < selection.length; i++) {
File src = files[selection[i]];
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFil... | false |
898,038 | 11,651,364 | 7,300,247 | private File extractSiteFile() {
final URL url = TestCrueCONF.class.getResource(CONFIG_SITE);
final File confFile = new File(createTempDir(), "FudaaCrue_Site.xml");
try {
CtuluLibFile.copyStream(url.openStream(), new FileOutputStream(confFile), true, true);
} catch (Excep... | public void moveMessage(DBMimeMessage oSrcMsg) throws MessagingException {
if (DebugFile.trace) {
DebugFile.writeln("Begin DBFolder.moveMessage()");
DebugFile.incIdent();
}
JDCConnection oConn = null;
PreparedStatement oStmt = null;
ResultSet oRSet = n... | false |
898,039 | 18,115,173 | 9,766,481 | private void copy(File in, File out) {
log.info("Copying yam file from: " + in.getName() + " to: " + out.getName());
try {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), o... | public void copy(final File source, final File target) throws FileSystemException {
LogHelper.logMethod(log, toObjectString(), "copy(), source = " + source + ", target = " + target);
FileChannel sourceChannel = null;
FileChannel targetChannel = null;
try {
sourceChannel =... | true |
898,040 | 16,224,018 | 5,086,587 | 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 void copyFromTo(String src, String des) {
staticprintln("Copying:\"" + src + "\"\nto:\"" + des + "\"");
try {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(des).getChannel();
dstChannel.... | true |
898,041 | 1,728,000 | 4,464,301 | public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException {
if (baseName == null || locale == null || format == null || loader == null) throw new NullPointerException();
... | protected void shutdown(final boolean unexpected) {
ControlerState oldState = this.state;
this.state = ControlerState.Shutdown;
if (oldState == ControlerState.Running) {
if (unexpected) {
log.warn("S H U T D O W N --- received unexpected shutdown request.");
... | false |
898,042 | 5,145,801 | 2,775,424 | 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... | protected void truncate(File file) {
LogLog.debug("Compression of file: " + file.getAbsolutePath() + " started.");
if (FileUtils.isFileOlder(file, ManagementFactory.getRuntimeMXBean().getStartTime())) {
File backupRoot = new File(getBackupDir());
if (!backupRoot.exists() && !... | true |
898,043 | 8,809,710 | 22,919,520 | public void salva(UploadedFile imagem, Usuario usuario) {
File destino = new File(pastaImagens, usuario.getId() + ".imagem");
try {
IOUtils.copyLarge(imagem.getFile(), new FileOutputStream(destino));
} catch (IOException e) {
throw new RuntimeException("Erro ao copiar... | public static void copyFile(String sourceFilePath, String destFilePath) throws IOException {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(sourceFilePath).getChannel();
out = new FileOutputStream(destFilePath).getChannel();
... | true |
898,044 | 22,305,828 | 22,580,642 | protected InputSource getInputSource(String pReferencingSystemId, String pURI) throws SAXException {
URL url = null;
if (pReferencingSystemId != null) {
try {
url = new URL(new URL(pReferencingSystemId), pURI);
} catch (MalformedURLException e) {
}... | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
long startTime = System.currentTimeMillis();
boolean validClient = true;
boolean validSession = false;
String sessionKey = req.getParameter("sid");
Str... | false |
898,045 | 7,898,667 | 359,113 | public LogoutHandler(String username, String token) {
try {
URL url = new URL("http://eiffel.itba.edu.ar/hci/service/Security.groovy?method=LogOut&username=" + username + "&authentication_token=" + token);
URLConnection urlc = url.openConnection();
urlc.setDoOutput(false)... | public static void bubbleSort(String[] a) {
Collator myCollator = Collator.getInstance();
boolean switched = true;
for (int pass = 0; pass < a.length - 1 && switched; pass++) {
switched = false;
for (int i = 0; i < a.length - pass - 1; i++) {
if (myCol... | false |
898,046 | 17,456,737 | 12,973,146 | public File addFile(File file, String suffix) throws IOException {
if (file.exists() && file.isFile()) {
File nf = File.createTempFile(prefix, "." + suffix, workdir);
nf.delete();
if (!file.renameTo(nf)) {
IOUtils.copy(file, nf);
}
... | public static void copyFile(String fromFile, String toFile) {
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
to = new FileOutputStream(toFile);
byte[] buffer = new byte[4096];
int bytesRead;... | true |
898,047 | 3,809,086 | 11,139,853 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1.setEnabled(false);
for (int i = 0; i < max; i++) {
Card crd = WLP.getSelectedCard(WLP.jTable1.getSelectedRows()[i]);
String s, s2;
s = "";
s2 = "";
try {
... | 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 |
898,048 | 21,566,235 | 9,562,033 | private void copy(File source, File destination) {
if (!destination.exists()) {
destination.mkdir();
}
File files[] = source.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
... | public void run(String srcf, String dst) {
final Path srcPath = new Path("./" + srcf);
final Path desPath = new Path(dst);
try {
Path[] srcs = FileUtil.stat2Paths(hdfs.globStatus(srcPath), srcPath);
OutputStream out = FileSystem.getLocal(conf).create(desPath);
... | true |
898,049 | 20,651,942 | 8,309,142 | public synchronized void receive(MessageEvent e) {
switch(e.message.getType()) {
case MessageTypes.QUIT:
activeSessions--;
break;
case MessageTypes.SHUTDOWN_SERVER:
activeSessions--;
if (Options.password.trim().equals(""... | public boolean check(String password) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes("ISO-8859-1"));
md.update((byte) ':');
md.update(realm.getBytes("ISO-8859-1"));
md.update((by... | true |
898,050 | 10,115,630 | 7,321,949 | public static boolean copyDataToNewTable(EboContext p_eboctx, String srcTableName, String destTableName, String where, boolean log, int mode) throws boRuntimeException {
srcTableName = srcTableName.toUpperCase();
destTableName = destTableName.toUpperCase();
Connection cn = null;
Conn... | 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 ... | false |
898,051 | 12,082,140 | 7,047,049 | public static Set<Street> getVias(String pURL) {
Set<Street> result = new HashSet<Street>();
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String iniDesErr = "<des>";
String finDesErr = "</des>";
String iniVia = "<calle>";
String finVia = "</calle... | public URL grabCover(String artist, String title) {
if (idf.jCheckBox3.isSelected()) {
println("Searching cover for: " + artist);
artist = artist.trim();
URL url = null;
int searchnumber = 0;
try {
URL yahoo = new URL("http://www.gr... | true |
898,052 | 14,577,834 | 1,296,795 | private void delay(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
String url = request.getRequestURL().toString();
if (delayed.contains(url)) {
delayed.remove(url);
LOGGER.info(MessageFormat.format("Loading ... | static InputStream getUrlStream(String url) throws IOException {
System.out.print("getting : " + url + " ... ");
long start = System.currentTimeMillis();
URLConnection c = new URL(url).openConnection();
InputStream is = c.getInputStream();
System.out.print((System.currentTime... | false |
898,053 | 2,066,343 | 13,521,323 | public 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);... | public static void copyFile(final String inFile, final String outFile) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(inFile).getChannel();
out = new FileOutputStream(outFile).getChannel();
in.transferTo(0, in.size(), out);... | true |
898,054 | 22,170,050 | 2,915,107 | 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... | public static void unZip(String unZipfileName, String outputDirectory) throws IOException, FileNotFoundException {
FileOutputStream fileOut;
File file;
ZipEntry zipEntry;
ZipInputStream zipIn = new ZipInputStream(new BufferedInputStream(new FileInputStream(unZipfileName)), encoder);
... | false |
898,055 | 23,400,223 | 20,514,304 | public void update(Channel channel) throws Exception {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String exp = channel.getExtendParent();
String path = channel.getPath();
try {
... | @SuppressWarnings("unchecked")
private Map<String, Object> _request(String method, String path, Map<String, Object> body, JSONRecognizer... recognizers) throws IOException, TwinException {
String uri = url + path;
HttpRequest request;
if (body == null) {
BasicHttpRequest r = ... | false |
898,056 | 1,966,263 | 2,829,981 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public void copyFile() throws Exception {
SmbFile file = new SmbFile("smb://elsa:elsa@elsa/Elsa/Desktop/Ficheiros2/04-04-2066/How To Make a Flash Preloader.doc");
println("length: " + file.length());
SmbFileInputStream in = new SmbFileInputStream(file);
println("available: " + in.ava... | true |
898,057 | 555,513 | 5,620,793 | 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 byte[] SHA1byte(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest... | false |
898,058 | 1,089,238 | 1,008,326 | private Document saveFile(Document document, File file) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATEFORMAT_YYYYMMDD);
List<Preference> preferences = prefService.findAll();
if (preferences != null && !preferences.isEmpty()) {
Preference preference ... | public long copyDirAllFilesToDirectoryRecursive(String baseDirStr, String destDirStr, boolean copyOutputsRtIDsDirs) throws Exception {
long plussQuotaSize = 0;
if (baseDirStr.endsWith(sep)) {
baseDirStr = baseDirStr.substring(0, baseDirStr.length() - 1);
}
if (destDirStr.... | true |
898,059 | 14,129,929 | 19,436,818 | public static void copy(String sourceFile, String targetFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel();
FileChannel targetChannel = new FileOutputStream(targetFile).getChannel();
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.s... | private void collectImageFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException {
final File file = new File(collectedDirectory, ActionBuilderUtils.getString(ACTION_BUILDER, "configSource.image.name"));
final FileOutputStream fos = new FileOutputStream(file... | true |
898,060 | 8,407,905 | 11,113,074 | private void copyResources(File oggDecDir, String[] resources, String resPrefix) throws FileNotFoundException, IOException {
for (int i = 0; i < resources.length; i++) {
String res = resPrefix + resources[i];
InputStream is = this.getClass().getResourceAsStream(res);
if (... | public void backupXML() {
try {
TimeStamp timeStamp = new TimeStamp();
String fnameIn = this.fnameXML();
String pathBackup = this.pathXML + "\\Backup\\";
String fnameOut = fnameIn.substring(fnameIn.indexOf(this.fname), fnameIn.length());
fnameOut =... | true |
898,061 | 20,929,227 | 12,962,189 | private void insertService(String table, int type) {
Connection con = null;
log.info("");
log.info("正在生成" + table + "的服务。。。。。。。");
try {
con = DODataSource.getDefaultCon();
con.setAutoCommit(false);
Statement stmt = con.createStatement();
... | private boolean verifyPassword(String password, byte[] hash) {
boolean returnValue = false;
try {
MessageDigest msgDigest = MessageDigest.getInstance("SHA-1");
msgDigest.update(password.getBytes("UTF-8"));
byte[] digest = msgDigest.digest();
returnValu... | false |
898,062 | 13,940,356 | 13,627,621 | public static String md5(String s) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte[] md5sum = digest.digest();
BigInteger bigInt = new BigInteger(1, md5sum);
String output = bigInt.toString(16);
... | public static synchronized String hash(String plaintext) {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
return null;
}
try {
md.update(plaintext.getBytes("UTF-8"));
} catch (U... | true |
898,063 | 20,601,756 | 213,301 | public static File copyFile(String path) {
File src = new File(path);
File dest = new File(src.getName());
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
FileChann... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | true |
898,064 | 22,135,201 | 22,619,332 | public void testCodingFromFileSmaller() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);... | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
LOG.debug("copying file");
String tTempFileName = this.getTempDir() + "uploaded-file.tmp";
IOUtils.copy(pDeposit.getFile(), new FileOutputStream(tTempFileName));
Datastrea... | true |
898,065 | 15,167,113 | 744,014 | public static void doHttpPost(String urlName, byte[] data, String contentType, String cookieData) throws InteropException {
URL url = getAccessURL(urlName);
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | false |
898,066 | 3,169,056 | 1,142,775 | private List<String> getHashesFrom(String webPage) {
Vector<String> out = new Vector();
try {
URL url = new URL(webPage);
BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = r.readLine()) != null)... | public String[] getFriends() {
InputStream is = null;
String[] answer = null;
String result = "";
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(domain);
httppost.setEntity(new UrlEncodedFormEntity(library))... | false |
898,067 | 11,075,914 | 18,730,318 | public InputStream open(String filename) throws IOException {
URL url = TemplateLoader.resolveURL("cms/" + filename);
if (url != null) return url.openStream();
url = TemplateLoader.resolveURL(filename);
if (url != null) return url.openStream();
return null;
}
| public boolean write(Node node, LSOutput output) throws LSException {
OutputStream out = output.getByteStream();
try {
if (out == null) {
String systemId = output.getSystemId();
try {
URL url = new URL(systemId);
URL... | false |
898,068 | 18,241,505 | 7,386,971 | public static String generateToken(ClientInfo clientInfo) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
Random rand = new Random();
String random = clientInfo.getIpAddress() + ":" + clientInfo.getPort() + ":" + rand.nextInt();
md5.update(random... | public String hash(String senha) {
String result = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(senha.getBytes());
byte[] hashMd5 = md.digest();
for (int i = 0; i < hashMd5.length; i++) result += Integer.toHexString((((hashM... | true |
898,069 | 20,094,305 | 16,714,944 | protected String getPageText(final String url) {
StringBuilder b = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
String line = null;
while ((line = reader.readLine())... | public static String MD5(String text) throws ProducteevSignatureException {
try {
MessageDigest md;
md = MessageDigest.getInstance(ALGORITHM);
byte[] md5hash;
md.update(text.getBytes("utf-8"), 0, text.length());
md5hash = md.digest();
r... | false |
898,070 | 21,337,941 | 7,872,663 | public static void main(String[] argv) throws IOException {
int i;
for (i = 0; i < argv.length; i++) {
if (argv[i].charAt(0) != '-') break;
++i;
switch(argv[i - 1].charAt(1)) {
case 'b':
try {
flag_predic... | private static boolean prepareQualifyingFile(String completePath, String outputFile) {
try {
File inFile = new File(completePath + fSep + "qualifying.txt");
FileChannel inC = new FileInputStream(inFile).getChannel();
BufferedReader br = new BufferedReader(new FileReader(i... | true |
898,071 | 16,023,045 | 19,262,311 | public NodeId generateTopicId(String topicName) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
System.err.println("No SHA support!");
}
md.update(topicName.getBytes());
byte[] dige... | public static String encrypt(String key) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md5.update(key.getBytes());
byte hash[] = md5.digest();
Str... | true |
898,072 | 9,516,458 | 14,414,546 | public String getHash(String type, String text, String salt) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance(type);
byte[] hash = new byte[md.getDigestLength()];
if (!salt.isEmpty()) {
md.update(salt.getByte... | private void deleteProject(String uid, String home, HttpServletRequest request, HttpServletResponse response) throws Exception {
String project = request.getParameter("project");
String line;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
htmlHe... | false |
898,073 | 21,907,871 | 7,038,631 | public static void extractFile(String jarArchive, String fileToExtract, String destination) {
FileWriter writer = null;
ZipInputStream zipStream = null;
try {
FileInputStream inputStream = new FileInputStream(jarArchive);
BufferedInputStream bufferedStream = new Buffe... | private FileLog(LOG_LEVEL displayLogLevel, LOG_LEVEL logLevel, String logPath) {
this.logLevel = logLevel;
this.displayLogLevel = displayLogLevel;
if (null != logPath) {
logFile = new File(logPath, "current.log");
log(LOG_LEVEL.DEBUG, "FileLog", "Initialising logfile ... | true |
898,074 | 17,638,222 | 14,876,163 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) destFile.createNewFile();
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
... | 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 |
898,075 | 15,796,840 | 12,440,171 | public Boolean compress(String sSourceDir, ArrayList<String> aFiles, String sDestinationFilename) {
logger.debug("compress(%s, %s, %s)", sSourceDir, aFiles, sDestinationFilename);
BufferedInputStream oOrigin = null;
FileOutputStream oDestination;
ZipOutputStream oOutput = null;
... | public void writeFile(String resource, InputStream is) throws IOException {
File f = prepareFsReferenceAsFile(resource);
FileOutputStream fos = new FileOutputStream(f);
BufferedOutputStream bos = new BufferedOutputStream(fos);
try {
IOUtils.copy(is, bos);
} finall... | true |
898,076 | 7,051,649 | 840,277 | private void copyFile(String inputPath, String basis, String filename) throws GLMRessourceFileException {
try {
FileChannel inChannel = new FileInputStream(new File(inputPath)).getChannel();
File target = new File(basis, filename);
FileChannel outChannel = new FileOutputS... | 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 |
898,077 | 2,109,483 | 20,815,136 | @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... | public static void copyTo(File src, File dest) throws IOException {
if (src.equals(dest)) throw new IOException("copyTo src==dest file");
FileOutputStream fout = new FileOutputStream(dest);
InputStream in = new FileInputStream(src);
IOUtils.copyTo(in, fout);
fout.flush();
... | true |
898,078 | 21,119,989 | 23,290,018 | public static final InputStream openStream(Bundle bundle, IPath file, boolean localized) throws IOException {
URL url = null;
if (!localized) {
url = findInPlugin(bundle, file);
if (url == null) url = findInFragments(bundle, file);
} else {
url = FindSuppo... | public static String md5(String s) {
try {
MessageDigest digester = MessageDigest.getInstance("MD5");
digester.update(s.getBytes());
return new BigInteger(1, digester.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
... | false |
898,079 | 16,386,620 | 2,857,623 | public static void main(String[] args) {
try {
FileReader reader = new FileReader(args[0]);
FileWriter writer = new FileWriter(args[1]);
html2xhtml(reader, writer);
writer.close();
reader.close();
} catch (Exception e) {
freemin... | private void copy(File src, File dest, String name) {
File srcFile = new File(src, name);
File destFile = new File(dest, name);
if (destFile.exists()) {
if (destFile.lastModified() == srcFile.lastModified()) return;
destFile.delete();
}
FileChannel in ... | true |
898,080 | 2,373,293 | 604,392 | 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 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 |
898,081 | 467,550 | 8,250,731 | 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... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String uuid = req.getParameterValues(Constants.PARAM_UUID)[0];
String datastream = null;
if (req.getRequestURI().contains(Constants.SERVLET_DOWNLOAD_FOXML_PREFIX)) {
... | true |
898,082 | 8,352,857 | 4,311,563 | public void sendMessage(Message m) throws IOException {
URL url = new URL(strURL);
urlcon = (HttpURLConnection) url.openConnection();
urlcon.setUseCaches(false);
urlcon.setDefaultUseCaches(false);
urlcon.setDoOutput(true);
urlcon.setDoInput(true);
urlcon.setRe... | public static int sendMessage(String auth_token, String registrationId, String message) throws IOException {
StringBuilder postDataBuilder = new StringBuilder();
postDataBuilder.append(PARAM_REGISTRATION_ID).append("=").append(registrationId);
postDataBuilder.append("&").append(PARAM_COLLAPS... | false |
898,083 | 3,101,854 | 18,060,082 | public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException {
URL url = configuration.get(publicID);
try {
if (url != null) return url.openStream();
} catch (IOException ex) {
throw new XMLStreamException(S... | public static String generateDigest(String password, String saltHex, String alg) {
try {
MessageDigest sha = MessageDigest.getInstance(alg);
byte[] salt = new byte[0];
if (saltHex != null) {
salt = fromHex(saltHex);
}
String label =... | false |
898,084 | 19,710,228 | 22,502,712 | public void init(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes("UTF-8"), 0, password.length());
byte[] rawKey = md.digest();
skeySpec = new SecretKeySpec(rawKey, "AES");
ivSpec = new IvPar... | public static String crypt(String passwd, boolean pad) {
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.update(passwd.getBytes());
String c = new String(sha.digest());
return toNumeric(c, pad, true);
} catch (java.security.NoSuchAlgo... | true |
898,085 | 8,660,836 | 13,206,754 | public void transform(String style, String spec, OutputStream out) throws IOException {
URL url = new URL(rootURL, spec);
InputStream in = new PatchXMLSymbolsStream(new StripDoctypeStream(url.openStream()));
transform(style, in, out);
in.close();
}
| public static String md5Encrypt(String valueToEncrypted) {
String encryptedValue = "";
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(valueToEncrypted.getBytes());
BigInteger hash = new BigInteger(1, digest.digest());
encr... | false |
898,086 | 817,948 | 7,333,455 | private boolean keysMatch(String keyNMinusOne, String keyN) {
boolean match = false;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(keyNMinusOne.getBytes());
byte[] hashedBytes = digest.digest();
... | private static String doHash(String frase, String algorithm) {
try {
String ret;
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(frase.getBytes());
BigInteger bigInt = new BigInteger(1, md.digest());
ret = bigInt.toString(16);
... | true |
898,087 | 4,579,205 | 15,889,430 | public static void copyFile(String source, String destination) throws IOException {
File srcDir = new File(source);
File[] files = srcDir.listFiles();
FileChannel in = null;
FileChannel out = null;
for (File file : files) {
try {
in = new FileInput... | public Parameters getParameters(HttpExchange http) throws IOException {
ParametersImpl params = new ParametersImpl();
String query = null;
if (http.getRequestMethod().equalsIgnoreCase("GET")) {
query = http.getRequestURI().getRawQuery();
} else if (http.getRequestMethod()... | true |
898,088 | 21,395,181 | 15,143,217 | @Test
public void test20_badSmtp() throws Exception {
Db db = DbConnection.defaultCieDbRW();
try {
db.begin();
oldSmtp = Config.getProperty(db, "com.entelience.mail.MailHelper.hostName", "localhost");
oldSupport = Config.getProperty(db, "com.entelience.esis.fe... | @Override
public String getMD5(String host) {
String res = "";
Double randNumber = Math.random() + System.currentTimeMillis();
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(randNumber.toString().g... | false |
898,089 | 16,012,363 | 2,852,141 | public static void main(String[] args) throws IOException {
String uri = "hdfs://localhost:8020/user/leeing/maxtemp/sample.txt";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.o... | public static void copyFile(String input, String output) {
try {
File inputFile = new File(input);
File outputFile = new File(output);
FileReader in;
in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
... | true |
898,090 | 7,409,728 | 1,914,865 | protected void innerProcess(CrawlURI curi) throws InterruptedException {
if (!curi.isHttpTransaction()) {
return;
}
if (!TextUtils.matches("^text.*$", curi.getContentType())) {
return;
}
long maxsize = DEFAULT_MAX_SIZE_BYTES.longValue();
try {
... | public String hash(String plainTextPassword) {
try {
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
digest.update(plainTextPassword.getBytes(charset));
byte[] rawHash = digest.digest();
return new String(Hex.encodeHex(rawHash));
} c... | true |
898,091 | 14,914,613 | 21,461,878 | private void retrieveData() {
StringBuffer obsBuf = new StringBuffer();
try {
URL url = new URL(getProperty("sourceURL"));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String lineIn = null;
while ((lineIn = in.readLi... | private boolean verifyAppId(String appid) {
try {
String urlstr = "http://" + appid + ".appspot.com";
URL url = new URL(urlstr);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
... | true |
898,092 | 21,756,553 | 23,429,413 | public static List<String> list() throws IOException {
List<String> providers = new ArrayList<String>();
Enumeration<URL> urls = ClassLoader.getSystemResources("sentrick.classifiers");
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
String provider = nu... | public static String plainToMD(LoggerCollection loggerCol, String input) {
byte[] byteHash = null;
MessageDigest md = null;
StringBuilder md4result = new StringBuilder();
try {
md = MessageDigest.getInstance("MD4", new BouncyCastleProvider());
md.reset();
... | false |
898,093 | 8,883,153 | 19,145,296 | protected int getResponseCode(String address) throws Exception {
URL url = new URL(address);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setUseCaches(false);
try {
con.connect();
return con.getResponseCode();
} finally {
... | public static double[][] getCurrency() throws IOException {
URL url = new URL("http://hk.finance.yahoo.com/currency");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "big5"));
double currency[][] = new double[11][11];
while (true) {
String ... | false |
898,094 | 23,370,570 | 11,499,032 | public void xtestGetThread() throws Exception {
GMSearchOptions options = new GMSearchOptions();
options.setFrom(loginInfo.getUsername() + "*");
options.setSubject("message*");
GMSearchResponse mail = client.getMail(options);
for (Iterator it = mail.getThreadSnapshots().itera... | private void outputSignedOpenDocument(byte[] signatureData) throws IOException {
LOG.debug("output signed open document");
OutputStream signedOdfOutputStream = getSignedOpenDocumentOutputStream();
if (null == signedOdfOutputStream) {
throw new NullPointerException("signedOpenDocu... | true |
898,095 | 13,522,884 | 19,550,140 | 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... | private static void ensure(File pFile) throws IOException {
if (!pFile.exists()) {
FileOutputStream fos = new FileOutputStream(pFile);
String resourceName = "/" + pFile.getName();
InputStream is = BaseTest.class.getResourceAsStream(resourceName);
Assert.assert... | true |
898,096 | 1,322,369 | 3,874,060 | private void unpackBundle() throws IOException {
File useJarPath = null;
if (DownloadManager.isWindowsVista()) {
useJarPath = lowJarPath;
File jarDir = useJarPath.getParentFile();
if (jarDir != null) {
jarDir.mkdirs();
}
} else ... | public static void copyFile(File sourceFile, File targetFile) throws IOException {
if (sourceFile == null || targetFile == null) {
throw new NullPointerException("Source file and target file must not be null");
}
File directory = targetFile.getParentFile();
if (!directory... | true |
898,097 | 16,755,605 | 17,829,989 | private void writeResponse(final Collection<? extends Resource> resources, final HttpServletResponse response) throws IOException {
for (final Resource resource : resources) {
InputStream in = null;
try {
in = resource.getInputStream();
final OutputStr... | @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... | true |
898,098 | 11,314,030 | 9,794,673 | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | public Component loadComponent(URI uri, URI origuri) throws ComponentException {
try {
Component comp = null;
InputStream is = null;
java.net.URL url = null;
try {
url = uri.getJavaURL();
} catch (java.net.MalformedURLException e) {... | false |
898,099 | 18,467,319 | 21,201,276 | @Nullable
@Override
public InputSource resolveEntity(final String publicId, final String systemId) throws IOException {
if (systemId.endsWith(".xml")) {
return null;
}
InputSource inputSource = null;
final URL url = IOUtils.getResou... | private static void run(Display display, int x) {
Shell shell = new Shell(display);
shell.setBounds(0, 0, 350, 350);
shell.setLayout(new FillLayout(SWT.VERTICAL));
ERDiagramEditPartFactory editPartFactory = new ERDiagramEditPartFactory();
GraphicalViewer viewer = new Scrollin... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.