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 |
|---|---|---|---|---|---|
5,300 | 16,755,605 | 12,614,305 | 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... | 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 |
5,301 | 2,059,352 | 20,071,852 | public static void main(String[] args) {
String inFile = "test_data/blobs.png";
String outFile = "ReadWriteTest.png";
itkImageFileReaderUC2_Pointer reader = itkImageFileReaderUC2.itkImageFileReaderUC2_New();
itkImageFileWriterUC2_Pointer writer = itkImageFileWriterUC2.itkImageFileWri... | void write() throws IOException {
if (!allowUnlimitedArgs && args != null && args.length > 1) throw new IllegalArgumentException("Only one argument allowed unless allowUnlimitedArgs is enabled");
String shebang = "#!" + interpretter;
for (int i = 0; i < args.length; i++) {
sheban... | true |
5,302 | 4,147,982 | 5,036,265 | public static void fixEol(File fin) throws IOException {
File fout = File.createTempFile(fin.getName(), ".fixEol", fin.getParentFile());
FileChannel in = new FileInputStream(fin).getChannel();
if (0 != in.size()) {
FileChannel out = new FileOutputStream(fout).getChannel();
... | public void save() throws IOException {
CodeTimer saveTimer;
if (!dirty) {
return;
}
saveTimer = new CodeTimer("PackedFile.save");
saveTimer.setEnabled(log.isDebugEnabled());
File newFile = new File(tmpDir.getAbsolutePath() + "/" + new GUID() + ".pak");
... | true |
5,303 | 1,953,115 | 17,805,384 | 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 final String getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
;
try {
localHost = Ine... | false |
5,304 | 6,416,201 | 20,103,762 | @Override
public void copyTo(ManagedFile other) throws ManagedIOException {
try {
if (other.getType() == ManagedFileType.FILE) {
IOUtils.copy(this.getContent().getInputStream(), other.getContent().getOutputStream());
} else {
ManagedFile newFile = ... | public boolean backupLastAuditSchema(File lastAuditSchema) {
boolean isBkupFileOK = false;
String writeTimestamp = DateFormatUtils.format(new java.util.Date(), configFile.getTimestampPattern());
File target = new File(configFile.getAuditSchemaFileDir() + File.separator + configFile.getAuditS... | true |
5,305 | 8,597,004 | 23,337,132 | public String getHtmlSource(String url) {
StringBuffer codeBuffer = null;
BufferedReader in = null;
URLConnection uc = null;
try {
uc = new URL(url).openConnection();
uc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows XP; DigExt)")... | @SuppressWarnings("rawtypes")
public static String[] loadAllPropertiesFromClassLoader(Properties properties, String... resourceNames) throws IOException {
List successLoadProperties = new ArrayList();
for (String resourceName : resourceNames) {
URL url = GeneratorProperties.class.get... | false |
5,306 | 19,728,871 | 5,597,187 | public static String getEncodedPassword(String buff) {
if (buff == null) return null;
String t = new String();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(buff.getBytes());
byte[] r = md.digest();
for (int i = 0; i < r.... | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
ImagesService imgService = ImagesServiceFacto... | false |
5,307 | 23,241,520 | 13,335,071 | private FeedIF retrieveFeed(String uri) throws FeedManagerException {
try {
URL urlToRetrieve = new URL(uri);
URLConnection conn = null;
try {
conn = urlToRetrieve.openConnection();
if (conn instanceof HttpURLConnection) {
... | 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... | false |
5,308 | 7,386,971 | 13,946,708 | 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... | @Override
public String encryptPassword(String password) throws JetspeedSecurityException {
if (securePasswords == false) {
return password;
}
if (password == null) {
return null;
}
try {
if ("SHA-512".equals(passwordsAlgorithm)) {
... | true |
5,309 | 4,385,640 | 19,731,419 | 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 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 |
5,310 | 3,298,293 | 6,680,022 | public static InputStream download_file(String sessionid, String key) {
String urlString = "https://s2.cloud.cm/rpc/raw?c=Storage&m=download_file&key=" + key;
try {
URL url = new URL(urlString);
Log.d("current running function name:", "download_file");
HttpURLConn... | public ResourceMigratorBuilder createResourceMigratorBuilder(NotificationReporter reporter) {
return new ResourceMigratorBuilder() {
public ResourceMigrator getCompletedResourceMigrator() {
return new ResourceMigrator() {
public void migr... | false |
5,311 | 17,116,110 | 6,222,230 | public void deleteProposal(String id) throws Exception {
String tmp = "";
PreparedStatement prepStmt = null;
try {
if (id == null || id.length() == 0) throw new Exception("Invalid parameter");
con = database.getConnection();
String delProposal = "delete fr... | public static String loadWebsiteHtmlCode(String url, String useragent) {
HttpClient httpClient = new DefaultHttpClient();
HttpGet getMethod = new HttpGet(url);
String htmlCode = "";
if (useragent != null) {
getMethod.setHeader("user-agent", useragent);
}
t... | false |
5,312 | 6,198,171 | 12,649,112 | public static JSONObject doJSONQuery(String urlstr) throws IOException, MalformedURLException, JSONException, SolrException {
URL url = new URL(urlstr);
HttpURLConnection con = null;
try {
con = (HttpURLConnection) url.openConnection();
BufferedReader in = new Buffere... | 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... | true |
5,313 | 13,254,235 | 12,499,532 | public static void copy(File file, File dir, boolean overwrite) throws IOException {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
File out = new File(dir, file.getName());
if (out.exists() && !overwrite) {
throw new IOException("File: " + out + " ... | public File copyLocalFileAsTempFileInExternallyAccessableDir(String localFileRef) throws IOException {
log.debug("copyLocalFileAsTempFileInExternallyAccessableDir");
File f = this.createTempFileInExternallyAccessableDir();
FileChannel srcChannel = new FileInputStream(localFileRef).getChannel... | true |
5,314 | 5,610,546 | 8,080,019 | public static String md5(String text) {
String hashed = "";
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(text.getBytes(), 0, text.length());
hashed = new BigInteger(1, digest.digest()).toString(16);
} catch (Exception e) {
... | public static String getInstanceUserdata() throws IOException {
int retries = 0;
while (true) {
try {
URL url = new URL("http://169.254.169.254/latest/user-data/");
InputStreamReader rdr = new InputStreamReader(url.openStream());
StringWrit... | false |
5,315 | 22,900,234 | 12,296,632 | public static String digestString(String data, String algorithm) {
String result = null;
if (data != null) {
try {
MessageDigest _md = MessageDigest.getInstance(algorithm);
_md.update(data.getBytes());
byte[] _digest = _md.digest();
... | public boolean check(Object credentials) {
try {
byte[] digest = null;
if (credentials instanceof Password || credentials instanceof String) {
synchronized (__md5Lock) {
if (__md == null) __md = MessageDigest.getInstance("MD... | true |
5,316 | 6,992,704 | 3,905,626 | public static void main(String[] args) {
File file = null;
try {
file = File.createTempFile("TestFileChannel", ".dat");
final ByteBuffer buffer = ByteBuffer.allocateDirect(4);
final ByteChannel output = new FileOutputStream(file).getChannel();
buffer.p... | public String getScript(String script, String params) {
params = params.replaceFirst("&", "?");
StringBuffer document = new StringBuffer();
try {
URL url = new URL(script + params);
URLConnection conn = url.openConnection();
BufferedReader reader = new Buf... | false |
5,317 | 21,456,138 | 17,472,701 | @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "getServerCertificates", args = { })
public final void test_getServerCertificates() throws Exception {
try {
URL url = new URL("https://localhost:55555");
HttpsURLConnection connection = (HttpsURLConnection) url.ope... | protected static void clearTables() throws SQLException {
Connection conn = null;
Statement stmt = null;
try {
conn = FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
ClearData.clearTables(stmt);
... | false |
5,318 | 17,999,563 | 16,224,018 | public static void compressFile(File f) throws IOException {
File target = new File(f.toString() + ".gz");
System.out.print("Compressing: " + f.getName() + ".. ");
long initialSize = f.length();
FileInputStream fis = new FileInputStream(f);
GZIPOutputStream out = new GZIPOutp... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
5,319 | 10,332,410 | 8,093,202 | protected EntailmentType invokeHttp(String stuff) {
String data = encode("theory") + "=" + encode(stuff);
URL url;
EntailmentType result = EntailmentType.unkown;
try {
url = new URL(httpAddress);
} catch (MalformedURLException e) {
throw new RuntimeExc... | private Properties loadDefaultProperties() throws IOException {
Properties merged = new Properties();
try {
merged.setProperty("user", System.getProperty("user.name"));
} catch (java.lang.SecurityException se) {
}
ClassLoader cl = getClass().getClassLoader();
... | false |
5,320 | 16,553,581 | 13,431,536 | public Item findById(String itemId) throws UnsupportedEncodingException, IOException {
String sessionId = (String) RuntimeAccess.getInstance().getSession().getAttribute("SESSION_ID");
DefaultHttpClient httpclient = new DefaultHttpClient();
FindItemByIdRequest request = new FindItemByIdReques... | @Override
public int updateStatus(UserInfo userInfo, String status) throws Exception {
OAuthConsumer consumer = SnsConstant.getOAuthConsumer(SnsConstant.SOHU);
consumer.setTokenWithSecret(userInfo.getAccessToken(), userInfo.getAccessSecret());
try {
URL url = new URL(SnsConst... | false |
5,321 | 17,468,430 | 8,143,340 | private String mkSid() {
String temp = toString();
MessageDigest messagedigest = null;
try {
messagedigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
messagedigest.... | private static String digest(String buffer) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(buffer.getBytes());
return new String(encodeHex(md5.digest(key)));
} catch (NoSuchAlgorithmException e) {
}
return null;
}
| true |
5,322 | 23,677,131 | 11,843,018 | public FTPClient sample1(String server, int port, String username, String password) throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException {
FTPClient ftpClient = new FTPClient();
ftpClient.connect(server, port);
ftpClient.login(username, password);
return ftpClient;
}
| public RespID(PublicKey key) throws OCSPException {
try {
MessageDigest digest = MessageDigest.getInstance("SHA1");
ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());
dig... | false |
5,323 | 6,189,963 | 20,849,254 | public String jsFunction_send(String postData) {
URL url = null;
try {
if (_uri.startsWith("http")) {
url = new URL(_uri);
} else {
url = new URL("file://./" + _uri);
}
} catch (MalformedURLException e) {
IdeLog.... | public static AudioInputStream getWavFromURL(String urlstr) {
URL url;
AudioInputStream ais = null;
try {
url = new URL(urlstr);
URLConnection c = url.openConnection();
c.connect();
InputStream stream = c.getInputStream();
ais = new... | false |
5,324 | 15,634,388 | 12,065,181 | @Test
public void usingStream() throws IOException, NameNotFoundException {
URL url = new URL("ftp://ftp.ebi.ac.uk/pub/databases/interpro/entry.list");
InterproNameHandler handler = new InterproNameHandler(url.openStream());
String interproName = handler.getNameById("IPR008255");
... | private void sortMasters() {
masterCounter = 0;
for (int i = 0; i < maxID; i++) {
if (users[i].getMasterPoints() > 0) {
masterHandleList[masterCounter] = users[i].getHandle();
masterPointsList[masterCounter] = users[i].getMasterPoints();
ma... | false |
5,325 | 13,131,643 | 18,070,587 | public void init(File file) {
InputStream is = null;
ByteArrayOutputStream os = null;
try {
is = new FileInputStream(file);
os = new ByteArrayOutputStream();
IOUtils.copy(is, os);
} catch (Throwable e) {
throw new VisualizerEngineExcept... | @Test
public void testWriteAndReadFirstLevel() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start();
... | true |
5,326 | 20,641,594 | 16,553,581 | public static InputStream getInputStreamFromUrl(String url) {
InputStream content = null;
try {
HttpGet httpGet = new HttpGet(url);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpGet);
content = response... | public Item findById(String itemId) throws UnsupportedEncodingException, IOException {
String sessionId = (String) RuntimeAccess.getInstance().getSession().getAttribute("SESSION_ID");
DefaultHttpClient httpclient = new DefaultHttpClient();
FindItemByIdRequest request = new FindItemByIdReques... | false |
5,327 | 12,716,055 | 9,632,240 | public void copyFile(File a_fileSrc, File a_fileDest, boolean a_append) throws IOException {
a_fileDest.getParentFile().mkdirs();
FileInputStream in = null;
FileOutputStream out = null;
FileChannel fcin = null;
FileChannel fcout = null;
try {
in = new File... | private final boolean copy_to_file_nio(File src, File dst) throws IOException {
FileChannel srcChannel = null, dstChannel = null;
try {
srcChannel = new FileInputStream(src).getChannel();
dstChannel = new FileOutputStream(dst).getChannel();
{
int s... | true |
5,328 | 21,979,716 | 4,640,851 | @ActionMethod
public void download() throws IOException {
final JPanel message = new JPanel(new GridBagLayout());
final GridBagConstraints gbcLabel = new GridBagConstraints();
final GridBagConstraints gbcField = new GridBagConstraints();
gbcLabel.weightx = 0.0;
gbcField.w... | private void menuOpenURL() {
animate = false;
resetScaleCombos();
InputDialog dialog = new InputDialog(shell, "Open URL Dialog", "Enter URL of the image", "http://", new IInputValidator() {
@Override
public String isValid(String newText) {
if (newText... | false |
5,329 | 17,076,120 | 13,862,028 | public String getTextData() {
if (tempFileWriter != null) {
try {
tempFileWriter.flush();
tempFileWriter.close();
FileReader in = new FileReader(tempFile);
StringWriter out = new StringWriter();
int len;
... | public static void main(String[] args) {
try {
String completePath = null;
String predictionFileName = null;
if (args.length == 2) {
completePath = args[0];
predictionFileName = args[1];
} else {
System.out.print... | true |
5,330 | 7,636,710 | 16,991,395 | public String getNextSequence(Integer id) throws ApplicationException {
java.sql.PreparedStatement preStat = null;
java.sql.ResultSet rs = null;
boolean noRecordMatch = false;
String prefix = "";
String suffix = "";
Long startID = null;
Integer length = null;
... | protected static void clearTables() throws SQLException {
Connection conn = null;
Statement stmt = null;
try {
conn = FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
ClearData.clearTables(stmt);
... | true |
5,331 | 13,122,193 | 17,076,233 | public static void createModelZip(String filename, String tempdir) throws EDITSException {
try {
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(filename);
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest));
... | private void unzipResource(final String resourceName, final File targetDirectory) throws IOException {
final URL resource = this.getClass().getResource(resourceName);
assertNotNull("Expected '" + resourceName + "' not found.", resource);
assertTrue(targetDirectory.isAbsolute());
File... | true |
5,332 | 19,886,621 | 11,562,158 | private void doPOST(HttpURLConnection connection, InputStream inputXML) throws MessageServiceException {
try {
OutputStream requestStream = new BufferedOutputStream(connection.getOutputStream());
IOUtils.copyAndClose(inputXML, requestStream);
connection.connect();
... | private File writeResourceToFile(String resource) throws IOException {
File tmp = File.createTempFile("zfppt" + resource, null);
InputStream res = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
OutputStream out = new FileOutputStream(tmp);
IOUtils.copy(... | true |
5,333 | 4,068,544 | 3,058,818 | public static void saveDigraph(mainFrame parentFrame, DigraphView digraphView, File tobeSaved) {
DigraphFile digraphFile = new DigraphFile();
DigraphTextFile digraphTextFile = new DigraphTextFile();
try {
if (!DigraphFile.DIGRAPH_FILE_EXTENSION.equals(getExtension(tobeSaved))) {
... | public static void encryptFile(String input, String output, String pwd) throws Exception {
CipherOutputStream out;
InputStream in;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(pwd.getBytes(), "DES... | true |
5,334 | 9,913,187 | 6,182,434 | protected static String encodePassword(String raw_password) throws DatabaseException {
String clean_password = validatePassword(raw_password);
try {
MessageDigest md = MessageDigest.getInstance(DEFAULT_PASSWORD_DIGEST);
md.update(clean_password.getBytes(DEFAULT_PASSWORD_ENCOD... | private static String calculateScenarioMD5(Scenario scenario) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
Vector<JTest> allTests = scenario.getTests();
for (JTest t : allTests) {
String name = t.getTestName() + t.getTestId();
String paramet... | true |
5,335 | 22,306,604 | 421,187 | public static void upLoadFile(File sourceFile, File targetFile) throws IOException {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(sourceFile).getChannel();
outChannel = new FileOutputStream(targetFile).getChannel()... | 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 |
5,336 | 17,150,641 | 18,563,163 | public static void main(String[] args) throws Exception {
for (int n = 0; n < 8; n++) {
new Thread() {
public void run() {
try {
URL url = new URL("http://localhost:8080/WebGISTileServer/index.jsp?token_timeout=true");
... | private void dumpFile(File repository, File copy) {
try {
if (copy.exists() && !copy.delete()) {
throw new RuntimeException("can't delete copy: " + copy);
}
printFile("Real Archive File", repository);
new ZipArchive(repository.getPath());
... | false |
5,337 | 16,454,974 | 3,024,983 | @Override
public int write(FileStatus.FileTrackingStatus fileStatus, InputStream input, PostWriteAction postWriteAction) throws WriterException, InterruptedException {
String key = logFileNameExtractor.getFileName(fileStatus);
int wasWritten = 0;
FileOutputStreamPool fileOutputStreamPool... | @Test
public void testCopy_inputStreamToWriter_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out... | true |
5,338 | 756,962 | 8,093,202 | 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 Properties loadDefaultProperties() throws IOException {
Properties merged = new Properties();
try {
merged.setProperty("user", System.getProperty("user.name"));
} catch (java.lang.SecurityException se) {
}
ClassLoader cl = getClass().getClassLoader();
... | false |
5,339 | 16,445,079 | 17,750,515 | private static JvUndoableTableModel CSVReader(String filepath) throws IOException {
try {
URI url = new URI(filepath);
return CSVReader(url.toURL().openStream());
} catch (URISyntaxException ex) {
File file = new File(filepath);
return CSVReader(file);... | public SukuData updatePerson(String usertext, SukuData req) {
String insPers;
String userid = Utils.toUsAscii(usertext);
if (userid != null && userid.length() > 16) {
userid = userid.substring(0, 16);
}
StringBuilder sb = new StringBuilder();
sb.append("in... | false |
5,340 | 22,368,135 | 8,156,588 | private static void testIfModified() throws IOException {
HttpURLConnection c2 = (HttpURLConnection) url.openConnection();
c2.setIfModifiedSince(System.currentTimeMillis() + 1000);
c2.connect();
int code = c2.getResponseCode();
System.out.print("If-Modified-Since : ");
... | private static final BufferedInputStream createInputStreamFromRemoteUrl(String uri, ClientConnectionManager connectionManager) {
InputStream contentInput = null;
if (connectionManager == null) {
try {
URL url = new URI(uri).toURL();
URLConnection conn = ur... | false |
5,341 | 5,753,321 | 6,992,204 | public String selectFROM() throws Exception {
BufferedReader in = null;
String data = null;
try {
HttpClient httpclient = new DefaultHttpClient();
URI uri = new URI("http://**.**.**.**/OctopusManager/index2.php");
HttpGet request = new HttpGet();
... | public static void executePost(String targetURL, File file, int msec) {
URL url;
HttpURLConnection connection = null;
try {
long wrCount = 0;
long fileLen = file.length();
log("File length is " + fileLen);
log("Sleep " + msec + " between each s... | true |
5,342 | 13,555,352 | 14,900,316 | @Test
public void test00_reinitData() throws Exception {
Logs.logMethodName();
init();
Db db = DbConnection.defaultCieDbRW();
try {
db.begin();
PreparedStatement pst = db.prepareStatement("TRUNCATE e_module;");
pst.executeUpdate();
... | @Override
public User createUser(User bean) throws SitoolsException {
checkUser();
if (!User.isValid(bean)) {
throw new SitoolsException("CREATE_USER_MALFORMED");
}
Connection cx = null;
try {
cx = ds.getConnection();
cx.setAutoCommit(f... | true |
5,343 | 22,033,685 | 12,528,437 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
session.setMaxInactiveInterval(300);
String member_type;
String save_type;
String action;
String ... | public static void main(String[] args) throws Exception {
SocketConnector socketConnector = new SocketConnector();
socketConnector.setPort(6080);
SslSocketConnector sslSocketConnector = new SslSocketConnector();
sslSocketConnector.setPort(6443);
String serverKeystore = MockHt... | false |
5,344 | 9,240,872 | 21,679,395 | public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
lon... | public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("DOWNLOAD - Send content: " + realFile.getAbsolutePath());
LOGGER.debug("Output stream: " + out.toString());
if (ServerConfiguration.isDynamicSEL()) {
... | true |
5,345 | 16,379,577 | 21,100,655 | public InputStream sendGetMessage(Properties args) throws IOException {
String argString = "";
if (args != null) {
argString = "?" + toEncodedString(args);
}
URL url = new URL(servlet.toExternalForm() + argString);
URLConnection con = url.openConnection();
... | public static void init(Locale language) throws IOException {
URL url = ClassLoader.getSystemResource("locales/" + language.getISO3Language() + ".properties");
if (url == null) {
throw new IOException("Could not load resource locales/" + language.getISO3Language() + ".properties");
... | false |
5,346 | 21,234,510 | 228,925 | public static void zip(String destination, String folder) {
File fdir = new File(folder);
File[] files = fdir.listFiles();
PrintWriter stdout = new PrintWriter(System.out, true);
int read = 0;
FileInputStream in;
byte[] data = new byte[1024];
try {
... | 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 |
5,347 | 982,157 | 20,100,822 | private InputStream getDomainMap() {
String domainMap = Configuration.getString(MAPPING_KEY);
InputStream is = new StringBufferInputStream(domainMap);
if ("".equals(domainMap)) {
try {
URL url = getClass().getResource(XML_FILE_NAME).toURI().toURL();
... | public static byte[] readUrl(URL url) {
BufferedInputStream in = null;
try {
class Part {
byte[] partData;
int len;
}
in = new BufferedInputStream(url.openStream());
LinkedList<Part> parts = new LinkedList<Part>();
... | false |
5,348 | 4,076,620 | 8,581,437 | public boolean downloadFile(String sourceFilename, String targetFilename) throws RQLException {
checkFtpClient();
InputStream in = null;
try {
in = ftpClient.retrieveFileStream(sourceFilename);
if (in == null) {
return false;
}
... | protected String doIt() throws java.lang.Exception {
StringBuffer sql = null;
int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID;
String[] strFields = new String[] { "Value", "Name", "Description", "DocumentNote", "Help", "UPC", "SKU", "Classification", "ProductTy... | false |
5,349 | 4,247,524 | 316,912 | public static String backupFile(File source) {
File backup = new File(source.getParent() + "/~" + source.getName());
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(source)));
BufferedWriter writer = new BufferedWriter(new OutputStre... | void copyFile(String src, String dest) throws IOException {
int amount;
byte[] buffer = new byte[4096];
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
while ((amount = in.read(buffer)) != -1) out.write(buffer, 0, amount);
... | true |
5,350 | 3,616,724 | 23,531,657 | public void onUploadClicked(Event event) {
Media[] medias = null;
try {
medias = Fileupload.get("Select one or more files to upload to " + "the current directory.", "Upload Files", 5);
} catch (Exception e) {
log.error("An exception occurred when displaying the file "... | public void imagesParserAssesmentItem(int file, int currentquestion, Resource resTemp) {
NodeList nl = null;
Node n = null;
NamedNodeMap nnp = null;
Node nsrc = null;
URL url = null;
String sFilename = "";
String sNewPath = "";
int index;
Strin... | true |
5,351 | 10,363,910 | 19,875,963 | private String getPayLoadWithCookie(String url) {
StringBuffer sb = new StringBuffer();
if (this.cookie != null) {
try {
Log.debug("Requesting url ==> " + url);
URLConnection con = new URL(url).openConnection();
con.setDoOutput(true);
... | @Override
public void remove(int disciplinaId) {
try {
this.criaConexao(false);
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PostgresqlDisciplinaDAO.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
j... | false |
5,352 | 12,942,575 | 11,650,951 | private int saveToTempTable(ArrayList cons, String tempTableName, boolean truncateFirst) throws SQLException {
if (truncateFirst) {
this.executeUpdate("TRUNCATE TABLE " + tempTableName);
Categories.dataDb().debug("TABLE " + tempTableName + " TRUNCATED.");
}
PreparedSt... | private Properties loadProperties(final String propertiesName) throws IOException {
Properties bundle = null;
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
final URL url = loader.getResource(propertiesName);
if (url == null) {
throw new IOExce... | false |
5,353 | 20,651,942 | 3,000,477 | 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(""... | private static String hashWithDigest(String in, String digest) {
try {
MessageDigest Digester = MessageDigest.getInstance(digest);
Digester.update(in.getBytes("UTF-8"), 0, in.length());
byte[] sha1Hash = Digester.digest();
return toSimpleHexString(sha1Hash);
... | true |
5,354 | 2,245,320 | 6,747,095 | void writeToFile(String dir, InputStream input, String fileName) throws FileNotFoundException, IOException {
makeDirs(dir);
FileOutputStream fo = null;
try {
System.out.println(Thread.currentThread().getName() + " : " + "Writing file " + fileName + " to path " + dir);
... | public void notifyTerminated(Writer r) {
all_writers.remove(r);
if (all_writers.isEmpty()) {
all_terminated = true;
Iterator iterator = open_files.iterator();
while (iterator.hasNext()) {
FileWriter.FileChunk fc = (FileWriter.FileChunk) iterator.ne... | true |
5,355 | 22,948,959 | 7,757,210 | private static void copyFile(File sourceFile, File targetFile) throws FileSaveException {
try {
FileInputStream inputStream = new FileInputStream(sourceFile);
FileOutputStream outputStream = new FileOutputStream(targetFile);
FileChannel readableChannel = inputStream.getCh... | @RequestMapping("/download")
public void download(HttpServletRequest request, HttpServletResponse response) {
InputStream input = null;
ServletOutputStream output = null;
try {
String savePath = request.getSession().getServletContext().getRealPath("/upload");
Stri... | true |
5,356 | 15,211,815 | 878,123 | private static boolean hasPackageInfo(URL url) {
if (url == null) return false;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
if (line... | void sort(int a[]) throws Exception {
int j;
int limit = a.length;
int st = -1;
while (st < limit) {
boolean flipped = false;
st++;
limit--;
for (j = st; j < limit; j++) {
if (stopRequested) {
return;... | false |
5,357 | 13,883,878 | 11,130,567 | PathElement(String path) throws MaxError {
this.path = path;
if (path.startsWith("http:")) {
try {
url = new URL(path);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("HEAD... | public static boolean copyFile(File sourceFile, File destFile) throws IOException {
long flag = 0;
if (!destFile.exists()) destFile.createNewFile();
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChanne... | false |
5,358 | 16,378,626 | 9,563 | public static void copy(String pstrFileFrom, String pstrFileTo) {
try {
FileChannel srcChannel = new FileInputStream(pstrFileFrom).getChannel();
FileChannel dstChannel = new FileOutputStream(pstrFileTo).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size(... | 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 |
5,359 | 12,786,252 | 8,121,403 | private OSD downloadList() throws IOException, IllegalStateException, ParseException, URISyntaxException {
OSD osd = null;
HttpClient client = new DefaultHttpClient();
HttpGet getMethod = new HttpGet(new URI(listUri));
try {
HttpResponse response = client.execute(getMetho... | public static void copyAssetFile(Context ctx, String srcFileName, String targetFilePath) {
AssetManager assetManager = ctx.getAssets();
try {
InputStream is = assetManager.open(srcFileName);
File out = new File(targetFilePath);
if (!out.exists()) {
... | false |
5,360 | 3,463,984 | 6,430,125 | @Override
public InputStream getResourceStream(final String arg0) throws ResourceNotFoundException {
try {
final ServletContext context = CContext.getInstance().getContext();
final URL url = context.getResource(arg0);
return url.openStream();
... | protected Object openDialogBox(Control cellEditorWindow) {
FileDialog dialog = new FileDialog(parent.getShell(), SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.jpg;*.JPG;*.JPEG;*.gif;*.GIF;*.png;*.PNG", "*.jpg;*.JPG;*.JPEG", "*.gif;*.GIF", "*.png;*.PNG" });
dialog.setFilterNames(new... | false |
5,361 | 3,673,887 | 4,588,203 | public static final void copyFile(File source, File destination) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel targetChannel = new FileOutputStream(destination).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChan... | public String copyImages(Document doc, String sXML, String newPath, String tagName, String itemName) {
NodeList nl = null;
Node n = null;
NamedNodeMap nnp = null;
Node nsrc = null;
URL url = null;
String sFilename = "";
String sNewPath = "";
int index;... | true |
5,362 | 11,645,345 | 17,638,222 | private List<String> createProjectInfoFile() throws SocketException, IOException {
FTPClient client = new FTPClient();
Set<String> projects = new HashSet<String>();
client.connect("ftp.drupal.org");
System.out.println("Connected to ftp.drupal.org");
System.out.println(client.... | 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();
... | false |
5,363 | 17,050,025 | 12,524,256 | private static String retrieveVersion(InputStream is) throws RepositoryException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
IOUtils.copy(is, buffer);
} catch (IOException e) {
throw new RepositoryException(exceptionLocalizer.format("device-rep... | public void actionPerformed(ActionEvent e) {
final File inputFile = KeyboardHero.midiFile();
try {
if (inputFile == null) return;
final File dir = (new File(Util.DATA_FOLDER + MidiSong.MIDI_FILES_DIR));
if (dir.exist... | true |
5,364 | 1,637,147 | 18,293,811 | protected PredicateAnnotationRecord generatePredicateAnnotationRecord(PredicateAnnotationRecord par, String miDescriptor) {
String annotClass = par.annotation.getType().substring(1, par.annotation.getType().length() - 1).replace('/', '.');
String methodName = getMethodName(par);
String hashK... | private static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("�������� ���� �� ���������" + from_file);
if (!from_file.isFile()) abort("���������� ����������� ���... | true |
5,365 | 693,631 | 19,919,874 | public static void adminUpdate(int i_id, double cost, String image, String thumbnail) {
Connection con = null;
try {
tmpAdmin++;
String name = "$tmp_admin" + tmpAdmin;
con = getConnection();
PreparedStatement related1 = con.prepareStatement("CREATE TEM... | public Long createSite(Site site, List<String> hosts) {
if (log.isDebugEnabled()) {
log.debug("site: " + site);
if (site != null) {
log.debug(" language: " + site.getDefLanguage());
log.debug(" country: " + site.getDefCountry());
... | true |
5,366 | 16,069,454 | 778,641 | public int add(WebService ws) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
String sql = "insert into WebServices (MethodName, ServiceURI) " + "values ('" + ws.getMethodName() + "... | 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 |
5,367 | 2,033,320 | 16,008,963 | public static void gunzip(File gzippedFile, File destinationFile) throws IOException {
int buffer = 2048;
FileInputStream in = new FileInputStream(gzippedFile);
GZIPInputStream zipin = new GZIPInputStream(in);
byte[] data = new byte[buffer];
FileOutputStream out = new FileOut... | public static void unzip(final File file, final ZipFile zipFile, final File targetDirectory) throws PtException {
LOG.info("Unzipping zip file '" + file.getAbsolutePath() + "' to directory " + "'" + targetDirectory.getAbsolutePath() + "'.");
assert (file.exists() && file.isFile());
if (targe... | true |
5,368 | 10,398,987 | 4,636,728 | public void getDataFiles(String server, String username, String password, String folder, String destinationFolder) {
try {
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username, password);
System.out.println("Connected to " + server + ".");
... | private static Bitmap loadFromUrl(String url, String portId) {
Bitmap bitmap = null;
final HttpGet get = new HttpGet(url);
HttpEntity entity = null;
try {
final HttpResponse response = ServiceProxy.getInstance(portId).execute(get);
if (response.getStatusLine()... | false |
5,369 | 3,880,284 | 13,207,436 | public static StringBuffer readURLText(URL url, StringBuffer errorText) {
StringBuffer page = new StringBuffer("");
String thisLine;
try {
BufferedReader source = new BufferedReader(new InputStreamReader(url.openStream()));
while ((thisLine = source.readLine()) != nul... | public Object sendObjectRequestToSpecifiedServer(java.lang.String serverName, java.lang.String servletName, java.lang.Object request) {
Object reqxml = null;
org.jdom.Document retdoc = null;
String myurl = java.util.prefs.Preferences.systemRoot().get("serverurl", "");
String myport =... | false |
5,370 | 7,872,668 | 10,586,916 | private static boolean computeCustomerAverages(String completePath, String CustomerAveragesOutputFileName, String CustIndexFileName) {
try {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + CustIndexFileName);
FileChannel inC = new FileInputStream(inputFile).getC... | public static void CreateBackupOfDataFile(String _src, String _dest) {
try {
File src = new File(_src);
File dest = new File(_dest);
if (new File(_src).exists()) {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
... | true |
5,371 | 22,690,093 | 257,201 | 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... | 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 |
5,372 | 13,121,131 | 3,768,629 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
5,373 | 14,032,835 | 661,335 | private byte[] szyfrujKlucz(byte[] kluczSesyjny) {
byte[] zaszyfrowanyKlucz = null;
byte[] klucz = null;
try {
MessageDigest skrot = MessageDigest.getInstance("SHA-1");
skrot.update(haslo.getBytes());
byte[] skrotHasla = skrot.digest();
Object ... | public void update(String target, String cfgVersion) throws MalformedURLException, FileNotFoundException, IOException {
Debug.log("Config Updater", "Checking for newer configuration...");
URL url = new URL(target);
String[] urlSplit = target.split("/");
this.fileName = urlSplit[urlSp... | false |
5,374 | 970,144 | 12,816,795 | public Logging() throws Exception {
File home = new File(System.getProperty("user.home"), ".jorgan");
if (!home.exists()) {
home.mkdirs();
}
File logging = new File(home, "logging.properties");
if (!logging.exists()) {
InputStream input = getClass().ge... | public static FileChannel getFileChannel(Object o) throws IOException {
Class c = o.getClass();
try {
Method m = c.getMethod("getChannel", null);
return (FileChannel) m.invoke(o, null);
} catch (IllegalAccessException x) {
} catch (NoSuchMethodException x) {
... | true |
5,375 | 7,805,762 | 15,890,129 | public Object mapRow(ResultSet rs, int i) throws SQLException {
Blob blob = rs.getBlob(1);
if (rs.wasNull()) return null;
try {
InputStream inputStream = blob.getBinaryStream();
if (length > 0) IOUtils.copy(inputStream, outputStream, offset, length); else IOUtils.copy... | public File getAppHome() {
if (appHome == null) {
if (System.getProperty("app.home") != null) {
appHome = new File(System.getProperty("app.home"));
}
if (appHome == null) {
URL url = Main.class.getClassLoader().getResource("com/hs/mail/cont... | false |
5,376 | 10,540,679 | 17,682,090 | private static void downloadFile(String downloadFileName) throws Exception {
URL getFileUrl = new URL("http://www.tegsoft.com/Tobe/getFile" + "?tegsoftFileName=" + downloadFileName);
URLConnection getFileUrlConnection = getFileUrl.openConnection();
InputStream is = getFileUrlConnection.getIn... | public Reader transform(Reader reader, Map<String, Object> parameterMap) {
try {
File file = File.createTempFile("srx2", ".srx");
file.deleteOnExit();
Writer writer = getWriter(getFileOutputStream(file.getAbsolutePath()));
transform(reader, writer, parameterMa... | true |
5,377 | 7,464,994 | 1,111,832 | public void alterarQuestaoDiscursiva(QuestaoDiscursiva q) throws SQLException {
PreparedStatement stmt = null;
String sql = "UPDATE discursiva SET gabarito=? WHERE id_questao=?";
try {
stmt = conexao.prepareStatement(sql);
stmt.setString(1, q.getGabarito());
... | private void storeFieldMap(WorkingContent c, Connection conn) throws SQLException {
SQLDialect dialect = getDatabase().getSQLDialect();
if (TRANSACTIONS_ENABLED) {
conn.setAutoCommit(false);
}
try {
Object thisKey = c.getPrimaryKey();
deleteFieldCo... | true |
5,378 | 22,516,784 | 14,658,498 | public static void ftpUpload(FTPConfig config, String directory, File file, String remoteFileName) throws IOException {
FTPClient server = new FTPClient();
server.connect(config.host, config.port);
assertValidReplyCode(server.getReplyCode(), server);
server.login(config.userName, con... | private Properties loadPropertiesFromURL(String propertiesURL, Properties defaultProperties) {
Properties properties = new Properties(defaultProperties);
URL url;
try {
url = new URL(propertiesURL);
URLConnection urlConnection = url.openConnection();
prope... | false |
5,379 | 6,771,711 | 19,935,081 | @SuppressWarnings("deprecation")
public static final ReturnCode runCommand(IOBundle io, String[] args) {
if ((args.length < 3) || (args.length > 4)) return ReturnCode.makeReturnCode(ReturnCode.RET_INVALID_NUM_ARGS, "Invalid number of arguments: " + args.length);
if ((args.length == 3) && (!args[... | public Object mapRow(ResultSet rs, int i) throws SQLException {
try {
BLOB blob = (BLOB) rs.getBlob(1);
OutputStream outputStream = blob.setBinaryStream(0L);
IOUtils.copy(inputStream, outputStream);
outputStream.close();
... | true |
5,380 | 3,463,984 | 13,099,597 | @Override
public InputStream getResourceStream(final String arg0) throws ResourceNotFoundException {
try {
final ServletContext context = CContext.getInstance().getContext();
final URL url = context.getResource(arg0);
return url.openStream();
... | public void deleteGroup(String groupID) throws XregistryException {
try {
Connection connection = context.createConnection();
connection.setAutoCommit(false);
try {
PreparedStatement statement1 = connection.prepareStatement(DELETE_GROUP_SQL_MAIN);
... | false |
5,381 | 47,337 | 523,070 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public 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 |
5,382 | 11,159,237 | 3,462,669 | public static String hash(final String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash;
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
return Sha1.convertToHex(... | private void fileCopy(final File src, final File dest) throws IOException {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChan... | false |
5,383 | 19,276,021 | 11,467,950 | public DataSet newparse() throws SnifflibDatatypeException {
NumberFormat numformat = NumberFormat.getInstance();
if (this.headers.size() != this.types.size()) {
throw new SnifflibDatatypeException("Different number of headers (" + this.headers.size() + ") and types(" + this.types.size()... | public String getMediaURL(String strLink) {
try {
String res = de.nomule.mediaproviders.KeepVid.getAnswer(strLink, "aa");
if (NoMuleRuntime.DEBUG) System.out.println(res);
String regexp = "http:\\/\\/[^\"]+\\/get_video[^\"]+";
Pattern p = Pattern.compile(regex... | false |
5,384 | 12,539,808 | 20,587,078 | public void jsFunction_extract(ScriptableFile outputFile) throws IOException, FileSystemException, ArchiveException {
InputStream is = file.jsFunction_createInputStream();
OutputStream output = outputFile.jsFunction_createOutputStream();
BufferedInputStream buf = new BufferedInputStream(is);... | public static void main(String[] a) {
ArrayList<String> allFilesToBeCopied = new ArrayList<String>();
new File(outputDir).mkdirs();
try {
FileReader fis = new FileReader(completeFileWithDirToCathFileList);
BufferedReader bis = new BufferedReader(fis);
Stri... | true |
5,385 | 7,209,802 | 22,625,096 | public static void main(String[] args) throws IOException {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(4444);
} catch (IOException e) {
System.err.println("Could not listen on port: 4444.");
System.exit(1);
}
So... | public void run() {
long starttime = (new Date()).getTime();
Matcher m = Pattern.compile("(\\S+);(\\d+)").matcher(Destination);
boolean completed = false;
if (OutFile.length() > IncommingProcessor.MaxPayload) {
logger.warn("Payload is too large!");
close();
... | true |
5,386 | 4,761,833 | 15,402,323 | private void copyFileToDir(MyFile file, MyFile to, wlPanel panel) throws IOException {
Utilities.print("started copying " + file.getAbsolutePath() + "\n");
FileOutputStream fos = new FileOutputStream(new File(to.getAbsolutePath()));
FileChannel foc = fos.getChannel();
FileInputStream... | public static String getMd5Hash(String text) {
StringBuffer result = new StringBuffer(32);
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
Formatter f = new Formatter(result);
byte[] digest = md5.digest();
... | false |
5,387 | 9,240,872 | 23,004,478 | public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
lon... | @Override
public int onPut(Operation operation) {
synchronized (MuleObexRequestHandler.connections) {
MuleObexRequestHandler.connections++;
if (logger.isDebugEnabled()) {
logger.debug("Connection accepted, total number of connections: " + MuleObexRequestHandler.co... | true |
5,388 | 18,998,637 | 3,532,296 | public boolean loadResource(String resourcePath) {
try {
URL url = Thread.currentThread().getContextClassLoader().getResource(resourcePath);
if (url == null) {
logger.error("Cannot find the resource named: '" + resourcePath + "'. Failed to load the keyword list.");
... | public String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | false |
5,389 | 6,644,757 | 7,823,489 | public void excluir(Cliente cliente) throws Exception {
Connection connection = criaConexao(false);
String sql = "delete from cliente where cod_cliente = ?";
PreparedStatement stmt = null;
try {
stmt = connection.prepareStatement(sql);
stmt.setLong(1, cliente.... | protected String getPostRequestContent(String urlText, String postParam) throws Exception {
URL url = new URL(urlText);
HttpURLConnection urlcon = (HttpURLConnection) url.openConnection();
String line = null;
try {
urlcon.setRequestMethod("POST");
urlcon.setUs... | false |
5,390 | 210,587 | 417,620 | 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 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 |
5,391 | 2,058,791 | 12,741,414 | public void doPreparedStatementQueryAndUpdate(Connection conn, String id) throws SQLException {
try {
int key = getNextKey();
String bValue = "doPreparedStatementQueryAndUpdate:" + id + ":" + testId;
PreparedStatement s1;
if (key >= MAX_KEY_VALUE) {
... | private void saveMessage(String server, Message message, byte[] bytes) throws Exception {
ConnectionProvider cp = null;
Connection conn = null;
PreparedStatement ps = null;
try {
SessionFactoryImplementor impl = (SessionFactoryImplementor) getPorta... | true |
5,392 | 16,055,802 | 1,642,489 | public static void main(String[] args) throws Exception {
DES des = new DES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test1.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\test2.txt"));
SingleKey key = new SingleKe... | public void testAddFiles() throws Exception {
File original = ZipPlugin.getFileInPlugin(new Path("testresources/test.zip"));
File copy = new File(original.getParentFile(), "1test.zip");
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream... | true |
5,393 | 3,024,983 | 18,084,457 | @Test
public void testCopy_inputStreamToWriter_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out... | public void run() {
try {
Socket socket = getSocket();
System.out.println("opening socket to " + address + " on " + port);
InputStream in = socket.getInputStream();
for (; ; ) {
FileTransferHeader header = FileTransferHeader.readHeader(in);
... | true |
5,394 | 17,553,387 | 22,492,282 | @Override
public boolean putDescription(String uuid, String description) throws DatabaseException {
if (uuid == null) throw new NullPointerException("uuid");
if (description == null) throw new NullPointerException("description");
try {
getConnection().setAutoCommit(false);
... | public static boolean isODF(URL url) throws IOException {
InputStream resStream = ODFUtil.findDataInputStream(url.openStream(), ODFUtil.MIMETYPE_FILE);
if (null == resStream) {
LOG.debug("mimetype stream not found in ODF package");
return false;
}
String mimet... | false |
5,395 | 16,002,376 | 19,382,420 | protected HttpURLConnection frndTrySend(HttpURLConnection h) throws OAIException {
HttpURLConnection http = h;
boolean done = false;
GregorianCalendar sendTime = new GregorianCalendar();
GregorianCalendar testTime = new GregorianCalendar();
GregorianCalendar retryTime = null;... | protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
ejb.bprocess.OAIPMH.AutoHarvesterSession ahSession = home.create();
java.util.Vector vector = new java.util.Vector(1, 1);
Integer libraryId... | false |
5,396 | 16,094,377 | 20,637,944 | protected void xInitGUI() {
this.jlHead.setText(formater.getText("select_marc21_title"));
this.jlResId.setText(formater.getText("select_marc21_label_text"));
this.jlResId.setToolTipText(formater.getText("select_marc21_label_description"));
ElvisListModel model = new ElvisListModel();... | public final Reader open(URL url) throws IOException {
Reader ret = null;
Charset cs = this.detectCodepage(url);
if (cs != null) {
ret = new InputStreamReader(new BufferedInputStream(url.openStream()), cs);
}
return ret;
}
| false |
5,397 | 9,856,200 | 14,864,066 | public static void copyFile(File srcFile, File destFolder) {
try {
File destFile = new File(destFolder, srcFile.getName());
if (destFile.exists()) {
throw new BuildException("Could not copy " + srcFile + " to " + destFolder + " as " + destFile + " already exists");
... | protected boolean downloadFile(TestThread thread, ActionResult result) {
result.setRequestString("download file " + remoteFile);
InputStream input = null;
OutputStream output = null;
OutputStream target = null;
boolean status = false;
ftpClient.enterLocalPassiveMode()... | true |
5,398 | 7,286,006 | 2,807,114 | public void reset(String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.setInt(1, currentPilot);
psta.setString(2, componentName);
... | public Controller(String m_hostname, String team, boolean m_shouldexit) throws InternalException {
m_received_messages = new ConcurrentLinkedQueue<ReceivedMessage>();
m_fragmsgs = new ArrayList<String>();
m_customizedtaunts = new HashMap<Integer, String>();
m_nethandler = new Caching... | false |
5,399 | 17,586,131 | 3,352,340 | protected void update(String sql, Object[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
pstmt = conn.prepareStatement(sql);
this.setParameters(pstmt, args);
... | public Long processAddCompany(Company companyBean, String userLogin, Long holdingId, AuthSession authSession) {
if (authSession == null) {
return null;
}
PreparedStatement ps = null;
DatabaseAdapter dbDyn = null;
try {
dbDyn = DatabaseAdapter.getInstan... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.