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 |
|---|---|---|---|---|---|
3,000 | 19,322,906 | 10,041,453 | @Test
public void test_baseMaterialsForTypeID_NonExistingID() throws Exception {
URL url = new URL(baseUrl + "/baseMaterialsForTypeID/1234567890");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestPr... | public static void printResource(OutputStream os, String resourceName) throws IOException {
InputStream is = null;
try {
is = ResourceLoader.loadResource(resourceName);
if (is == null) {
throw new IOException("Given resource not found!");
}
... | false |
3,001 | 20,913,493 | 11,673,911 | public static void copy(File src, File dest) throws IOException {
log.info("Copying " + src.getAbsolutePath() + " to " + dest.getAbsolutePath());
if (!src.exists()) throw new IOException("File not found: " + src.getAbsolutePath());
if (!src.canRead()) throw new IOException("Source not readab... | private void _save(ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form) throws Exception {
List list = (List) req.getAttribute(WebKeys.LANGUAGE_MANAGER_LIST);
for (int i = 0; i < list.size(); i++) {
long langId = ((Language) list.get(i)).getId();
try ... | true |
3,002 | 23,241,520 | 19,670,916 | private FeedIF retrieveFeed(String uri) throws FeedManagerException {
try {
URL urlToRetrieve = new URL(uri);
URLConnection conn = null;
try {
conn = urlToRetrieve.openConnection();
if (conn instanceof HttpURLConnection) {
... | private void pushResource(String peerId, String communityId, String resourceFilePath, List<String> attachmentFilePaths) throws IOException {
String urlString = "http://" + peerId + "/upload";
HttpURLConnection uploadConnection = null;
DataOutputStream connOutput = null;
FileInputStre... | false |
3,003 | 11,717,079 | 18,506,484 | void copyFile(File inputFile, File outputFile) {
try {
FileReader in;
in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
... | private int addPollToDB(DataSource database) {
int pollid = -2;
Connection con = null;
try {
con = database.getConnection();
con.setAutoCommit(false);
String add = "insert into polls" + " values( ?, ?, ?, ?)";
PreparedStatement prepStatement = ... | false |
3,004 | 14,510,383 | 16,360,226 | @Override
public void copyFile2File(final File src, final File dest, final boolean force) throws C4JException {
if (dest.exists()) if (force && !dest.delete()) throw new C4JException(format("Copying ‘%s’ to ‘%s’ failed; cannot overwrite existing file.", src.getPath(), dest.getPath()));
FileChann... | public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Parameters: method arg1 arg2 arg3 etc");
System.out.println("");
System.out.println("Methods:");
System.out.println(" reloadpolicies");
System.out.println(" ... | true |
3,005 | 18,675,737 | 12,048,547 | 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... | 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.... | true |
3,006 | 22,321,272 | 649,639 | public static void copyFile(File from, File to) throws Exception {
if (!from.exists()) return;
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
byte[] buffer = new byte[BUFFER_SIZE];
int bytes_read;
while (true) {
... | 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 |
3,007 | 2,241,061 | 1,760,353 | public static void save(String from, String recipient, InputStream in, MimeMessage message) throws IOException, MessagingException, DocumentVideException {
ConversationManager conversationManager = FGDSpringUtils.getConversationManager();
conversationManager.beginConversation();
FGDDelegate ... | public static int deleteSysPosInsert() {
Connection conn = null;
PreparedStatement psmt = null;
StringBuffer SQL = new StringBuffer(200);
int deleted = 0;
SQL.append(" DELETE FROM JHF_SYS_POSITION_INSERT ");
try {
conn = JdbcConnectionPool.mainConnection()... | false |
3,008 | 15,286,502 | 16,076,390 | public static String md5(String senha) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Ocorreu NoSuchAlgorithmException");
}
md.update(senha.getBytes());
byte[] ... | public static String hash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | true |
3,009 | 587,124 | 22,628,847 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public static void main(String[] args) throws Exception {
System.out.println("Opening destination cbrout.jizz");
OutputStream out = new BufferedOutputStream(new FileOutputStream("cbrout.jizz"));
System.out.println("Opening source output.jizz");
InputStream in = new CbrLiveStream(new ... | true |
3,010 | 19,279,420 | 11,854,456 | 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 int copy(File src, int amount, File dst) {
final int BUFFER_SIZE = 1024;
int amountToRead = amount;
boolean ok = true;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
o... | true |
3,011 | 3,331,971 | 12,214,439 | protected void onSubmit() {
try {
Connection conn = ((JdbcRequestCycle) getRequestCycle()).getConnection();
String sql = "insert into entry (author, accessibility) values(?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, userId);
... | public boolean saveNote(NoteData n) {
String query;
try {
conn.setAutoCommit(false);
Statement stmt = null;
ResultSet rset = null;
stmt = conn.createStatement();
query = "select * from notes where noteid = " + n.getID();
rset = ... | true |
3,012 | 553,082 | 4,673,959 | 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;
... | public static String createRecoveryContent(String password) {
try {
password = encryptGeneral1(password);
String data = URLEncoder.encode("key", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
URL url = new URL("https://mypasswords-server.appspot.com/recovery_file"... | true |
3,013 | 13,643,066 | 2,633,238 | @Override
public void run() {
if (mMode == 0) {
long currentVersion = Version.extractVersion(App.getVersion());
if (currentVersion == 0) {
mMode = 2;
RESULT = MSG_UP_TO_DATE;
return;
}
long versionAvailable =... | public static String getResourceFromURL(URL url, String acceptHeader) throws java.io.IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setUseCaches(false);
urlConnection.setRequestProperty("Accept", acceptHeader);
urlConnection.se... | true |
3,014 | 17,831,556 | 17,965,575 | public static String generateHash(String msg) throws NoSuchAlgorithmException {
if (msg == null) {
throw new IllegalArgumentException("Input string can not be null");
}
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(msg.getBytes());
... | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
OutputStream output = getOutputStream();
if (cachedContent != null) {
output.write(cachedContent);
} else {
FileInputStream input = new FileInput... | false |
3,015 | 5,053,350 | 3,436,001 | @Test
public void testGrantLicense() throws Exception {
context.turnOffAuthorisationSystem();
Item item = Item.create(context);
String defaultLicense = ConfigurationManager.getDefaultSubmissionLicense();
LicenseUtils.grantLicense(context, item, defaultLicense);
StringWrit... | public static void copyFile(File in, File out) {
if (!in.exists() || !in.canRead()) {
LOGGER.warn("Can't copy file : " + in);
return;
}
if (!out.getParentFile().exists()) {
if (!out.getParentFile().mkdirs()) {
LOGGER.info("Didn't create par... | true |
3,016 | 3,517,430 | 2,736,180 | public static String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
... | public static byte[] getURLContent(String urlPath) {
HttpURLConnection conn = null;
InputStream inStream = null;
byte[] buffer = null;
try {
URL url = new URL(urlPath);
HttpURLConnection.setFollowRedirects(false);
conn = (HttpURLConnection) url.ope... | false |
3,017 | 8,209,783 | 23,398,987 | List<String> HttpGet(URL url) throws IOException {
List<String> responseList = new ArrayList<String>();
Logger.getInstance().logInfo("HTTP GET: " + url, null, null);
URLConnection con = url.openConnection();
con.setAllowUserInteraction(false);
BufferedReader in = new Buffered... | @Override
public void updateItems(List<InputQueueItem> toUpdate) throws DatabaseException {
if (toUpdate == null) throw new NullPointerException("toUpdate");
try {
getConnection().setAutoCommit(false);
} catch (SQLException e) {
LOGGER.warn("Unable to set autocomm... | false |
3,018 | 1,410,953 | 16,946,193 | public IOCacheArray(final File file, int capacity, final IIOCacheArrayObjectMaker iomaker, int chunkSize, String name) {
super(capacity, null, chunkSize, name);
generator = new ICacheArrayObjectMaker() {
FileOutputStream outStream;
FileInputStream inStream;
Fil... | 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 |
3,019 | 19,710,228 | 7,922,492 | 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... | protected String calcAuthResponse(String challenge) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(securityPolicy);
md.update(challenge.getBytes());
for (int i = 0, n = password.length; i < n; i++) {
md.update((byte) password[i]);
}
... | true |
3,020 | 13,121,131 | 13,086,935 | 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 void getInfoFromXML() {
final ProgressDialog dialog = ProgressDialog.show(this, "", getString(R.string.loading), true, true);
setProgressBarIndeterminateVisibility(true);
Thread t3 = new Thread() {
public void run() {
waiting(200);
txtinfo... | false |
3,021 | 15,260,218 | 2,247,987 | 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 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... | false |
3,022 | 16,663,549 | 1,415,765 | private void prepareQueryResultData(ZipEntryRef zer, String nodeDir, String reportDir, Set<ZipEntryRef> statusZers) throws Exception {
String jobDir = nodeDir + File.separator + "job_" + zer.getUri();
if (!WorkDirectory.isWorkingDirectoryValid(jobDir)) {
throw new Exception("Cannot acces... | public static String getMD5(String _pwd) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(_pwd.getBytes());
return toHexadecimal(new String(md.digest()).getBytes());
} catch (NoSuchAlgorithmException x) {
x.printStackTrace();
... | false |
3,023 | 8,988,204 | 9,510,692 | @Override
public void onLoadingEnded() {
if (m_frame != null) {
try {
String urltext = getDocument().getDocumentURI();
URL url = new URL(urltext);
InputStreamReader isr = new InputStreamReader(url.openStream());
BufferedReader i... | public static void main(String[] args) {
try {
boolean readExp = Utils.getFlag('l', args);
final boolean writeExp = Utils.getFlag('s', args);
final String expFile = Utils.getOption('f', args);
if ((readExp || writeExp) && (expFile.length() == 0)) {
... | false |
3,024 | 13,691,658 | 12,641,711 | @Test
public void testOther() throws Exception {
filter.init(this.mockConfig);
ByteArrayOutputStream jpg = new ByteArrayOutputStream();
IOUtils.copy(this.getClass().getResourceAsStream("Buffalo-Theory.jpg"), jpg);
MockFilterChain mockChain = new MockFilterChain();
mockCha... | private void scanURL(String packagePath, Collection<String> componentClassNames, URL url) throws IOException {
URLConnection connection = url.openConnection();
JarFile jarFile;
if (connection instanceof JarURLConnection) {
jarFile = ((JarURLConnection) connection).getJarFile();
... | false |
3,025 | 613,085 | 15,599,613 | private Document getDocument(URL url) throws SAXException, IOException {
InputStream is;
try {
is = url.openStream();
} catch (IOException io) {
System.out.println("parameter error : The specified reading data is mistaken.");
System.out.println(" Request U... | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | false |
3,026 | 8,209,783 | 91,017 | List<String> HttpGet(URL url) throws IOException {
List<String> responseList = new ArrayList<String>();
Logger.getInstance().logInfo("HTTP GET: " + url, null, null);
URLConnection con = url.openConnection();
con.setAllowUserInteraction(false);
BufferedReader in = new Buffered... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
3,027 | 667,135 | 861,011 | void testFileObject(JavaFileObject fo) throws Exception {
URI uri = fo.toUri();
System.err.println("uri: " + uri);
URLConnection urlconn = uri.toURL().openConnection();
if (urlconn instanceof JarURLConnection) {
JarURLConnection jarconn = (JarURLConnection) urlconn;
... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
3,028 | 12,493,156 | 23,004,976 | public static String hashPassword(String plaintext) {
if (plaintext == null) {
return "";
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
md.update(plaintext.getBytes("UTF-8"));
} catch (Exception e) {
l... | static String hash(String text) {
try {
StringBuffer plugins = new StringBuffer();
for (PlayPlugin plugin : Play.plugins) {
plugins.append(plugin.getClass().getName());
}
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
... | true |
3,029 | 14,190,765 | 15,689,768 | private void _PostParser(Document document, AnnotationManager annoMan, Document htmldoc, String baseurl) {
xformer = annoMan.getTransformer();
builder = annoMan.getBuilder();
String annohash = "";
if (document == null) return;
NodeList ndlist = document.getElementsByTagNameNS... | protected void channelConnected() throws IOException {
MessageDigest md = null;
String digest = "";
try {
String userid = nateon.getUserId();
if (userid.endsWith("@nate.com")) userid = userid.substring(0, userid.lastIndexOf('@'));
md = MessageDigest.getIns... | true |
3,030 | 9,096,318 | 3,375,715 | private void handleInterfaceUp(long eventID, long nodeID, String ipAddr, String eventTime) {
Category log = ThreadCategory.getInstance(OutageWriter.class);
if (eventID == -1 || nodeID == -1 || ipAddr == null) {
log.warn(EventConstants.INTERFACE_UP_EVENT_UEI + " ignored - info incomplete ... | public void importarHistoricoDeProventos(File pArquivoXLS, boolean pFiltrarPelaDataDeCorteDoCabecalho, Andamento pAndamento) throws IOException, SQLException, InvalidFormatException {
int iLinha = -1;
String nomeDaColuna = "";
Statement stmtLimpezaInicialDestino = null;
OraclePrepare... | true |
3,031 | 131,811 | 11,875,445 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | private static void loadFromZip() {
InputStream in = Resources.class.getResourceAsStream("data.zip");
if (in == null) {
return;
}
ZipInputStream zipIn = new ZipInputStream(in);
try {
while (true) {
ZipEntry entry = zipIn.getNextEntry();... | true |
3,032 | 21,481,555 | 839,385 | private static void loadCommandList() {
final URL url;
try {
url = IOUtils.getResource(null, PYTHON_MENU_FILE);
} catch (final FileNotFoundException ex) {
log.error("File '" + PYTHON_MENU_FILE + "': " + ex.getMessage());
return;
}
final Lis... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
3,033 | 9,219,798 | 330,930 | public static void decryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.DECRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | private 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 |
3,034 | 19,392,404 | 17,197,657 | public boolean setSchedule(Schedule s) {
PreparedStatement pst1 = null;
PreparedStatement pst2 = null;
PreparedStatement pst3 = null;
ResultSet rs2 = null;
boolean retVal = true;
try {
conn = getConnection();
pst1 = conn.prepareStatement("INSER... | private void parseXmlFile() throws IOException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
if (file != null) {
dom = db.parse(file);
} else {
dom = db.par... | false |
3,035 | 15,612,870 | 9,836,308 | public static void main(String[] args) {
FileInputStream fr = null;
FileOutputStream fw = null;
BufferedInputStream br = null;
BufferedOutputStream bw = null;
try {
fr = new FileInputStream("D:/5.xls");
fw = new FileOutputStream("c:/Dxw.java");
... | public static void writeDataResourceText(GenericValue dataResource, String mimeTypeId, Locale locale, Map templateContext, GenericDelegator delegator, Writer out, boolean cache) throws IOException, GeneralException {
Map context = (Map) templateContext.get("context");
if (context == null) {
... | false |
3,036 | 9,104,988 | 888,155 | public String getHashedPhoneId(Context aContext) {
if (hashedPhoneId == null) {
final String androidId = BuildInfo.getAndroidID(aContext);
if (androidId == null) {
hashedPhoneId = "EMULATOR";
} else {
try {
final Message... | public static boolean downloadFile(String url, String destination) throws Exception {
BufferedInputStream bi = null;
BufferedOutputStream bo = null;
File destfile;
byte BUFFER[] = new byte[100];
java.net.URL fileurl;
URLConnection conn;
fileurl = new java.net.... | false |
3,037 | 5,817,511 | 10,942,052 | @Override
public void send(String payload, TransportReceiver receiver) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
configureConnection(connection);
OutputStream out = connection.getOutputStream();
... | public static void copy(String from, String to) throws Exception {
File inputFile = new File(from);
File outputFile = new File(to);
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outputFile);
byte[] buffer = new byte[1024];
... | false |
3,038 | 10,839,252 | 14,667,831 | public static String getWebContent(String remoteUrl) {
StringBuffer sb = new StringBuffer();
try {
java.net.URL url = new java.net.URL(remoteUrl);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((lin... | public void concatFiles() throws IOException {
Writer writer = null;
try {
final File targetFile = new File(getTargetDirectory(), getTargetFile());
targetFile.getParentFile().mkdirs();
if (null != getEncoding()) {
getLog().info("Writing aggregated ... | false |
3,039 | 9,547,229 | 18,372,548 | public void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;
URL url;
InputStream stream = null;
try {
url = new URL(masterUrl);
... | static Properties readAllProps(Hashtable<?, ?> env) throws IOException {
Properties props = new Properties();
if (env != null) {
props = mergProps(props, env);
}
props = mergSysProps(props, System.getProperties());
ClassLoader classLoader = Thread.currentThread().... | false |
3,040 | 8,504,461 | 111,060 | @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... | public void load(URL urlin) throws IOException {
index = hs.getDoIndex();
loaded = false;
url = urlin;
int c, i;
htmlDocLength = 0;
HtmlReader in = new HtmlReader(new InputStreamReader(url.openStream(), charset));
try {
if (debug >= 2) System.out.p... | false |
3,041 | 20,815,980 | 23,004,976 | private void getRandomGUID(boolean secure) throws NoSuchAlgorithmException {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("... | static String hash(String text) {
try {
StringBuffer plugins = new StringBuffer();
for (PlayPlugin plugin : Play.plugins) {
plugins.append(plugin.getClass().getName());
}
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
... | true |
3,042 | 112,491 | 13,691,658 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | @Test
public void testOther() throws Exception {
filter.init(this.mockConfig);
ByteArrayOutputStream jpg = new ByteArrayOutputStream();
IOUtils.copy(this.getClass().getResourceAsStream("Buffalo-Theory.jpg"), jpg);
MockFilterChain mockChain = new MockFilterChain();
mockCha... | true |
3,043 | 11,723,383 | 18,042,543 | private void getImage(String filename) throws MalformedURLException, IOException, SAXException, FileNotFoundException {
String url = Constants.STRATEGICDOMINATION_URL + "/images/gameimages/" + filename;
WebRequest req = new GetMethodWebRequest(url);
SiteResponse response = getSiteResponse(re... | public void writeTo(OutputStream out) throws IOException, MessagingException {
InputStream in = getInputStream();
Base64OutputStream base64Out = new Base64OutputStream(out);
IOUtils.copy(in, base64Out);
base64Out.close();
mFile.delete();
}
| true |
3,044 | 413,620 | 12,649,112 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | private static void dumpUrl(URL url) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String s = reader.readLine();
while (s != null) {
System.out.println(s);
s = reader.readLine();
}
reader.clos... | false |
3,045 | 3,809,797 | 22,328,843 | protected void addAssetResources(MimeMultipart pkg, MarinerPageContext context) throws PackagingException {
boolean includeFullyQualifiedURLs = context.getBooleanDevicePolicyValue("protocol.mime.fully.qualified.urls");
MarinerRequestContext requestContext = context.getRequestContext();
Appli... | protected void doBackupOrganizeTypeRelation() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strSelQuery = "SELECT parent_organize_type,child_organize_type " + "FROM " + Common.ORGANIZE_TYPE_RELATION_TABLE;
String strIns... | false |
3,046 | 22,135,201 | 7,713,594 | public void testCodingFromFileSmaller() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);... | private static void copyFile(File source, File dest, boolean visibleFilesOnly) throws IOException {
if (visibleFilesOnly && isHiddenOrDotFile(source)) {
return;
}
if (dest.exists()) {
System.err.println("Destination File Already Exists: " + dest);
}
Fi... | true |
3,047 | 15,347,323 | 19,707,472 | public static String hash(String in, String algorithm) {
if (StringUtils.isBlank(algorithm)) algorithm = DEFAULT_ALGORITHM;
try {
md = MessageDigest.getInstance(algorithm);
} catch (NoSuchAlgorithmException nsae) {
logger.error("No such algorithm exception", nsae);
... | private void loadRDFURL(URL url) throws RDFParseException, RepositoryException {
URI urlContext = valueFactory.createURI(url.toString());
try {
URLConnection urlConn = url.openConnection();
urlConn.setRequestProperty("Accept", "application/rdf+xml");
InputStream i... | false |
3,048 | 18,034,383 | 775,729 | public static File copy(String inFileName, String outFileName) throws IOException {
File inputFile = new File(inFileName);
File outputFile = new File(outFileName);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c... | 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 |
3,049 | 10,840,966 | 413,237 | public void copy(String sourcePath, String targetPath) throws IOException {
File sourceFile = new File(sourcePath);
File targetFile = new File(targetPath);
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = ne... | 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 |
3,050 | 13,335,071 | 23,201,697 | public static boolean copy(File source, File dest) {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in.map(FileChannel... | private byte[] loadResourceFromCodeBase(String name) {
byte[] bytecode;
InputStream is = null;
logger.debug("LoadResourceFromCodeBase()++");
try {
URL url = new URL(this._codeBase, name);
int content_length = -1;
URLConnection connection = url.open... | false |
3,051 | 12,524,506 | 14,651,235 | public static void copyFile(File in, File outDir) throws IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
File out = new File(outDir, in.getName());
destinati... | public static Document getSkeleton() {
Document doc = null;
String filesep = System.getProperty("file.separator");
try {
java.net.URL url = Skeleton.class.getResource(filesep + "simplemassimeditor" + filesep + "resources" + filesep + "configskeleton.xml");
InputStream... | false |
3,052 | 2,217,508 | 670,011 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (destFile.getParentFile() != null && !destFile.getParentFile().mkdirs()) {
LOG.error("GeneralHelper.copyFile(): Cannot create parent directories from " + destFile);
}
FileInputStream f... | public static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("FileCopy: no such source file: " + from_name);
if (!from_file.isFile()) abort("FileCopy: can't copy d... | true |
3,053 | 18,070,589 | 8,122,281 | @Test
public void testWriteAndReadSecondLevel() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | public String get(String s, String encoding) throws Exception {
if (!s.startsWith("http")) return "";
StringBuilder sb = new StringBuilder();
try {
String result = null;
URL url = new URL(s);
URLConnection connection = url.openConnection();
con... | false |
3,054 | 16,022,022 | 5,634,883 | public boolean copy(Class<?> subCls, String subCol, long id) {
boolean bool = false;
this.result = null;
Connection conn = null;
Object vo = null;
try {
conn = ConnectUtil.getConnect();
conn.setAutoCommit(false);
PojoParser parser = PojoPar... | public void run() {
try {
URL url = new URL(URL_STR + "?req=list");
URLConnection connection = url.openConnection(getProxy());
connection.setRequestProperty("User-Agent", USER_AGENT);
BufferedReader bufferedRdr =... | false |
3,055 | 15,873,054 | 3,888,891 | public static final long copyFile(final File srcFile, final File dstFile, final long cpySize) throws IOException {
if ((null == srcFile) || (null == dstFile)) return (-1L);
final File dstFolder = dstFile.getParentFile();
if ((!dstFolder.exists()) && (!dstFolder.mkdirs())) throw new IOExcepti... | public String encrypt(String password) {
String encrypted_pass = "";
ByteArrayOutputStream output = null;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
byte byte_array[] = md.digest();
... | false |
3,056 | 10,106,324 | 20,861,925 | public static String md5Encode(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes());
return toHexString(md.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return s;
}
... | public static boolean isMatchingAsPassword(final String password, final String amd5Password) {
boolean response = false;
try {
final MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(password.getBytes());
f... | true |
3,057 | 20,492,749 | 12,013,963 | public synchronized String getEncryptedPassword(String plaintext, String algorithm) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(algorithm);
md.update(plaintext.getBytes("UTF-8"));
} catc... | private void findRxnFileByUrl() throws MalformedURLException, IOException {
URL url = new URL(MessageFormat.format(rxnUrl, reactionId.toString()));
LOGGER.debug("Retrieving RXN file by URL " + url);
URLConnection con = url.openConnection(java.net.Proxy.NO_PROXY);
con.connect();
... | false |
3,058 | 19,657,516 | 13,234,956 | private static Map loadHandlerList(final String resourceName, ClassLoader loader) {
if (loader == null) loader = ClassLoader.getSystemClassLoader();
final Map result = new HashMap();
try {
final Enumeration resources = loader.getResources(resourceName);
if (resources ... | protected String readFileUsingFileUrl(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
Buffere... | false |
3,059 | 22,704,165 | 14,254,575 | 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... | private byte[] _generate() throws NoSuchAlgorithmException {
if (host == null) {
try {
seed = InetAddress.getLocalHost().toString();
} catch (UnknownHostException e) {
seed = "localhost/127.0.0.1";
} catch (SecurityException e) {
... | false |
3,060 | 638,963 | 12,461,924 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private void removeSessionId(InputStream inputStream, Output output) throws IOException {
String jsessionid = RewriteUtils.getSessionId(target);
boolean textContentType = ResourceUtils.isTextContentType(httpClientResponse.getHeader(HttpHeaders.CONTENT_TYPE), target.getDriver().getConfiguration().get... | true |
3,061 | 18,923,105 | 1,008,329 | public static byte[] read(URL url) throws IOException {
byte[] bytes;
InputStream is = null;
try {
is = url.openStream();
bytes = readAllBytes(is);
} finally {
if (is != null) {
is.close();
}
}
return byt... | public long copyFile(String baseDirStr, String fileName, String file2FullPath) throws Exception {
long plussQuotaSize = 0;
if (!baseDirStr.endsWith(sep)) {
baseDirStr += sep;
}
BufferedInputStream in = null;
BufferedOutputStream out = null;
byte dataBuff[]... | false |
3,062 | 11,291,099 | 7,507,773 | public void visit(BosMember member) throws BosException {
String relative = AddressingUtil.getRelativePath(member.getDataSourceUri(), baseUri);
URL resultUrl;
try {
resultUrl = new URL(outputUrl, relative);
File resultFile = new File(resultUrl.toURI());
re... | public boolean restore(File directory) {
log.debug("restore file from directory " + directory.getAbsolutePath());
try {
if (!directory.exists()) return false;
String[] operationFileNames = directory.list();
if (operationFileNames.length < 6) {
log.... | true |
3,063 | 9,525,318 | 12,787,570 | 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... | private static void copyContent(final File srcFile, final File dstFile, final boolean gzipContent) throws IOException {
final File dstFolder = dstFile.getParentFile();
dstFolder.mkdirs();
if (!dstFolder.exists()) {
throw new RuntimeException("Unable to create the folder " + dstFo... | true |
3,064 | 4,673,959 | 738,946 | public static String createRecoveryContent(String password) {
try {
password = encryptGeneral1(password);
String data = URLEncoder.encode("key", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
URL url = new URL("https://mypasswords-server.appspot.com/recovery_file"... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
3,065 | 11,319,480 | 1,577,151 | 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 copyFile(final String src, final String dest) {
Runnable r1 = new Runnable() {
public void run() {
try {
File inf = new File(dest);
if (!inf.exists()) {
inf.getParentFile().mkdirs();
... | true |
3,066 | 13,955,716 | 16,948,800 | public static void copier(final File pFichierSource, final File pFichierDest) {
FileChannel vIn = null;
FileChannel vOut = null;
try {
vIn = new FileInputStream(pFichierSource).getChannel();
vOut = new FileOutputStream(pFichierDest).getChannel();
vIn.trans... | public static void copyFileStreams(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) {
return;
}
FileInputStream fis = new FileInputStream(fromFile);
FileOutputStream fos = new FileOutputStream(toFile);
int read = 0;
byte[] buf = new... | true |
3,067 | 12,440,171 | 6,959,224 | 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... | public static void copy(File source, File dest) throws java.io.IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer ... | true |
3,068 | 12,394,809 | 7,227,330 | public static final File getFile(final URL url) throws IOException {
final File shortcutFile;
final File currentFile = files.get(url);
if (currentFile == null || !currentFile.exists()) {
shortcutFile = File.createTempFile("windowsIsLame", ".vbs");
shortcutFile.deleteO... | private void sort() {
boolean unsortiert = true;
Datei tmp = null;
while (unsortiert) {
unsortiert = false;
for (int i = 0; i < this.size - 1; i++) {
if (dateien[i] != null && dateien[i + 1] != null) {
if (dateien[i].compareTo(datei... | false |
3,069 | 21,161,448 | 19,731,419 | public static boolean copyFile(File soureFile, File destFile) {
boolean copySuccess = false;
if (soureFile != null && destFile != null && soureFile.exists()) {
try {
new File(destFile.getParent()).mkdirs();
BufferedOutputStream out = new BufferedOutputStre... | public void transport(File file) throws TransportException {
if (file.exists()) {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
transport(file);
}
} else if (file... | true |
3,070 | 18,822,890 | 11,879,780 | public void actualizar() throws SQLException, ClassNotFoundException, Exception {
Connection conn = null;
PreparedStatement ms = null;
if (!validado) {
validado = validar();
}
if (!validado) {
throw new Exception("No s'ha realitzat la validació de les ... | @Override
public MD2Model loadModel(URL url, String skin) throws IOException, IncorrectFormatException, ParsingErrorException {
boolean baseURLWasNull = setBaseURLFromModelURL(url);
MD2Model model = loadModel(url.openStream(), skin);
if (baseURLWasNull) {
popBaseURL();
... | false |
3,071 | 21,540,494 | 4,491,298 | public int fileUpload(File pFile, String uploadName, Hashtable pValue) throws Exception {
int res = 0;
MultipartEntity reqEntity = new MultipartEntity();
if (uploadName != null) {
FileBody bin = new FileBody(pFile);
reqEntity.addPart(uploadName, bin);
}
... | @Transient
public byte[] getData() {
InputStream is = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
is = urlInstance.openStream();
byte[] bytes = new byte[1024 * 20];
while (is.available() > 0) {
int bytesRead = i... | false |
3,072 | 1,293,658 | 3,657,883 | public int addCollectionInstruction() throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
String sql = "insert into Instructions (Type, Operator) " + "values (1, 0)";
conn = fido.util.FidoDataSource.get... | @Override
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException {
String context = request.getContextPath();
String resource = request.getRequestURI().replace(context, "");
resource = resource.replaceAll("^/\\w*/", "");
... | false |
3,073 | 5,337,582 | 7,532,475 | public List execute(ComClient comClient) throws Exception {
ArrayList outStrings = new ArrayList();
SearchResult sr = Util.getSearchResultByIDAndNum(SearchManager.getInstance(), qID, dwNum);
for (int i = 0; i < checkerUrls.length; i++) {
String parametrizedURL = checkerUrls[i];
... | private String getLatestVersion(URL url) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.connect();
BufferedReader br = new BufferedReader(new InputStreamReader(new BufferedInputStream(con.getInputStream())));
String lines = "";
Stri... | true |
3,074 | 20,644,476 | 2,687,958 | private static AtomContainer askForMovieSettings() throws IOException, QTException {
final InputStream inputStream = QuickTimeFormatGenerator.class.getResourceAsStream(REFERENCE_MOVIE_RESOURCE);
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream(1024 * 100);
IOUtils.copy(input... | @Override
public void run() {
try {
File dest = new File(location);
if ((dest.getParent() != null && !dest.getParentFile().isDirectory() && !dest.getParentFile().mkdirs())) {
throw new IOException("Impossible de créer un dossier (" + dest.getParent() + ").");
... | true |
3,075 | 17,402,775 | 2,285,646 | public String getResourceAsString(String name) throws IOException {
String content = null;
InputStream stream = aClass.getResourceAsStream(name);
if (stream != null) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
IOUtils.copyAndClose(stream, buffer);
... | 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 |
3,076 | 10,379,908 | 22,502,712 | public void setContentMD5() {
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
contentMD5 = null;
}
messagedigest.update(content.getBytes... | 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 |
3,077 | 10,294,554 | 21,750,583 | public static boolean downloadFile(String srcUri, String srcDest) {
try {
URL url = new URL(srcUri);
InputStream is = url.openStream();
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(srcDest));
byte[] buff = new byte[10000];
... | protected void doProxyInternally(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpRequestBase proxyReq = buildProxyRequest(req);
URI reqUri = proxyReq.getURI();
String cookieDomain = reqUri.getHost();
DefaultHttpClient httpClient = new Defau... | false |
3,078 | 22,243,603 | 23,400,221 | @Override
protected PermissionCollection getPermissions(CodeSource _codeSource) {
PermissionCollection perms = super.getPermissions(_codeSource);
URL url = _codeSource.getLocation();
Permission perm = null;
URLConnection urlConnection = null;
try {
urlConnecti... | public void delete(Channel channel) throws Exception {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
dbo = createDBOperation();
connection = dbo.getConnection();
... | false |
3,079 | 7,645,348 | 11,892,441 | @BeforeClass
public static void setUpOnce() throws OWLOntologyCreationException {
dbManager = (OWLDBOntologyManager) OWLDBManager.createOWLOntologyManager(OWLDataFactoryImpl.getInstance());
dbIRI = IRI.create(ontoUri);
System.out.println("copying ontology to work folder...");
try... | protected void handleUrl(URL url) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String s;
boolean moreResults = false;
while ((s = in.readLine()) != null) {
if (s.indexOf("<h1>Search Results</h1>") > -1) {
... | false |
3,080 | 23,206 | 16,925,759 | public static BufferedReader getUserInfoStream(String name) throws IOException {
BufferedReader in;
try {
URL url = new URL("http://www.spoj.pl/users/" + name.toLowerCase() + "/");
in = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (MalformedURL... | public void run() {
try {
URL url = new URL("http://mydiversite.appspot.com/version.html");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
System.ou... | true |
3,081 | 6,847,452 | 5,422,086 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String act = request.getParameter("act");
if (null == act) {
} else if ("down".equalsIgnoreCase(act)) {
String vest = request.getParam... | public void writeOutput(String directory) throws IOException {
File f = new File(directory);
int i = 0;
if (f.isDirectory()) {
for (AppInventorScreen screen : screens.values()) {
File screenFile = new File(getScreenFilePath(f.getAbsolutePath(), screen));
... | true |
3,082 | 1,158,841 | 15,301,114 | public static int gzipFile(File file_input, String file_output) {
File gzip_output = new File(file_output);
GZIPOutputStream gzip_out_stream;
try {
FileOutputStream out = new FileOutputStream(gzip_output);
gzip_out_stream = new GZIPOutputStream(new BufferedOutputStrea... | public void updateFailedStatus(THLEventStatus failedEvent, ArrayList<THLEventStatus> events) throws THLException {
Timestamp now = new Timestamp(System.currentTimeMillis());
Statement stmt = null;
PreparedStatement pstmt = null;
try {
conn.setAutoCommit(false);
... | false |
3,083 | 1,629,748 | 10,658,266 | public static void main(String[] args) throws Exception {
DES des = new DES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\test1.txt"));
SingleKey key = new SingleKey... | public static void copy(File srcFile, File destFile) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile);
final byte[] buf = new byte[4096];
... | true |
3,084 | 12,626,919 | 347,631 | public void xtestFile1() throws Exception {
InputStream inputStream = new FileInputStream(IOTest.FILE);
OutputStream outputStream = new FileOutputStream("C:/Temp/testFile1.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.close();
}
| private static String getDocumentAt(String urlString) {
StringBuffer html_text = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream... | false |
3,085 | 3,636,960 | 8,122,281 | 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) {
... | public String get(String s, String encoding) throws Exception {
if (!s.startsWith("http")) return "";
StringBuilder sb = new StringBuilder();
try {
String result = null;
URL url = new URL(s);
URLConnection connection = url.openConnection();
con... | false |
3,086 | 4,130,551 | 14,293,059 | private byte[] streamToBytes(InputStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
IOUtils.copy(in, out);
} finally {
IOUtils.closeQuietly(in);
}
return out.toByteArray();
}
| public static final String crypt(final String password, String salt, final String magic) {
if (password == null) throw new IllegalArgumentException("Null password!");
if (salt == null) throw new IllegalArgumentException("Null salt!");
if (magic == null) throw new IllegalArgumentException("Nu... | false |
3,087 | 9,665,900 | 7,162,385 | @SuppressWarnings("static-access")
public FastCollection<String> load(Link link) {
URL url = null;
FastCollection<String> links = new FastList<String>();
FTPClient ftp = null;
try {
String address = link.getURI();
address = JGetFileUtils.removeTrailingStri... | @Override
public boolean postPage() {
MySpaceBlogExporterGuiApp.getApplication().getWizContainer().showStatus(myResourceMap.getString("CheckingBlogUrl.text"));
URL url;
try {
url = new URL(txtBlogUrl.getText());
URLConnection con = url.openConnection();
... | false |
3,088 | 16,540,473 | 1,261,429 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | private static String downloadMedia(String mediadir, URL remoteFile) throws Exception, InterruptedException {
File tmpDir = new File(System.getProperty("java.io.tmpdir") + "org.ogre4j.examples/" + mediadir);
if (!tmpDir.exists()) {
tmpDir.mkdirs();
}
URLConnection urlConn... | false |
3,089 | 7,126,817 | 23,354,285 | private static String getRegistrationClasses() {
CentralRegistrationClass c = new CentralRegistrationClass();
String name = c.getClass().getCanonicalName().replace('.', '/').concat(".class");
try {
Enumeration<URL> urlEnum = c.getClass().getClassLoader().getResources("META-INF/MA... | public void updateResult(Result result) throws UnsupportedEncodingException {
HttpPost updateRequest = populateUpdateRequest(result);
HttpClient client = clientProvider.getHttpClient();
try {
HttpResponse response = client.execute(updateRequest);
HttpEntity entity = r... | false |
3,090 | 20,662,462 | 16,951,199 | @Override
public DownloadingItem download(Playlist playlist, String title, File folder, StopDownloadCondition condition, String uuid) throws IOException, StoreStateException {
boolean firstIteration = true;
Iterator<PlaylistEntry> entries = playlist.getEntries().iterator();
DownloadingIt... | public void testReleaseOnIOException() throws Exception {
localServer.register("/dropdead", new HttpRequestHandler() {
public void handle(final HttpRequest request, final HttpResponse response, final HttpContext context) throws HttpException, IOException {
BasicHttpEntity entity... | false |
3,091 | 4,159,104 | 15,453,012 | public String GetUserPage(String User, int pagetocrawl) {
int page = pagetocrawl;
URL url;
String line, finalstring;
StringBuffer buffer = new StringBuffer();
setStatus("Start moling....");
startTimer();
try {
url = new URL(HTMLuserpage + User + "?... | public ArrayList parseFile(File newfile) throws IOException {
String s;
String firstName;
String header;
String name = null;
Integer PVLoggerID = new Integer(0);
String[] tokens;
int nvalues = 0;
double num1, num2, num3;
double xoffset = 1.0;
... | false |
3,092 | 6,453,377 | 11,039,844 | @Override
public TDSModel loadModel(URL url, String skin) throws IOException, IncorrectFormatException, ParsingErrorException {
boolean baseURLWasNull = setBaseURLFromModelURL(url);
TDSModel model = loadModel(url.openStream(), skin);
if (baseURLWasNull) {
popBaseURL();
... | public static int load(Context context, URL url) throws Exception {
int texture[] = new int[1];
GLES20.glGenTextures(1, texture, 0);
int textureId = texture[0];
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
InputStream is = url.openStream();
Bitmap tmpBmp;
... | false |
3,093 | 13,826,024 | 19,569,154 | public static void copyFile(String source, String destination, boolean overwrite) {
File sourceFile = new File(source);
try {
File destinationFile = new File(destination);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(sourceFile));
Buffered... | @Override
public void incluir(Casa_festas casa_festas) throws Exception {
Connection connection = criaConexao(false);
String sql = "insert into casa_festas ? as idlocal, ? as area, ? as realiza_cerimonia, ? as tipo_principal, ? as idgrupo;";
String sql2 = "SELECT MAX(idlocal) FROM Local"... | false |
3,094 | 18,741,084 | 19,993,993 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | true |
3,095 | 9,195,362 | 23,512,890 | public static long copy(File src, File dest) throws UtilException {
FileChannel srcFc = null;
FileChannel destFc = null;
try {
srcFc = new FileInputStream(src).getChannel();
destFc = new FileOutputStream(dest).getChannel();
long srcLength = srcFc.size();
... | private boolean write(File file) {
String filename = file.getPath();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream out = new PrintStream(byteArrayOutputStream);
try {
StringBuffer xml = null;
if (MainFrame.getInstance()... | true |
3,096 | 1,953,115 | 14,624,031 | protected int doWork() {
SAMFileReader reader = new SAMFileReader(IoUtil.openFileForReading(INPUT));
reader.getFileHeader().setSortOrder(SORT_ORDER);
SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), false, OUTPUT);
Iterator<SAMRecord> itera... | public static void copyFile(File in, File out) throws ObclipseException {
try {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getC... | true |
3,097 | 2,191,115 | 1,787,391 | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
List<Datastream> tDatastreams = super.getDatastreams(pDeposit);
FileInputStream tInput = null;
String tFileName = ((LocalDatastream) tDatastreams.get(0)).getPath();
String... | private static void writeOneAttachment(Context context, Writer writer, OutputStream out, Attachment attachment) throws IOException, MessagingException {
writeHeader(writer, "Content-Type", attachment.mMimeType + ";\n name=\"" + attachment.mFileName + "\"");
writeHeader(writer, "Content-Transfer-Enco... | true |
3,098 | 16,981,230 | 14,024,978 | public static String encrypt(final String password, final String algorithm, final byte[] salt) {
final StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented"... | public static final String generate(String value) {
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(value.getBytes());
byte[] hash = md.digest();
StringBuffer hexString = new StringBuffer();
for (int... | true |
3,099 | 617,563 | 22,122,895 | public static void main(String[] args) {
String str = "vbnjm7pexhlmof3kapi_key76bbc056cf516a844af25a763b2b8426auth_tokenff8080812374bd3f0123b60363a5230acomment_text你frob118edb4cb78b439207c2329b76395f9fmethodyupoo.photos.comments.addphoto_idff80808123922c950123b6066c946a3f";
MessageDigest md = null;
... | protected String getHashCode(String value) {
if (log.isDebugEnabled()) log.debug("getHashCode(...) -> begin");
String retVal = null;
try {
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(value.getBytes());
byte[] digest = m... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.