id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
899,200 | 8,070,379 | 4,420,769 | public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputResource.getInputStream()));
File targetDirectoryAsFile = new File(targetDirectory);
if (!targetDirectoryAsFile.exists... | public void _saveWebAsset(ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form, User user, String subcmd) throws WebAssetException, Exception {
long maxsize = 50;
long maxwidth = 3000;
long maxheight = 3000;
long minheight = 10;
ActionRequestImpl reqIm... | true |
899,201 | 17,543,732 | 16,076,390 | private String getCoded(String pass) {
String passSecret = "";
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(pass.getBytes("UTF8"));
byte s[] = m.digest();
for (int i = 0; i < s.length; i++) {
passSecret += Integer.... | 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 |
899,202 | 10,006,681 | 22,634,542 | public static void copyFile(File src, File dest, int bufSize, boolean force) throws IOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file: " + dest.getName());
}
... | public void run(IAction action) {
Shell shell = new Shell();
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(shell);
viewer.setEditDomain(new DefaultEditDomain(null));
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.set... | false |
899,203 | 8,352,956 | 13,794,582 | void IconmenuItem5_actionPerformed(ActionEvent e) {
JFileChooser jFileChooser1 = new JFileChooser();
String separator = "";
if (getPath() != null && !getPath().equals("")) {
jFileChooser1.setCurrentDirectory(new File(getPath()));
jFileChooser1.setSelectedFile(new File... | public Source get_source(String pageURL, Boolean checkInBase) {
URL url;
URLConnection conn;
Reader inReader;
Source source = null;
String LastModified = "";
Boolean updateData = false;
try {
url = new URL(pageURL);
conn = url.openConne... | false |
899,204 | 7,885,446 | 21,361,961 | public static String CreateZip(String[] filesToZip, String zipFileName) {
byte[] buffer = new byte[18024];
try {
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
out.setLevel(Deflater.BEST_COMPRESSION);
for (int i = 0; i < filesToZip.l... | private void transform(CommandLine commandLine) throws IOException {
Reader reader;
if (commandLine.hasOption('i')) {
reader = createFileReader(commandLine.getOptionValue('i'));
} else {
reader = createStandardInputReader();
}
Writer writer;
if... | true |
899,205 | 550,697 | 7,911,395 | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | public void executaAlteracoes() {
Album album = Album.getAlbum();
Photo[] fotos = album.getFotos();
Photo f;
int ultimoFotoID = -1;
int albumID = album.getAlbumID();
sucesso = true;
PainelWebFotos.setCursorWait(true);
albumID = recordAlbumData(album, a... | true |
899,206 | 1,811,744 | 7,034,031 | public void testSimpleHttpPostsWithContentLength() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
rnd... | private void copyFile(File sourceFile, File destFile) throws IOException {
if (log.isDebugEnabled()) {
log.debug("CopyFile : Source[" + sourceFile.getAbsolutePath() + "] Dest[" + destFile.getAbsolutePath() + "]");
}
if (!destFile.exists()) {
destFile.createNewFile();
... | false |
899,207 | 41,672 | 1,811,746 | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | public void testSimpleHttpPostsChunked() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(20000);
byte[] data = new byte[size];
rnd.nextByte... | false |
899,208 | 7,847,812 | 16,292,791 | protected synchronized void doLogin(long timeout, String eventMask) throws IOException, AuthenticationFailedException, TimeoutException {
ChallengeAction challengeAction;
ManagerResponse challengeResponse;
String challenge;
String key;
LoginAction loginAction;
Manager... | public void doCompress(File[] files, File out, List<String> excludedKeys) {
Map<String, File> map = new HashMap<String, File>();
String parent = FilenameUtils.getBaseName(out.getName());
for (File f : files) {
CompressionUtil.list(f, parent, map, excludedKeys);
}
... | false |
899,209 | 21,212,076 | 21,407,347 | private void readParameterTable() {
if (this.parameters != null) return;
parameters = new GribPDSParameter[NPARAMETERS];
int center;
int subcenter;
int number;
try {
BufferedReader br;
if (filename != null && filename.length() > 0) {
... | public boolean load() {
if (getFilename() != null && getFilename().length() > 0) {
try {
File file = new File(PreferencesManager.getDirectoryLocation("macros") + File.separator + getFilename());
URL url = file.toURL();
InputStreamReader isr = new I... | true |
899,210 | 2,210,892 | 21,113,767 | protected int doExecuteUpdate(PreparedStatement statement) throws SQLException {
connection.setAutoCommit(isAutoCommit());
int rs = -1;
try {
lastError = null;
rs = statement.executeUpdate();
if (!isAutoCommit()) connection.commit();
} catch (Excep... | @Override
public void render(Output output) throws IOException {
output.setStatus(headersFile.getStatusCode(), headersFile.getStatusMessage());
for (Entry<String, Set<String>> header : headersFile.getHeadersMap().entrySet()) {
Set<String> values = header.getValue();
for (... | false |
899,211 | 9,778,726 | 12,798,072 | public void apop(String user, char[] secret) throws IOException, POP3Exception {
if (timestamp == null) {
throw new CommandNotSupportedException("No timestamp from server - APOP not possible");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
m... | public static String encrypt(String txt) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(txt.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
| true |
899,212 | 20,601,755 | 20,514,913 | public static File copyFile(File file) {
File src = file;
File dest = new File(src.getName());
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
FileChannel destinati... | private void saveCampaign() throws HeadlessException {
try {
dbConnection.setAutoCommit(false);
dbConnection.setSavepoint();
String sql = "UPDATE campaigns SET " + "queue = ? ," + "adjustRatioPeriod = ?, " + "asterisk = ?, " + "context = ?," + "extension = ?, " + "dialCon... | false |
899,213 | 20,112,083 | 896,372 | @Override
public void connect() throws IOException {
URL url = getLocator().getURL();
if (url.getProtocol().equals("file")) {
final String newUrlStr = URLUtils.createAbsoluteFileUrl(url.toExternalForm());
if (newUrlStr != null) {
if (!newUrlStr.toString().... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
899,214 | 20,082,006 | 12,499,284 | public static void copyFile(File src, File dst) throws IOException {
FileChannel sourceChannel = new FileInputStream(src).getChannel();
FileChannel destinationChannel = new FileOutputStream(dst).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sour... | public void runTask(HashMap pjobParms) throws Exception {
FTPClient lftpClient = null;
FileOutputStream lfosTargetFile = null;
JBJFPluginDefinition lpluginCipher = null;
IJBJFPluginCipher theCipher = null;
try {
JBJFFTPDefinition lxmlFTP = null;
if (ge... | false |
899,215 | 941,896 | 21,958,776 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void filter(File source, File destination, MNamespace mNamespace) throws Exception {
BufferedReader reader = new BufferedReader(new FileReader(source));
BufferedWriter writer = new BufferedWriter(new FileWriter(destination));
int line = 0;
int column = 0;
Stack parseSt... | true |
899,216 | 945,607 | 5,297,820 | 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 copyFile(File src, File dst) throws IOException {
FileChannel from = new FileInputStream(src).getChannel();
FileChannel to = new FileOutputStream(dst).getChannel();
from.transferTo(0, src.length(), to);
from.close();
to.close();
}
| true |
899,217 | 1,677,876 | 19,549,579 | public static String upload_file(String sessionid, String localFilePath, String remoteTagPath) {
String jsonstring = "If you see this message, there is some problem inside the function:upload_file()";
String srcPath = localFilePath;
String uploadUrl = "https://s2.cloud.cm/rpc/json/?session_i... | protected InputStream callApiMethod(String apiUrl, String xmlContent, String contentType, String method, int expected) {
try {
URL url = new URL(apiUrl);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
if (ApplicationConstants.CONNECT_TIMEOUT > -1) {... | false |
899,218 | 3,054,600 | 18,371,114 | private void generateArchetype(final IProject project, final IDataModel model, final IProgressMonitor monitor, final boolean offline) throws CoreException, InterruptedException, IOException {
if (getArchetypeArtifactId(model) != null) {
final Properties properties = new Properties();
... | public static void copy(final File source, final File dest) throws IOException {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
... | true |
899,219 | 23,537,682 | 13,616,724 | public static byte[] readResource(Class owningClass, String resourceName) {
final URL url = getResourceUrl(owningClass, resourceName);
if (null == url) {
throw new MissingResourceException(owningClass.toString() + " key '" + resourceName + "'", owningClass.toString(), resourceName);
... | public void write(File file) throws Exception {
if (medooFile != null) {
if (!medooFile.renameTo(file)) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(med... | true |
899,220 | 7,631,407 | 22,689,223 | public static InputStream getNotCacheResourceAsStream(final String fileName) {
if ((fileName.indexOf("file:") >= 0) || (fileName.indexOf(":/") > 0)) {
try {
URL url = new URL(fileName);
return new BufferedInputStream(url.openStream());
} catch (Excepti... | @Override
public void testAction(ITestThread testThread) throws Throwable {
try {
final InputStream urlIn = new URL("http://jdistunit.sourceforge.net").openStream();
final int availableBytes = urlIn.available();
if (0 == availableBytes) {
... | false |
899,221 | 1,118,153 | 19,823,992 | public final synchronized boolean isValidLicenseFile() throws LicenseNotSetupException {
if (!isSetup()) {
throw new LicenseNotSetupException();
}
boolean returnValue = false;
Properties properties = getLicenseFile();
logger.debug("isValidLicenseFile: License to v... | public String getHash(String key, boolean base64) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(key.getBytes());
if (base64) return new String(new Base64().encode(md.digest()), "UTF8"); else return new String(md.digest(), "UTF8");
}
| true |
899,222 | 21,792,245 | 5,770,148 | public static String[] retrieveFasta(String id) throws Exception {
URL url = new URL("http://www.uniprot.org/uniprot/" + id + ".fasta");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String header = reader.readLine();
StringBuffer seq = new Stri... | public static void pingSearchEngine(String engineURL) throws MalformedURLException, UnsupportedEncodingException {
if ((ConfigurationManager.getProperty("http.proxy.host") != null) && (ConfigurationManager.getProperty("http.proxy.port") != null)) {
System.setProperty("proxySet", "true");
... | true |
899,223 | 9,261,775 | 22,177,057 | public static void unzipAndRemove(final String file) {
String destination = file.substring(0, file.length() - 3);
InputStream is = null;
OutputStream os = null;
try {
is = new GZIPInputStream(new FileInputStream(file));
os = new FileOutputStream(destination);
... | private void saveFile(File destination) {
InputStream in = null;
OutputStream out = null;
try {
if (fileScheme) in = new BufferedInputStream(new FileInputStream(source.getPath())); else in = new BufferedInputStream(getContentResolver().openInputStream(source));
out = ... | true |
899,224 | 11,904,056 | 16,532,304 | public static void convertEncoding(File infile, File outfile, String from, String to) throws IOException, UnsupportedEncodingException {
InputStream in;
if (infile != null) in = new FileInputStream(infile); else in = System.in;
OutputStream out;
outfile.createNewFile();
if (o... | private void putAlgosFromJar(File jarfile, AlgoDir dir, Model model) throws FileNotFoundException, IOException {
URLClassLoader urlLoader = new URLClassLoader(new URL[] { jarfile.toURI().toURL() });
JarInputStream jis = new JarInputStream(new FileInputStream(jarfile));
JarEntry entry = jis.g... | true |
899,225 | 1,089,238 | 11,730,227 | private Document saveFile(Document document, File file) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATEFORMAT_YYYYMMDD);
List<Preference> preferences = prefService.findAll();
if (preferences != null && !preferences.isEmpty()) {
Preference preference ... | private void copy(File source, File target) throws IOException {
FileChannel in = (new FileInputStream(source)).getChannel();
FileChannel out = (new FileOutputStream(target)).getChannel();
in.transferTo(0, source.length(), out);
in.close();
out.close();
}
| true |
899,226 | 2,941,113 | 22,580,642 | private void download(URL url, File outFile) throws IOException {
System.out.println("Trying to download: " + url);
InputStream in = null;
OutputStream out = null;
try {
URLConnection conn = url.openConnection();
in = conn.getInputStream();
out = n... | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
long startTime = System.currentTimeMillis();
boolean validClient = true;
boolean validSession = false;
String sessionKey = req.getParameter("sid");
Str... | false |
899,227 | 15,535,344 | 12,296,632 | public void testDoubleNaN() {
double value = 0;
boolean wasEqual = false;
String message = "DB operation completed";
String ddl1 = "DROP TABLE t1 IF EXISTS;" + "CREATE TABLE t1 ( d DECIMAL, f DOUBLE, l BIGINT, i INTEGER, s SMALLINT, t TINYINT, " + "dt DATE DEFAULT CURRENT_DATE, ti TI... | public boolean check(Object credentials) {
try {
byte[] digest = null;
if (credentials instanceof Password || credentials instanceof String) {
synchronized (__md5Lock) {
if (__md == null) __md = MessageDigest.getInstance("MD... | false |
899,228 | 21,008,917 | 4,591,683 | private String determineGuardedHtml() {
StringBuffer buf = new StringBuffer();
if (m_guardedButtonPresent) {
buf.append("\n<span id='" + getHtmlIdPrefix() + PUSH_PAGE_SUFFIX + "' style='display:none'>\n");
String location = m_guardedHtmlLocation != null ? m_guardedHtmlLocatio... | public static void copyFile(File source, File dest) throws IOException {
if (source.equals(dest)) throw new IOException("Source and destination cannot be the same file path");
FileChannel srcChannel = new FileInputStream(source).getChannel();
if (!dest.exists()) dest.createNewFile();
... | false |
899,229 | 22,677,813 | 8,269,895 | @Override
public Class<?> loadClass(final String name) throws ClassNotFoundException {
final String baseName = StringUtils.substringBefore(name, "$");
if (baseName.startsWith("java") && !whitelist.contains(baseName) && !additionalWhitelist.contains(baseName)) {
th... | private String getData(String requestUrl) throws AuthenticationException, IOException {
URL url = new URL(requestUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String header;
try {
header = oauthAuthenticator.getHttpAuthorizationHeader(url.toStri... | false |
899,230 | 19,812,872 | 6,959,224 | public InputStream getEntry(String entryPath) throws IOException {
if (!entries.contains(entryPath)) {
return null;
}
JarInputStream jis = new JarInputStream(new BufferedInputStream(url.openStream()));
do {
ZipEntry ze = jis.getNextEntry();
if (ze ... | 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 ... | false |
899,231 | 16,116,225 | 1,048,665 | public void process(String t) {
try {
MessageDigest md5 = MessageDigest.getInstance(MD5_DIGEST);
md5.reset();
md5.update(t.getBytes());
callback.display(null, digestToHexString(md5.digest()));
} catch (Exception ex) {
callback.display(null,... | 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... | false |
899,232 | 14,085,200 | 76,427 | 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 static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | false |
899,233 | 7,636,710 | 8,046,689 | 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;
... | private URL retrieveFirstURL(URL url, RSLink link) {
link.setStatus(RSLink.STATUS_WAITING);
URL result = null;
HttpURLConnection httpConn = null;
BufferedReader inr = null;
Pattern formStartPattern = Pattern.compile("<form.+action=\"");
Pattern freeUserPattern = Patte... | false |
899,234 | 146,579 | 792,644 | 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 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 |
899,235 | 17,557,889 | 17,068,090 | private String getMAC(String password) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
}
try {
md.update(password.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
... | public String encripta(String senha) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(digest.digest());
} catch (NoSuchAlgorithmExceptio... | true |
899,236 | 22,254,269 | 7,407,008 | @Override
public String post(final FetchInfos fetchInfos, final String data) throws HttpException {
URL url = null;
try {
url = new URL(fetchInfos.getUri());
} catch (MalformedURLException exception) {
throw new HttpException("uri is malformed '" + fetchInfos.getU... | public static Image loadImage(String path) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = mainFrame.getClass().getResourceAsStream(path);
if (in == null) throw new RuntimeException("Ressource " + path + " not found");
try {
IOUtils.copy(in, ou... | false |
899,237 | 14,193,056 | 1,737,312 | public static String readFromURL(String url_) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(url_);
System.setProperty("http.agent", "");
URLConnection connection = url.openConnection();
connection.setRequestProperty("User-Agent", ... | public void sendPOIGpxLocation() {
this.myloc = new Position(45.56, 5.9);
this.left = myloc.getY() - 0.025;
this.right = myloc.getY() + 0.025;
this.top = myloc.getX() + 0.03;
this.bottom = myloc.getX() - 0.03;
assertEquals("left test", left, (5.9 - 0.025));
as... | false |
899,238 | 7,816,467 | 5,021,676 | private CharBuffer decodeToFile(ReplayInputStream inStream, String backingFilename, String encoding) throws IOException {
CharBuffer charBuffer = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, encoding));
File backingFile = new File(backingFilename);
... | public static String getSHA1Digest(String inputStr) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
byte[] sha1hash = null;
md = MessageDigest.getInstance("SHA");
sha1hash = new byte[40];
md.update(inputStr.getBytes("iso-8859-1"), 0, i... | false |
899,239 | 15,958,994 | 16,966,539 | public String loadURLString(java.net.URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String s = "";
while (br.ready() && s != null) {
s = br.readLine();
... | 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 |
899,240 | 9,983,757 | 13,120,648 | public static void copyFiles(String strPath, String dstPath) throws IOException {
File src = new File(strPath);
File dest = new File(dstPath);
if (src.isDirectory()) {
dest.mkdirs();
String list[] = src.list();
for (int i = 0; i < list.length; i++) {
... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String arg = req.getParameter("file");
if (arg == null) {
resp.sendError(404, "Missing 'file' Arg");
return;
}
int mfid = NumberUtils.to... | true |
899,241 | 14,380,467 | 5,471,672 | public String readTemplateToString(String fileName) {
URL url = null;
url = classLoader.getResource(fileName);
StringBuffer content = new StringBuffer();
if (url == null) {
String error = "Template file could not be found: " + fileName;
throw new RuntimeExcept... | private void upgradeSchema() throws IOException {
Statement stmt = null;
try {
int i = getSchema();
if (i < SCHEMA_VERSION) {
conn.setAutoCommit(false);
stmt = conn.createStatement();
while (i < SCHEMA_VERSION) {
... | false |
899,242 | 3,670,410 | 6,191,498 | private void copyPhoto(final IPhoto photo, final Map.Entry<String, Integer> size) {
final File fileIn = new File(storageService.getPhotoPath(photo, storageService.getOriginalDir()));
final File fileOut = new File(storageService.getPhotoPath(photo, size.getKey()));
InputStream fileInputStream... | private static void copySmallFile(final File sourceFile, final File targetFile) throws PtException {
LOG.debug("Copying SMALL file '" + sourceFile.getAbsolutePath() + "' to " + "'" + targetFile.getAbsolutePath() + "'.");
FileChannel inChannel = null;
FileChannel outChannel = null;
tr... | true |
899,243 | 940,862 | 22,303,956 | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | private static BreakIterator createBreakInstance(Locale where, int kind, String rulesName, String dictionaryName) {
ResourceBundle bundle = ICULocaleData.getResourceBundle("BreakIteratorRules", where);
String[] classNames = bundle.getStringArray("BreakIteratorClasses");
String rules = bundle... | false |
899,244 | 17,014,629 | 1,026,390 | public static void fileCopy(File src, File dest) throws IOException {
IOException xforward = null;
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel fcin = null;
FileChannel fcout = null;
try {
fis = new FileInputStream(src);
... | public boolean login(String strUrl, String loginName, String loginPwd) throws ApplicationException {
String starter = "-----------------------------";
String returnChar = "\r\n";
String lineEnd = "--";
String urlString = strUrl;
String input = null;
List txtList = new... | false |
899,245 | 8,702,780 | 20,827,140 | final void saveProject(Project project, final File file) {
if (projectsList.contains(project)) {
if (project.isDirty() || !file.getParentFile().equals(workspaceDirectory)) {
try {
if (!file.exists()) {
if (!file.createNewFile()) throw n... | public static Chunk updateLastSend(Chunk c) throws Exception {
DBConnectionManager dbm = null;
Connection conn = null;
PreparedStatement stmt = null;
Chunk ret = null;
String SQL = "UPDATE CHUNK SET SENT=? WHERE FILEHASH=? AND STARTOFF=? AND LENGTH=?";
log.debug("upda... | false |
899,246 | 2,111,163 | 15,679,088 | public void test_calculateLastModifiedSizeContent() {
File file;
String content = "Hello, world!";
String expected;
FileETag etag;
try {
file = File.createTempFile("temp", "txt");
file.deleteOnExit();
FileOutputStream out = new FileOutputSt... | public static String createStringFromHtml(MyUrl url) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.getUrl().openStream(), "UTF-8"));
String line;
String xmlAsString = "";
while ((line = reader.readLine()) != null) {
... | false |
899,247 | 777,609 | 9,656,103 | 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 removeCollection(long oid, Connection conn) throws XMLDBException {
try {
String sql = "DELETE FROM X_DOCUMENT WHERE X_DOCUMENT.XDB_COLLECTION_OID = ?";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, oid);
pstmt.executeUpda... | false |
899,248 | 10,489,209 | 8,537,682 | public static ISimpleChemObjectReader createReader(URL url, String urlString, String type) throws CDKException {
if (type == null) {
type = "mol";
}
ISimpleChemObjectReader cor = null;
try {
Reader input = new BufferedReader(getReader(url));
Format... | public static String urlPost(Map<String, String> paraMap, String urlStr) throws IOException {
String strParam = "";
for (Map.Entry<String, String> entry : paraMap.entrySet()) {
strParam = strParam + (entry.getKey() + "=" + entry.getValue()) + "&";
}
URL url = new URL(urlS... | true |
899,249 | 750,310 | 12,595,519 | public static boolean changeCredentials() {
boolean passed = false;
boolean credentials = false;
HashMap info = null;
Debug.log("Main.changeCredentials", "show dialog for userinfo");
info = getUserInfo();
if ((Boolean) info.get("submit")) {
try {
... | @SuppressWarnings("unchecked")
public static void main(String[] args) {
System.out.println("Starting encoding test....");
Properties p = new Properties();
try {
InputStream pStream = ClassLoader.getSystemResourceAsStream("sample_weather.properties");
p.load(pStrea... | false |
899,250 | 12,306,296 | 16,000,121 | public static void copyFile(File source, File destination, long copyLength) throws IOException {
if (!source.exists()) {
String message = "File " + source + " does not exist";
throw new FileNotFoundException(message);
}
if (destination.getParentFile() != null && !dest... | public void invoke(InputStream is) throws AgentException {
try {
addHeader("Content-Type", "application/zip");
addHeader("Content-Length", String.valueOf(is.available()));
connection.setDoOutput(true);
connection.connect();
OutputStream os = connec... | true |
899,251 | 20,023,016 | 1,102,939 | private void copy(File from, File to) throws IOException {
InputStream in = new FileInputStream(from);
OutputStream out = new FileOutputStream(to);
byte[] line = new byte[16384];
int bytes = -1;
while ((bytes = in.read(line)) != -1) out.write(line, 0, bytes);
in.close... | public static long writeInputStreamToOutputStream(final InputStream in, final OutputStream out) {
long size = 0;
try {
size = IOUtils.copyLarge(in, out);
} catch (IOException e1) {
e1.printStackTrace();
}
return size;
}
| true |
899,252 | 3,087,100 | 15,288,212 | public static String toPWD(String pwd) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(pwd.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
Syst... | protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(createEditPartFactory());
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
viewer.setRootEditPart(rootEditPart... | false |
899,253 | 19,779,101 | 13,498,122 | protected void initGame() {
try {
for (File fonte : files) {
String absolutePath = outputDir.getAbsolutePath();
String separator = System.getProperty("file.separator");
String name = fonte.getName();
String destName = name.substring... | public boolean createUser(String username, String password, String name) throws Exception {
boolean user_created = false;
try {
statement = connect.prepareStatement("SELECT COUNT(*) from toepen.users WHERE username = ? LIMIT 1");
statement.setString(1, username);
... | false |
899,254 | 433,062 | 11,514,180 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | true |
899,255 | 15,236,847 | 1,913,136 | private static MapEntry<String, Properties> loadFpmConf() throws ConfigurationReadException {
MapEntry<String, Properties> ret = null;
Scanner sc = new Scanner(CONF_PATHS).useDelimiter(SEP_P);
String prev = "";
while (sc.hasNext() && !hasLoaded) {
Properties fpmConf = nul... | private void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.... | true |
899,256 | 12,838,274 | 3,616,724 | public BufferedImage extract() throws DjatokaException {
boolean useRegion = false;
int left = 0;
int top = 0;
int width = 50;
int height = 50;
boolean useleftDouble = false;
Double leftDouble = 0.0;
boolean usetopDouble = false;
Double topDoub... | 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 "... | true |
899,257 | 16,984,004 | 18,730,318 | public String getContentsFromVariant(SelectedVariant selected) {
if (selected == null) {
return null;
}
ActivatedVariablePolicy policy = selected.getPolicy();
Variant variant = selected.getVariant();
if (variant == null) {
return null;
}
... | public boolean write(Node node, LSOutput output) throws LSException {
OutputStream out = output.getByteStream();
try {
if (out == null) {
String systemId = output.getSystemId();
try {
URL url = new URL(systemId);
URL... | false |
899,258 | 7,039,646 | 701,471 | private static final void cloneFile(File origin, File target) throws IOException {
FileChannel srcChannel = null;
FileChannel destChannel = null;
try {
srcChannel = new FileInputStream(origin).getChannel();
destChannel = new FileOutputStream(target).getChannel();
... | private boolean enregistreToi() {
PrintWriter lEcrivain;
String laDest = "./img_types/" + sonImage;
if (!new File("./img_types").exists()) {
new File("./img_types").mkdirs();
}
try {
FileChannel leFicSource = new FileInputStream(sonFichier).getChannel(... | true |
899,259 | 778,875 | 20,789,900 | 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));
... | public void render(HttpServletRequest request, HttpServletResponse response, File file, final Throwable t, final String contentType, final String encoding) throws Exception {
if (contentType != null) {
response.setContentType(contentType);
}
if (encoding != null) {
re... | true |
899,260 | 3,945,057 | 23,512,890 | private boolean streamDownload(URL url, File file) {
try {
InputStream in = url.openConnection().getInputStream();
BufferedInputStream bis = new BufferedInputStream(in);
OutputStream out = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutp... | 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()... | false |
899,261 | 23,119,494 | 20,601,754 | @Override
public void handle(HttpExchange http) throws IOException {
Headers reqHeaders = http.getRequestHeaders();
Headers respHeader = http.getResponseHeaders();
respHeader.add("Content-Type", "text/plain");
http.sendResponseHeaders(200, 0);
PrintWriter console = new Pr... | public static File copyFile(File file, String dirName) {
File destDir = new File(dirName);
if (!destDir.exists() || !destDir.isDirectory()) {
destDir.mkdirs();
}
File src = file;
File dest = new File(dirName, src.getName());
try {
if (!dest.exi... | true |
899,262 | 8,990,219 | 3,767,762 | private boolean getCached(Get g) throws IOException {
boolean ret = false;
File f = getCachedFile(g);
if (f.exists()) {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(f);
os = new FileOutputStr... | @Override
public int deleteStatement(String sql) {
Statement statement = null;
try {
statement = getConnection().createStatement();
int result = statement.executeUpdate(sql.toString());
if (result == 0) log.warn(sql + " result row count is 0");
get... | false |
899,263 | 10,432,256 | 536,114 | private void copyImage(ProjectElement e) throws Exception {
String fn = e.getName();
if (!fn.toLowerCase().endsWith(".png")) {
if (fn.contains(".")) {
fn = fn.substring(0, fn.lastIndexOf('.')) + ".png";
} else {
fn += ".png";
}
... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
899,264 | 14,610,319 | 10,385,493 | public static void loginWuploader() throws IOException {
HttpParams params = new BasicHttpParams();
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
DefaultHttpClient httpclient = new DefaultHttpClient(params);
... | public void writeBack(File destinationFile, boolean makeCopy) throws IOException {
if (makeCopy) {
FileChannel sourceChannel = new java.io.FileInputStream(getFile()).getChannel();
FileChannel destinationChannel = new java.io.FileOutputStream(destinationFile).getChannel();
... | false |
899,265 | 5,520,449 | 7,976,872 | protected void init() {
if (this.strUrl != null) {
InputStream in = null;
try {
URL url = ClassLoader.getSystemClassLoader().getResource(strUrl);
if (url != null) {
in = url.openStream();
if (in != null) {
... | public static void copy_file(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.is... | false |
899,266 | 4,464,301 | 12,544,564 | protected void shutdown(final boolean unexpected) {
ControlerState oldState = this.state;
this.state = ControlerState.Shutdown;
if (oldState == ControlerState.Running) {
if (unexpected) {
log.warn("S H U T D O W N --- received unexpected shutdown request.");
... | public static void getResponseAsStream(String _url, Object _stringOrStream, OutputStream _stream, Map _headers, Map _params, String _contentType, int _timeout) throws IOException {
if (_url == null || _url.length() <= 0) throw new IllegalArgumentException("Url can not be null.");
String temp = _url.... | true |
899,267 | 5,537,138 | 427,727 | public static String getDigest(String seed, String code) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(seed.getBytes("UTF-8"));
byte[] passwordMD5Byte = md.digest(code.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
... | 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));
... | false |
899,268 | 5,335,270 | 8,330,518 | @Override
public String getData(String blipApiPath, String authHeader) {
try {
URL url = new URL(BLIP_API_URL + blipApiPath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (authHeader != null) {
conn.addRequestProperty("Authoriz... | public void startElement(String uri, String tag, String qName, org.xml.sax.Attributes attributes) throws SAXException {
wabclient.Attributes prop = new wabclient.Attributes(attributes);
try {
if (tag.equals("window")) startWindow(prop); else if (tag.equals("splitpanel")) startSplitPanel(... | true |
899,269 | 16,912,326 | 2,721,034 | @Override
public void execute() throws BuildException {
if (this.toFile == null && this.toDir == null) throw new BuildException("Missing Destination File/Dir");
if (this.toFile != null && this.toDir != null) throw new BuildException("Both Defined Destination File/Dir");
if (this.urlStr =... | public File takeFile(File f, String prefix, String suffix) throws IOException {
File nf = createNewFile(prefix, suffix);
FileInputStream fis = new FileInputStream(f);
FileChannel fic = fis.getChannel();
FileOutputStream fos = new FileOutputStream(nf);
FileChannel foc = fos.ge... | false |
899,270 | 18,060,085 | 10,006,681 | public static boolean verifyPassword(String digest, String password) {
String alg = null;
int size = 0;
if (digest.regionMatches(true, 0, "{SHA}", 0, 5)) {
digest = digest.substring(5);
alg = "SHA-1";
size = 20;
} else if (digest.regionMatches(true... | public static void copyFile(File src, File dest, int bufSize, boolean force) throws IOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file: " + dest.getName());
}
... | false |
899,271 | 860,578 | 9,236,362 | 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 String unJar(String jarPath, String jarEntry) {
String path;
if (jarPath.lastIndexOf("lib/") >= 0) path = jarPath.substring(0, jarPath.lastIndexOf("lib/")); else path = jarPath.substring(0, jarPath.lastIndexOf("/"));
String relPath = jarEntry.substring(0, jarEntry.lastIndexOf("/"));
... | true |
899,272 | 15,639,580 | 21,343,573 | public ScoreModel(URL url) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
list = new ArrayList<ScoreModelItem>();
map = new HashMap<String, ScoreModelItem>();
line = in.readLine();
int n = 1;
... | private static String getProviderName(URL url, PrintStream err) {
InputStream in = null;
try {
in = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
String result = null;
while (true) {
S... | true |
899,273 | 22,135,200 | 16,223,923 | public void testCodingCompletedFromFile() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params... | public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
InputStream urlStream = url.openStream();
AudioFileFormat fileFormat = null;
try {
fileFormat = getFMT(urlStream, false);
} finally {
if (fileFormat == nul... | false |
899,274 | 1,699,618 | 13,111,022 | public static void copyURLToFile(URL source, File destination) throws IOException {
if (destination.getParentFile() != null && !destination.getParentFile().exists()) {
destination.getParentFile().mkdirs();
}
if (destination.exists() && !destination.canWrite()) {
Strin... | private static void copy(File source, File target) throws IOException {
InputStream is = null;
OutputStream os = null;
try {
is = new BufferedInputStream(new FileInputStream(source));
os = new BufferedOutputStream(new FileOutputStream(target));
int b;
... | true |
899,275 | 5,977,094 | 12,821,749 | public int deleteFile(Integer[] fileID) throws SQLException {
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
int nbrow = 0;
try {
DataSource ds = getDataSource(DEFAULT_DATASOURCE);
conn = ds.getConnection();
co... | public static void fastBackup(File file) {
FileChannel in = null;
FileChannel out = null;
FileInputStream fin = null;
FileOutputStream fout = null;
try {
in = (fin = new FileInputStream(file)).getChannel();
out = (fout = new FileOutputStream(file.getAb... | false |
899,276 | 19,922,657 | 10,079,611 | protected static boolean copyFile(File src, File dest) {
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
byte[] temp = new byte[1... | public static void copy(File source, File sink) throws IOException {
if (source == null) throw new NullPointerException("Source file must not be null");
if (sink == null) throw new NullPointerException("Target file must not be null");
if (!source.exists()) throw new IOException("Source file ... | true |
899,277 | 18,121,763 | 13,642,472 | public String doUpload(@ParamName(name = "file") MultipartFile file, @ParamName(name = "uploadDirectory") String _uploadDirectory) throws IOException {
String sessionId = (String) RuntimeAccess.getInstance().getSession().getAttribute("SESSION_ID");
String tempUploadDir = MewitProperties.getTemporary... | protected void handleConnection(Socket server) throws IOException {
OutputStream out = server.getOutputStream();
PrintWriter pout = new PrintWriter(out, true);
BufferedReader in = SocketUtil.getReader(server);
String failureReason = null;
int failureCode = 0;
String h... | false |
899,278 | 14,974,316 | 4,484,215 | public void connect() throws ClientProtocolException, IOException {
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
inputStream = entity.getContent();
Header contentEncodingHeader = entity.getContentEncoding();
if (conten... | @Override
public void dispatchContent(InputStream is) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("Sending content message over JMS");
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(is, bos);
this.send(new MessageC... | false |
899,279 | 250,595 | 17,097,179 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
899,280 | 1,787,391 | 17,477,953 | 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... | public static void createModelZip(String filename, String tempdir, boolean overwrite) throws Exception {
FileTools.checkOutput(filename, overwrite);
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(filename);
ZipOutputStream out = new ZipOutputStream(ne... | true |
899,281 | 13,335,071 | 16,000,121 | 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... | public void invoke(InputStream is) throws AgentException {
try {
addHeader("Content-Type", "application/zip");
addHeader("Content-Length", String.valueOf(is.available()));
connection.setDoOutput(true);
connection.connect();
OutputStream os = connec... | true |
899,282 | 18,515,326 | 16,380,120 | public static boolean cpy(File a, File b) {
try {
FileInputStream astream = null;
FileOutputStream bstream = null;
try {
astream = new FileInputStream(a);
bstream = new FileOutputStream(b);
long flength = a.length();
... | @Override
public String compute_hash(String plaintext) {
MessageDigest d;
try {
d = MessageDigest.getInstance(get_algorithm_name());
d.update(plaintext.getBytes());
byte[] hash = d.digest();
StringBuffer sb = new StringBuffer();
for (by... | false |
899,283 | 9,270,406 | 3,078,767 | public void downSync(Vector v) throws SQLException {
try {
con = allocateConnection(tableName);
PreparedStatement update = con.prepareStatement("update cal_Event set owner=?,subject=?,text=?,place=?," + "contactperson=?,startdate=?,enddate=?,starttime=?,endtime=?,allday=?," + "syncst... | public static void copyFile(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
in.transferTo(0, in.size(), out);
} catch (FileN... | false |
899,284 | 23,658,098 | 5,053,350 | public void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.c... | @Test
public void testGrantLicense() throws Exception {
context.turnOffAuthorisationSystem();
Item item = Item.create(context);
String defaultLicense = ConfigurationManager.getDefaultSubmissionLicense();
LicenseUtils.grantLicense(context, item, defaultLicense);
StringWrit... | true |
899,285 | 17,467,385 | 22,080,747 | private void moveFile(File orig, File target) throws IOException {
byte buffer[] = new byte[1000];
int bread = 0;
FileInputStream fis = new FileInputStream(orig);
FileOutputStream fos = new FileOutputStream(target);
while (bread != -1) {
bread = fis.read(buffer);
... | @Test
public void testCustomerResource() throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
System.out.println("**** CustomerResource No Query params ***");
HttpGet get = new HttpGet("http://localhost:9095/customers");
HttpResponse response = client.execute(ge... | false |
899,286 | 19,922,657 | 20,886,787 | protected static boolean copyFile(File src, File dest) {
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
byte[] temp = new byte[1... | public static void copyFile(final File source, final File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByt... | true |
899,287 | 16,797,551 | 2,499,053 | public boolean backup() {
try {
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String currentDBPath = "/data/android.bluebox/databases/bluebox.db";
String backupDBPath =... | public String encryptToMD5(String info) {
byte[] digesta = null;
try {
MessageDigest alga = MessageDigest.getInstance("MD5");
alga.update(info.getBytes());
digesta = alga.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
... | false |
899,288 | 22,743,765 | 17,119,759 | public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
InputS... | public void testReaderWriterUC2() throws Exception {
String inFile = "test_data/mri.png";
String outFile = "test_output/mri__smooth_testReaderWriter.png";
itkImageFileReaderUC2_Pointer reader = itkImageFileReaderUC2.itkImageFileReaderUC2_New();
itkImageFileWriterUC2_Pointer writer = ... | true |
899,289 | 10,178,498 | 19,332,852 | public static IChemModel readInChI(URL url) throws CDKException {
IChemModel chemModel = new ChemModel();
try {
IMoleculeSet moleculeSet = new MoleculeSet();
chemModel.setMoleculeSet(moleculeSet);
StdInChIParser parser = new StdInChIParser();
BufferedR... | public void access() {
Authenticator.setDefault(new MyAuthenticator());
try {
URL url = new URL("http://localhost/ws/test");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine()) != nu... | true |
899,290 | 4,361,391 | 580,527 | public static String getHash(String key) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(key.getBytes());
return new BigInteger(digest.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
return key;
}
... | public void elimina(Pedido pe) throws errorSQL, errorConexionBD {
System.out.println("GestorPedido.elimina()");
int id = pe.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM pedido WHERE id=" + id;
System.out.... | false |
899,291 | 21,754,657 | 5,258,165 | private JButton getButtonImagen() {
if (buttonImagen == null) {
buttonImagen = new JButton();
buttonImagen.setText(Messages.getString("gui.AdministracionResorces.6"));
buttonImagen.setIcon(new ImageIcon(getClass().getResource("/es/unizar/cps/tecnoDiscap/data/icons/view_si... | private static boolean copyFile(File src, File dest) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
for (int c = fis.read(); c != -1; c = fis.read()) fos.write(c);
... | true |
899,292 | 10,118,785 | 12,614,306 | @Override
public void download(String remoteFilePath, String localFilePath) {
InputStream remoteStream = null;
try {
remoteStream = client.get(remoteFilePath);
} catch (IOException e) {
e.printStackTrace();
}
OutputStream localStream = null;
... | 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 |
899,293 | 3,558,514 | 11,353,263 | private synchronized void ensureParsed() throws IOException, BadIMSCPException {
if (cp != null) return;
if (on_disk == null) {
on_disk = createTemporaryFile();
OutputStream to_disk = new FileOutputStream(on_disk);
IOUtils.copy(in.getInputStream(), to_disk);
... | @Test
@Ignore
public void testToJson() throws IOException {
JsonSerializer js = new StreamingJsonSerializer(new ObjectMapper());
BulkOperation op = js.createBulkOperation(createTestData(10000), false);
IOUtils.copy(op.getData(), System.out);
}
| true |
899,294 | 20,493,867 | 2,440,999 | @Override
public void execute(JobExecutionContext context) throws JobExecutionException {
super.execute(context);
debug("Start execute job " + this.getClass().getName());
try {
String name = "nixspam-ip.dump.gz";
String f = this.path_app_root + "/" + this.properti... | private static boolean validateSshaPwd(String sSshaPwd, String sUserPwd) {
boolean b = false;
if (sSshaPwd != null && sUserPwd != null) {
if (sSshaPwd.startsWith(SSHA_PREFIX)) {
sSshaPwd = sSshaPwd.substring(SSHA_PREFIX.length());
try {
... | false |
899,295 | 13,574,318 | 10,545,755 | public void actionPerformed(ActionEvent e) {
if (saveForWebChooser == null) {
ExtensionFileFilter fileFilter = new ExtensionFileFilter("HTML files");
fileFilter.addExtension("html");
saveForWebChooser = new JFileChooser();
saveForWebCho... | public void write(URL exportUrl, OutputStream output) throws Exception {
if (exportUrl == null || output == null) {
throw new RuntimeException("null passed in for required parameters");
}
MediaContent mc = new MediaContent();
mc.setUri(exportUrl.toString());
Media... | true |
899,296 | 14,412,812 | 13,901,037 | public static String getMD5(String password) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] b = md.digest();
StringBuffer sb = new StringBuffer();
for (byte aB : b) {
sb.append((Integer... | public static String generateGuid(boolean secure) {
MessageDigest md5 = null;
String valueBeforeMD5 = null;
String valueAfterMD5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgori... | true |
899,297 | 1,158,842 | 10,337,387 | public static int unzipFile(File file_input, File dir_output) {
ZipInputStream zip_in_stream;
try {
FileInputStream in = new FileInputStream(file_input);
BufferedInputStream source = new BufferedInputStream(in);
zip_in_stream = new ZipInputStream(source);
... | protected void zipDirectory(File dir, File zipfile) throws IOException, IllegalArgumentException {
if (!dir.isDirectory()) throw new IllegalArgumentException("Compress: not a directory: " + dir);
String[] entries = dir.list();
byte[] buffer = new byte[4096];
int bytes_read;
... | true |
899,298 | 18,539,085 | 17,076,233 | static void createCompleteXML(File file) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(errorFile);
fos = new FileOutputStream(file);
byte[] data = new byte[Integer.parseInt(BlueXStatics.prop.getProperty("allocat... | 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 |
899,299 | 16,031,464 | 13,815,966 | private static boolean initLOG4JProperties(String homeDir) {
String Log4jURL = homeDir + LOG4J_URL;
try {
URL log4jurl = getURL(Log4jURL);
InputStream inStreamLog4j = log4jurl.openStream();
Properties propertiesLog4j = new Properties();
try {
... | private void getRdfResponse(StringBuilder sb, String url) {
try {
String inputLine = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
while ((inputLine = reader.readLine()) != null) {
sb.append(inputLine);... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.