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,500 | 23,047,155 | 616,260 | @Override
public void run() {
long timeout = 10 * 1000L;
long start = (new Date()).getTime();
try {
InputStream is = socket.getInputStream();
boolean available = false;
while (!available && !socket.isClosed()) {
... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | true |
899,501 | 21,967,215 | 11,594,590 | 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 <T extends FetionResponse> T executeAction(FetionAction<T> fetionAction) throws IOException {
URL url = new URL(fetionAction.getProtocol().name().toLowerCase() + "://" + fetionUrl + fetionAction.getRequestData());
URLConnection connection = url.openConnection();
InputStream in = conne... | false |
899,502 | 20,544,327 | 7,005,223 | public static void copyFile(File fileIn, File fileOut) throws IOException {
FileChannel chIn = new FileInputStream(fileIn).getChannel();
FileChannel chOut = new FileOutputStream(fileOut).getChannel();
try {
chIn.transferTo(0, chIn.size(), chOut);
} catch (IOException e) {... | public void checkFilesAndCopyValid(String filename) {
downloadResults();
loadResults();
File tmpFolderF = new File(tmpFolder);
deleteFileFromTMPFolder(tmpFolderF);
ZipReader zr = new ZipReader();
zr.UnzipFile(filename);
try {
LogManager.getInstance... | true |
899,503 | 9,118,411 | 7,225,732 | public void postProcess() throws StopWriterVisitorException {
shpWriter.postProcess();
try {
FileChannel fcinShp = new FileInputStream(fTemp).getChannel();
FileChannel fcoutShp = new FileOutputStream(fileShp).getChannel();
DriverUtilities.copy(fcinShp, fcoutShp);
... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | true |
899,504 | 21,679,395 | 13,335,071 | 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()) {
... | 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... | true |
899,505 | 13,048,961 | 15,973,192 | private final void saveCopy(String source, String destination) {
BufferedInputStream from = null;
BufferedOutputStream to = null;
try {
from = new BufferedInputStream(new FileInputStream(source));
to = new BufferedOutputStream(new FileOutputStream(destination));
... | private SpequlosResponse executeGet(String targetURL, String urlParameters) {
URL url;
HttpURLConnection connection = null;
boolean succ = false;
try {
url = new URL(targetURL + "?" + urlParameters);
connection = (HttpURLConnection) url.openConnection();
... | false |
899,506 | 16,951,197 | 5,040,724 | public void testReleaseOnEntityWriteTo() throws Exception {
HttpParams params = defaultParams.copy();
ConnManagerParams.setMaxTotalConnections(params, 1);
ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
ThreadSafeClientConnManager mgr = createTSCCM(param... | public Document parse(Document document) {
CSSCompilerBuilder compilerBuilder = new CSSCompilerBuilder();
StyleSheetCompilerFactory compilerFactory = getStyleSheetCompilerFactory();
compilerBuilder.setStyleSheetCompilerFactory(compilerFactory);
CSSCompiler cssCompiler = compilerBuild... | false |
899,507 | 10,521,243 | 6,032,985 | public String md5(String phrase) {
MessageDigest m;
String coded = new String();
try {
m = MessageDigest.getInstance("MD5");
m.update(phrase.getBytes(), 0, phrase.length());
coded = (new BigInteger(1, m.digest()).toString(16)).toString();
} catch (... | private byte[] md5Digest(String pPassword) {
if (pPassword == null) {
throw new NullPointerException("input null text for hashing");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pPassword.getBytes());
return md.digest(... | true |
899,508 | 11,088,628 | 337,322 | public static void copyWithClose(InputStream is, OutputStream os) throws IOException {
try {
IOUtils.copy(is, os);
} catch (IOException ioe) {
try {
if (os != null) os.close();
} catch (Exception e) {
}
try {
... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | true |
899,509 | 7,460,369 | 5,066,508 | 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.B64InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base... | public ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException {
if (key == null || fields == null) throw new VetoException("MD5Filter not configured");
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getKey());
int[] f ... | false |
899,510 | 8,138,998 | 11,796,920 | private void handleSSI(HttpData data) throws HttpError, IOException {
File tempFile = TempFileHandler.getTempFile();
FileOutputStream out = new FileOutputStream(tempFile);
BufferedReader in = new BufferedReader(new FileReader(data.realPath));
String[] env = getEnvironmentVariables(da... | public boolean check(Object credentials) {
String password = (credentials instanceof String) ? (String) credentials : credentials.toString();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] ha1;
if (credentials instanceof ... | false |
899,511 | 9,727,050 | 10,318,835 | private PrecomputedAnimatedModel loadPrecomputedModel_(URL url) {
if (precompCache.containsKey(url.toExternalForm())) {
return (precompCache.get(url.toExternalForm()).copy());
}
TextureLoader.getInstance().getTexture("");
List<SharedGroup> frames = new ArrayList<SharedGro... | public static synchronized String Encrypt(String plaintextPassword) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (Exception error) {
throw new Exception(error.getMessage());
}
try {
md.upd... | false |
899,512 | 16,005,062 | 12,776,420 | private void addAuditDatastream() throws ObjectIntegrityException, StreamIOException {
if (m_obj.getAuditRecords().size() == 0) {
return;
}
String dsId = m_pid.toURI() + "/AUDIT";
String dsvId = dsId + "/" + DateUtility.convertDateToString(m_obj.getCreateDate());
... | public Bitmap getImage() throws IOException {
int recordBegin = 78 + 8 * mCount;
Bitmap result = null;
FileChannel channel = new FileInputStream(mFile).getChannel();
channel.position(mRecodeOffset[mPage]);
ByteBuffer bodyBuffer;
if (mPage + 1 < mCount) {
i... | true |
899,513 | 1,089,238 | 13,521,323 | private Document saveFile(Document document, File file) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATEFORMAT_YYYYMMDD);
List<Preference> preferences = prefService.findAll();
if (preferences != null && !preferences.isEmpty()) {
Preference preference ... | public static void copyFile(final String inFile, final String outFile) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(inFile).getChannel();
out = new FileOutputStream(outFile).getChannel();
in.transferTo(0, in.size(), out);... | true |
899,514 | 10,178,498 | 1,205,207 | 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... | @SuppressWarnings("deprecation")
private void loadClassFilesFromJar() {
IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) getJavaElement();
File jarFile = packageFragmentRoot.getResource().getLocation().toFile();
try {
URL url = jarFile.toURL();
UR... | false |
899,515 | 3,667,136 | 4,776,985 | public void fileCopy2(File inFile, File outFile) throws Exception {
try {
FileChannel srcChannel = new FileInputStream(inFile).getChannel();
FileChannel dstChannel = new FileOutputStream(outFile).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
... | public static ByteBuffer join(ByteBuffer buffer1, ByteBuffer buffer2) {
if (buffer2 == null || buffer2.remaining() == 0) return NIOUtils.copy(buffer1);
if (buffer1 == null || buffer1.remaining() == 0) return NIOUtils.copy(buffer2);
ByteBuffer buffer = ByteBuffer.allocate(buffer1.remaining() ... | true |
899,516 | 15,512,556 | 129,856 | private String load(URL url) {
BufferedReader r = null;
try {
r = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
while (r.ready()) {
buf.append(r.readLine()).append('\n');
}
... | public String getScenarioData(String urlForSalesData) throws IOException, Exception {
InputStream inputStream = null;
BufferedReader bufferedReader = null;
DataInputStream input = null;
StringBuffer sBuf = new StringBuffer();
Proxy proxy;
if (httpWebProxyServer != nul... | true |
899,517 | 20,493,053 | 15,968,019 | public static boolean copyFile(File from, File to) {
try {
FileChannel fromChannel = new FileInputStream(from).getChannel();
FileChannel toChannel = new FileOutputStream(to).getChannel();
toChannel.transferFrom(fromChannel, 0, fromChannel.size());
fromChannel.... | public static String createHash(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] digest = md.digest();
return toHexString(digest);
} catch (NoSuchAlgorithmException nsae) {
... | false |
899,518 | 19,356,328 | 23,677,117 | private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {
try {
int id = 0;
String sql = "SELECT MAX(ID) as MAX_ID from CORE_USER_GROUPS";
PreparedStatement pStmt = Database.getMyConnection().prepareStatement(sql);
ResultSet rs = pStmt.executeQuery()... | public static void copyFile4(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
IOUtils.copy(in, out);
in.close();
out.close();
}
| false |
899,519 | 2,310,132 | 10,252,056 | public void open(final String method, final java.net.URL url, boolean asyncFlag, final String userName, final String password) throws java.io.IOException {
this.abort();
Proxy proxy = this.proxy;
URLConnection c = proxy == null || proxy == Proxy.NO_PROXY ? url.openConnection() : url.openConn... | public void updatePortletName(PortletName portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
String sql = "update WM_PORTAL_PORTLET_NAME " + "set TYPE=? " + "where ID_SITE_CTX_TYPE=?";
... | false |
899,520 | 7,396,679 | 3,287,812 | public static boolean copy(FileSystem srcFS, Path src, FileSystem dstFS, Path dst, boolean deleteSource, boolean overwrite, Configuration conf) throws IOException {
LOG.debug("[sgkim] copy - start");
dst = checkDest(src.getName(), dstFS, dst, overwrite);
if (srcFS.getFileStatus(src).isDir())... | private String getResourceAsString(final String name) throws IOException {
final InputStream is = JiBXTestCase.class.getResourceAsStream(name);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copyAndClose(is, baos);
return baos.toString();
}
| true |
899,521 | 16,167,361 | 17,831,556 | public long getMD5Hash(String str) {
MessageDigest m = null;
try {
m = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
m.update(str.getBytes(), 0, str.length());
return new BigInteger(1, m.dig... | public static String generateHash(String msg) throws NoSuchAlgorithmException {
if (msg == null) {
throw new IllegalArgumentException("Input string can not be null");
}
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(msg.getBytes());
... | true |
899,522 | 11,799,025 | 19,538,929 | @Override
public Document duplicate() {
BinaryDocument b = new BinaryDocument(this.name, this.content.getContentType());
try {
IOUtils.copy(this.getContent().getInputStream(), this.getContent().getOutputStream());
return b;
} catch (IOException e) {
th... | public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) {
File inputFile = new File(getInputFile());
File outputFile = new File(getOutputFile());
if (!getFileExtension(getInputFile()).equalsIgnoreCase(getFileExtension(getOutputFile())) || !getFileExtension(getInputFile())... | true |
899,523 | 13,631,834 | 9,265,781 | private static void loadProperties(Properties props, String res, boolean warnIfNotFound) throws IOException {
log.debug("Reading properties from resource " + res);
URL url = ResourceFileStorageFactory.class.getResource(res);
if (null == url) {
if (warnIfNotFound) {
... | 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,524 | 672,106 | 10,878,119 | 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 notifyIterationEnds(final IterationEndsEvent event) {
log.info("moving files...");
File source = new File("deqsim.log");
if (source.exists()) {
File destination = new File(Controler.getIterationFilename("deqsim.log"));
if (!IOUtils.renameFile(source, desti... | true |
899,525 | 10,778,361 | 17,671,343 | public void writeData(String name, int items, int mznum, int mzscale, long tstart, long tdelta, int[] peaks) {
PrintWriter file = getWriter(name + ".txt");
file.println("999 9999");
file.println("Doe, John");
file.println("TEST Lab");
if (mzscale == 1) file.println("PALMS Pos... | public void unzip(String zipFileName, String outputDirectory) throws Exception {
ZipInputStream in = new ZipInputStream(new FileInputStream(zipFileName));
ZipEntry z;
while ((z = in.getNextEntry()) != null) {
System.out.println("unziping " + z.getName());
if (z.isDire... | true |
899,526 | 16,553,581 | 7,529,744 | 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... | public Document retrieveDefinition(String uri) throws IOException, UnvalidResponseException {
if (!isADbPediaURI(uri)) throw new IllegalArgumentException("Not a DbPedia Resource URI");
String rawDataUri = fromResourceToRawDataUri(uri);
URL url = new URL(rawDataUri);
URLConnection con... | false |
899,527 | 19,963,744 | 14,190,765 | public void atualizarLivro(LivroBean livro) {
PreparedStatement pstmt = null;
String sql = "update livro " + "set " + "isbn = ?, " + "autor = ?, " + "editora = ?, " + "edicao = ?, " + "titulo = ? " + "where " + "isbn = ?";
try {
pstmt = connection.prepareStatement(sql);
... | private void _PostParser(Document document, AnnotationManager annoMan, Document htmldoc, String baseurl) {
xformer = annoMan.getTransformer();
builder = annoMan.getBuilder();
String annohash = "";
if (document == null) return;
NodeList ndlist = document.getElementsByTagNameNS... | false |
899,528 | 13,199,957 | 10,095,821 | private File copyFile(String fileInClassPath, String systemPath) throws Exception {
InputStream is = getClass().getResourceAsStream(fileInClassPath);
OutputStream os = new FileOutputStream(systemPath);
IOUtils.copy(is, os);
is.close();
os.close();
return new File(syst... | @Test(dependsOnMethods = { "getSize" })
public void download() throws IOException {
FileObject typica = fsManager.resolveFile("s3://" + bucketName + "/jonny.zip");
File localCache = File.createTempFile("vfs.", ".s3-test");
FileOutputStream out = new FileOutputStream(localCache);
... | true |
899,529 | 17,334,847 | 4,569,312 | private static MyCookieData parseCookie(Cookie cookie) throws CookieException {
String value = cookie.getValue();
System.out.println("original cookie: " + value);
value = value.replace("%3A", ":");
value = value.replace("%40", "@");
System.out.println("cookie after replacemen... | public static String getMD5(String s) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(s.toLowerCase().getBytes());
return HexString.bufferToHex(md5.digest());
} catch (NoSuchAlgorithmException e) {
System.err.println("Error gra... | true |
899,530 | 18,629,449 | 19,299,263 | private InputStream getSearchInputStream(String name) {
URL url = null;
try {
url = new URL(TheMovieDBXmlPullFeedParser.SEARCH_FEED_URL + URLEncoder.encode(name));
Log.d(Constants.LOG_TAG, "Movie search URL: " + url);
} catch (MalformedURLException e) {
th... | String extractTiffFile(String path) throws IOException {
ZipInputStream in = new ZipInputStream(new FileInputStream(path));
OutputStream out = new FileOutputStream(dir + TEMP_NAME);
byte[] buf = new byte[1024];
int len;
ZipEntry entry = in.getNextEntry();
if (entry ==... | false |
899,531 | 6,184,983 | 12,101,435 | @Override
public boolean copyFile(String srcRootPath, String srcDir, String srcFileName, String destRootPath, String destDir, String destFileName) {
File srcPath = new File(srcRootPath + separator() + Database.getDomainName() + separator() + srcDir);
if (!srcPath.exists()) {
try {
... | private void invokeTest(String queryfile, String target) {
try {
String query = IOUtils.toString(XPathMarkBenchmarkTest.class.getResourceAsStream(queryfile)).trim();
String args = EXEC_CMD + " \"" + query + "\" \"" + target + '"';
System.out.println("Invoke command: \n " ... | true |
899,532 | 22,422,244 | 13,547,845 | protected Source getStylesheetSource(Resource stylesheetLocation) throws ApplicationContextException {
if (logger.isDebugEnabled()) {
logger.debug("Loading XSLT stylesheet from " + stylesheetLocation);
}
try {
URL url = stylesheetLocation.getURL();
String ... | public static PortalConfig install(File xml, File dir) throws IOException, ConfigurationException {
if (!dir.exists()) {
log.info("Creating directory {}", dir);
dir.mkdirs();
}
if (!xml.exists()) {
log.info("Installing default configuration to {}", xml);
... | false |
899,533 | 22,742,292 | 21,090,887 | private static void initMagicRules() {
InputStream in = null;
try {
String fname = System.getProperty("magic-mime");
if (fname != null && fname.length() != 0) {
in = new FileInputStream(fname);
if (in != null) {
parse("-Dmag... | public static String digest(String ha1, String ha2, String nonce) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getBytes(ha1, ISO_8859_1));
md.update((byte) ':');
md.update(getBytes(nonce, ISO_8859_1));
md.update((byte) ':'... | false |
899,534 | 14,638,475 | 2,499,053 | public static String md5String(String string) {
try {
MessageDigest msgDigest = MessageDigest.getInstance("MD5");
msgDigest.update(string.getBytes("UTF-8"));
byte[] digest = msgDigest.digest();
String result = "";
for (int i = 0; i < digest.length;... | 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();
... | true |
899,535 | 15,982,225 | 7,300,257 | private static String getDigest(String srcStr, String alg) {
Assert.notNull(srcStr);
Assert.notNull(alg);
try {
MessageDigest alga = MessageDigest.getInstance(alg);
alga.update(srcStr.getBytes());
byte[] digesta = alga.digest();
return byte2hex... | public Message[] expunge() throws MessagingException {
Statement oStmt = null;
CallableStatement oCall = null;
PreparedStatement oUpdt = null;
ResultSet oRSet;
if (DebugFile.trace) {
DebugFile.writeln("Begin DBFolder.expunge()");
DebugFile.incIdent();
... | false |
899,536 | 5,090,669 | 10,671,994 | private static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel... | public static void copy(File src, File dst) {
try {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
... | true |
899,537 | 9,240,872 | 19,643,373 | 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 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,538 | 19,141,603 | 330,930 | public static String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
IOUtils.copy(url.openStream(), output);
return output.toString();
}
| 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 |
899,539 | 6,439,640 | 20,633,079 | public Properties load() {
Properties lvProperties = new Properties();
try {
InputStream lvInputStream = url.openStream();
lvProperties.load(lvInputStream);
} catch (Exception e) {
throw new PropertiesLoadException("Error in load-method:", e);
}
... | private String hashPassword(String password) {
if (password != null && password.trim().length() > 0) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.trim().getBytes());
BigInteger hash = new BigInteger(1, md5.diges... | false |
899,540 | 7,872,663 | 12,682,066 | private static boolean prepareQualifyingFile(String completePath, String outputFile) {
try {
File inFile = new File(completePath + fSep + "qualifying.txt");
FileChannel inC = new FileInputStream(inFile).getChannel();
BufferedReader br = new BufferedReader(new FileReader(i... | public static void decompressGZIP(File gzip, File to, long skip) throws IOException {
GZIPInputStream gis = null;
BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(new FileOutputStream(to));
FileInputStream fis = new FileInputStream(gzip);
... | true |
899,541 | 7,303,337 | 7,366,470 | public static void downloadJars(IProject project, String repositoryUrl, String jarDirectory, String[] jars) {
try {
File tmpFile = null;
for (String jar : jars) {
try {
tmpFile = File.createTempFile("tmpPlugin_", ".zip");
URL ur... | public RFC1345List(URL url) {
if (url == null) return;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(url.openStream())));
final String linePattern = " XX??????? HHHH X";
String line;
mnemos = new HashMap... | false |
899,542 | 3,850,809 | 12,994,590 | private void buildBundle() {
if (targetProject == null) {
MessageDialog.openError(getShell(), "Error", "No target SPAB project selected!");
return;
}
if (projectProcessDirSelector.getText().trim().length() == 0) {
MessageDialog.openError(getShell(), "Error... | @HttpAction(name = "map.saveOrUpdate", method = { HttpAction.Method.post }, responseType = "text/plain")
@HttpAuthentication(method = { HttpAuthentication.Method.WSSE })
public String saveOrUpdate(FileItem file, User user, MapOriginal map) throws HttpRpcException {
File tmpFile;
GenericDAO<M... | true |
899,543 | 17,067,833 | 21,781,575 | private void copyResourceToDir(String ondexDir, String resource) {
InputStream inputStream = OndexGraphImpl.class.getClassLoader().getResourceAsStream(resource);
try {
FileWriter fileWriter = new FileWriter(new File(ondexDir, resource));
IOUtils.copy(inputStream, fileWriter);... | private String loadSchemas() {
StringWriter writer = new StringWriter();
try {
IOUtils.copy(CoreOdfValidator.class.getResourceAsStream("schema_list.properties"), writer);
} catch (IOException e) {
e.printStackTrace();
}
return writer.toString();
}
| true |
899,544 | 11,910,132 | 5,674,869 | private static byte[] calcMd5(String pass) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(pass.getBytes(), 0, pass.length());
byte[] hash = digest.digest();
return hash;
} catch (NoSuchAlgorithmException e)... | public static String getHash(String text) {
if (text == null) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
byte[] hashedTextBytes = md.digest();
BigInteger hashedTextBigInteger = new BigInteger(1, ... | true |
899,545 | 1,760,355 | 20,169,230 | public static int deleteHedgeCustTrade() {
Connection conn = null;
PreparedStatement psmt = null;
StringBuffer SQL = new StringBuffer(200);
int deleted = 0;
SQL.append(" DELETE FROM JHF_HEDGE_CUSTTRADE ");
try {
conn = JdbcConnectionPool.mainConnection();
... | @Override
public String addUserIdentity(OpenIDItem identity, long userId) throws DatabaseException {
if (identity == null) throw new NullPointerException("identity");
if (identity.getIdentity() == null || "".equals(identity.getIdentity())) throw new NullPointerException("identity.getIdentity()")... | true |
899,546 | 87,685 | 16,899,717 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | public static String loadURLToString(String url, String EOL) throws FileNotFoundException, IOException {
BufferedReader in = new BufferedReader(new InputStreamReader((new URL(url)).openStream()));
String result = "";
String str;
while ((str = in.readLine()) != null) {
res... | true |
899,547 | 15,577,716 | 5,350,703 | public void setUp() throws Exception {
logger.finer("******************** set up ********************");
Properties props;
if (XMLDBTestSuite.propertiesFileName == null) {
String defaultPropsFileLocation = "test/xmldb/XMLDBTestSuite.properties";
URL url = this.getClas... | public static void readUrlWriteFileTest(String url, String fileName) throws Exception {
System.out.println("Initiated reading source queue URL: " + url);
InputStream instream = new URL(url).openStream();
Serializer serializer = new Serializer();
Response response = (Response) seriali... | false |
899,548 | 601,908 | 1,421,558 | 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 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,549 | 5,450,104 | 10,140,251 | private static void grab(String urlString) throws MalformedURLException, IOException {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = null;
StringBuffer sb = new StringBuffer();
in =... | protected String contentString() {
String result = null;
URL url;
String encoding = null;
try {
url = url();
URLConnection connection = url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(false);
connec... | true |
899,550 | 1,775,942 | 21,369,761 | @Override
public void run() {
HttpGet httpGet = null;
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
DataModel model = DataModel.getInstance();
for (City city : citiesToBeUpdated) {
String preferredUnitType = PreferenceManager.ge... | protected void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | false |
899,551 | 10,301,544 | 8,859,873 | public static Set<Class<?>> getClasses(String pack) {
Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
boolean recursive = true;
String packageName = pack;
String packageDirName = packageName.replace('.', '/');
Enumeration<URL> dirs;
try {
dirs = Thr... | private void mergeOne(String level, char strand, String filename, Path outPath, FileSystem srcFS, FileSystem dstFS, Timer to) throws IOException {
to.start();
final OutputStream outs = dstFS.create(new Path(outPath, filename));
final FileStatus[] parts = srcFS.globStatus(new Path(sorted ? ge... | false |
899,552 | 22,517,711 | 6,614,947 | private static void ftpTest() {
FTPClient f = new FTPClient();
try {
f.connect("oscomak.net");
System.out.print(f.getReplyString());
f.setFileType(FTPClient.BINARY_FILE_TYPE);
} catch (SocketException e) {
e.printStackTrace();
} catch (... | public static String getPageSource(String url) throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
InputStream in = response.getEntity().getContent();
B... | false |
899,553 | 5,677,926 | 14,317,426 | public static void copyFile(File source, File destination) throws IOException {
FileInputStream fis = new FileInputStream(source);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(destination);
FileChannel sourceChannel = fis.getChannel();
Fil... | 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,554 | 10,824,317 | 3,011,295 | public static void copyFile(File from, File to) throws Exception {
if (!from.exists()) return;
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
byte[] buffer = new byte[8192];
int bytes_read;
while (true) {
b... | public static void main(String args[]) throws IOException, TrimmerException, DataStoreException {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("ace", "path to ace file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("phd", "path ... | true |
899,555 | 15,535,344 | 20,407,275 | 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... | @NotNull
private Properties loadProperties() {
File file = new File(homeLocator.getHomeDir(), configFilename);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
throw new RuntimeException("IOException while creatin... | false |
899,556 | 1,856,912 | 16,948,799 | public static boolean predictDataSet(String completePath, String Type, String predictionOutputFileName, String CFDataFolderName) {
try {
if (Type.equalsIgnoreCase("Qualifying")) {
File inputFile = new File(completePath + fSep + "SmartGRAPE" + fSep + "CompleteQualifyingDataInByteF... | public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
if (!dest.exists() || (dest.exists() && overwrite)) {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(d... | true |
899,557 | 2,769,195 | 6,403,884 | public int procesar() {
int mas = 0;
String uriOntologia = "", source = "", uri = "";
String fichOrigenHTML = "", fichOrigenLN = "";
String ficheroOutOWL = "";
md5 firma = null;
StringTokenV2 entra = null, entra2 = null, entra3 = null;
FileInputStream lengNat ... | private boolean copyOldSetupClass(File lastVerPath, File destPath) throws java.io.FileNotFoundException, IOException {
byte[] buf;
File oldClass = new File(lastVerPath.getAbsolutePath() + File.separator + installClassName_ + ".class");
if (oldClass.exists()) {
FileOutputStream ou... | true |
899,558 | 17,713,680 | 7,398,604 | public static void main(String[] args) {
if (args.length != 3) {
System.out.println("Usage: HexStrToBin enc/dec <infileName> <outfilename>");
System.exit(1);
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream in = new F... | @Override
public Collection<IAuthor> doImport() throws Exception {
progress.initialize(2, "Ściągam autorów amerykańskich");
String url = "http://pl.wikipedia.org/wiki/Kategoria:Ameryka%C5%84scy_autorzy_fantastyki";
UrlResource resource = new UrlResource(url);
InputStream urlInput... | true |
899,559 | 11,290,317 | 22,919,520 | private void trainSRLParser(byte flag, JarArchiveOutputStream zout) throws Exception {
AbstractSRLParser labeler = null;
AbstractDecoder[] decoder = null;
if (flag == SRLParser.FLAG_TRAIN_LEXICON) {
System.out.println("\n* Save lexica");
labeler = new SRLParser(flag, ... | public static void copyFile(String sourceFilePath, String destFilePath) throws IOException {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(sourceFilePath).getChannel();
out = new FileOutputStream(destFilePath).getChannel();
... | true |
899,560 | 860,848 | 23,677,120 | 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 unzip1(File zipfile, File outputdir) throws IOException {
//Buffer for copying the files out of the zip input stream
byte[] buffer = new byte[1024];
//Create parent output directory if it doesn't exist
if(!outputdir.exists()) {
outputdir.mkdirs();
}
//Create the zip input st... | false |
899,561 | 2,090,332 | 3,287,812 | private void doProcess(HttpServletRequest request, HttpServletResponse resp) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
Analyzer analyzer = new Analyzer();
ServletContext context = getServletContext();
String xml = context.getRe... | private String getResourceAsString(final String name) throws IOException {
final InputStream is = JiBXTestCase.class.getResourceAsStream(name);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copyAndClose(is, baos);
return baos.toString();
}
| true |
899,562 | 14,440,431 | 22,915,885 | public static String generateHash(final String sText, final String sAlgo) throws NoSuchAlgorithmException {
final MessageDigest md = MessageDigest.getInstance(sAlgo);
md.update(sText.getBytes());
final Formatter formatter = new Formatter();
for (final Byte curByte : md.digest()) form... | public Login authenticateClient() {
Object o;
String user, password;
Vector<Login> clientLogins = ClientLoginsTableModel.getClientLogins();
Login login = null;
try {
socket.setSoTimeout(25000);
objectOut.writeObject("JFRITZ SERVER 1.1");
ob... | true |
899,563 | 9,481,276 | 950,938 | public void save(InputStream is) throws IOException {
File dest = Config.getDataFile(getInternalDate(), getPhysMessageID());
OutputStream os = null;
try {
os = new FileOutputStream(dest);
IOUtils.copyLarge(is, os);
} finally {
IOUtils.closeQuietly(... | 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,564 | 8,258,909 | 20,287,675 | public static void copyFile(File sourceFile, File destFile) {
FileChannel source = null;
FileChannel destination = null;
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
source = new FileInputStream(sourceFile).getChannel();
... | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pathInfo = request.getPathInfo();
getLog().info("Process request " + pathInfo);
if (null != pathInfo) {
String pathId = getPathId(pathInfo);
J... | true |
899,565 | 3,224,152 | 5,389,524 | private String transferWSDL(String usernameAndPassword) throws WiseConnectionException {
String filePath = null;
try {
URL endpoint = new URL(wsdlURL);
HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
conn.setDoOutput(false);
con... | public ActualTask(TEditor editor, TIGDataBase dataBase, String directoryPath) {
File myDirectory = new File(directoryPath);
String[] list = myDirectory.list();
int i;
for (i = 0; ((i < list.length) && !stop); i++) {
current = i;
if ... | true |
899,566 | 18,194,344 | 14,843,540 | public void setPassword(String plaintext) throws java.security.NoSuchAlgorithmException {
StringBuffer encrypted = new StringBuffer();
java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(plaintext.getBytes());
byte[] digestArray = digest... | @Test
public void shouldDownloadFileUsingPublicLink() throws Exception {
String bucketName = "test-" + UUID.randomUUID();
Service service = new WebClientService(credentials);
service.createBucket(bucketName);
File file = folder.newFile("foo.txt");
FileUtils.writeStringToF... | false |
899,567 | 21,919,199 | 316,912 | private Datastream addManagedDatastreamVersion(Entry entry) throws StreamIOException, ObjectIntegrityException {
Datastream ds = new DatastreamManagedContent();
setDSCommonProperties(ds, entry);
ds.DSLocationType = "INTERNAL_ID";
ds.DSMIME = getDSMimeType(entry);
IRI contentL... | 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 |
899,568 | 3,109,682 | 20,826,358 | @SmallTest
public void testSha1() throws Exception {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
int numTests = mTestData.length;
for (int i = 0; i < numTests; i++) {
digest.update(mTestData[i].input.getBytes());
byte[] hash = digest.digest();
... | public String generateDigest(String password, String saltHex, String algorithm) throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase("crypt")) {
return "{CRYPT}" + UnixCrypt.crypt(password);
} else if (algorithm.equalsIgnoreCase("sha")) {
algorithm = "SHA-1";
... | true |
899,569 | 23,179,136 | 8,232,814 | private void doLogin(String password) throws LoginFailedException, IncorrectPasswordException {
final long mgr = Constants.MANAGER;
Data data, response;
try {
response = sendAndWait(new Request(mgr)).get(0);
MessageDigest md;
try {
md = Mes... | public ChatClient registerPlayer(int playerId, String playerLogin) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.reset();
md.update(playerLogin.getBytes("UTF-8"), 0, playerLogin.length());
byte[] accountTok... | true |
899,570 | 14,711,051 | 5,706,224 | public static void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | public void run() {
try {
File outDir = new File(outDirTextField.getText());
if (!outDir.exists()) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(... | true |
899,571 | 14,481,927 | 13,325,917 | public static String move_tags(String sessionid, String absolutePathForTheMovedTags, String absolutePathForTheDestinationTag) {
String resultJsonString = "some problem existed inside the create_new_tag() function if you see this string";
try {
Log.d("current running function name:", "mov... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getCanonicalPath());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getCanonicalP... | false |
899,572 | 20,805,582 | 20,081,740 | public void copyFile(File s, File t) {
try {
FileChannel in = (new FileInputStream(s)).getChannel();
FileChannel out = (new FileOutputStream(t)).getChannel();
in.transferTo(0, s.length(), out);
in.close();
out.close();
} catch (Exception e)... | public static void main(String[] args) throws Exception {
if (args.length < 3) {
usage(System.out);
System.exit(1);
}
final File tmpFile = File.createTempFile("sej", null);
tmpFile.deleteOnExit();
final FileOutputStream destination = new FileOutputStre... | true |
899,573 | 20,180,801 | 1,725,724 | public static byte[] readUrl(URL url) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream is = url.openStream();
try {
IOUtils.copy(is, os);
return os.toByteArray();
} finally {
is.close();
}
}
| public static boolean nioWriteFile(FileInputStream inputStream, FileOutputStream out) {
if (inputStream == null && out == null) {
return false;
}
try {
FileChannel fci = inputStream.getChannel();
FileChannel fco = out.getChannel();
fco.transfer... | true |
899,574 | 10,941,155 | 11,130,567 | private void detachFile(File file, Block b) throws IOException {
File tmpFile = volume.createDetachFile(b, file.getName());
try {
IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16 * 1024, true);
if (file.length() != tmpFile.length()) {
... | 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... | true |
899,575 | 6,544,682 | 15,311,521 | private String getXML(String url) throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url);
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
BufferedReader in = ... | public String buscaCDA() {
Properties prop = new CargaProperties().Carga();
URL url;
BufferedReader in;
String inputLine;
String miLinea = null;
try {
url = new URL(prop.getProperty("CDA"));
in = new BufferedReader(new InputStreamReader(url.ope... | true |
899,576 | 21,374,041 | 7,885,446 | public void writeToStream(OutputStream out) throws IOException {
InputStream result = null;
if (tempFile != null) {
InputStream input = new BufferedInputStream(new FileInputStream(tempFile));
IOUtils.copy(input, out);
IOUtils.closeQuietly(input);
} else if... | 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... | true |
899,577 | 5,807,569 | 14,341,904 | @RequestMapping("/import")
public String importPicture(@ModelAttribute PictureImportCommand command) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
URL url = command.getUrl();
IOUtils.copy(url.openStream(), baos);
byte[] imageData = imageFilterServ... | private static void copyFile(String from, String to) throws IOException {
FileReader in = new FileReader(from);
FileWriter out = new FileWriter(to);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| true |
899,578 | 1,124,190 | 6,853,666 | private SystemProperties() {
Properties p = new Properties();
ClassLoader classLoader = getClass().getClassLoader();
try {
URL url = classLoader.getResource("system.properties");
if (url != null) {
InputStream is = url.openStream();
p.l... | public static void sendPostRequest() {
String data = "text=Eschirichia coli";
try {
URL url = new URL("http://taxonfinder.ubio.org/analyze?");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStre... | false |
899,579 | 814,473 | 5,567,860 | 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 String getClass(EmeraldjbBean eb) throws EmeraldjbException {
Entity entity = (Entity) eb;
StringBuffer sb = new StringBuffer();
String myPackage = getPackageName(eb);
sb.append("package " + myPackage + ";\n");
sb.append("\n");
DaoValuesGenerator valgen = new D... | true |
899,580 | 16,981,230 | 3,934,146 | public static String encrypt(final String password, final String algorithm, final byte[] salt) {
final StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented"... | public static String digest(String algorithm, String text) {
MessageDigest mDigest = null;
try {
mDigest = MessageDigest.getInstance(algorithm);
mDigest.update(text.getBytes(ENCODING));
} catch (Exception e) {
e.printStackTrace();
mDigest = nul... | true |
899,581 | 3,058,819 | 691,247 | public static void decryptFile(String input, String output, String pwd) throws Exception {
CipherInputStream in;
OutputStream out;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(pwd.getBytes(), "DES... | 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 |
899,582 | 18,030,152 | 5,378,327 | public static boolean copyFile(File from, File tu) {
final int BUFFER_SIZE = 4096;
byte[] buffer = new byte[BUFFER_SIZE];
try {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(tu);
int read;
while ((r... | public static synchronized Map<String, Object> getURLContentMap(String wwwurl) throws IOException, URISyntaxException {
Map<String, Object> resultMap = new HashMap<String, Object>();
URI uri = new URI(wwwurl);
URL url = new URL(uri.toASCIIString());
HttpURLConnection conn = (HttpURLC... | false |
899,583 | 20,970,925 | 5,371,059 | public static final String convertPassword(final String srcPwd) {
StringBuilder out;
MessageDigest md;
byte[] byteValues;
byte singleChar = 0;
try {
md = MessageDigest.getInstance("MD5");
md.update(srcPwd.getBytes());
byteValues = md.digest... | public static String digest(String value, String algorithm) throws Exception {
MessageDigest algo = MessageDigest.getInstance(algorithm);
algo.reset();
algo.update(value.getBytes("UTF-8"));
return StringTool.byteArrayToString(algo.digest());
}
| true |
899,584 | 181,591 | 6,980,854 | 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 copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in... | true |
899,585 | 3,153,908 | 15,346,427 | public boolean connentServer() {
boolean result = false;
try {
ftpClient = new FTPClient();
ftpClient.setDefaultPort(port);
ftpClient.setControlEncoding("GBK");
strOut = strOut + "Connecting to host " + host + "\r\n";
ftpClient.connect(host... | private ArrayList loadResults(String text, String index, int from) {
loadingMore = true;
JSONObject job = new JSONObject();
ArrayList al = new ArrayList();
try {
String req = job.put("OperationId", "2").toString();
InputStream is = null;
String res... | false |
899,586 | 3,670,410 | 23,124,633 | 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 void saveFile(Folder folder, Object key, InputStream stream) throws FileManagerException {
File file = new File(folder, key.toString());
LOGGER.debug("Writing file: " + file.getAbsolutePath());
Writer writer = null;
Writer encodedWriter = null;
try {
encod... | true |
899,587 | 14,469,218 | 20,654,481 | public static boolean copyFileToContentFolder(String source, LearningDesign learningDesign) {
File inputFile = new File(source);
File outputFile = new File(getRootFilePath(learningDesign) + inputFile.getName());
FileReader in;
try {
in = new FileReader(inputFile);
... | private ParserFileReader createParserFileReader(final FromNetRecord record) throws IOException {
final String strUrl = record.getStrUrl();
ParserFileReader parserFileReader;
try {
parserFileReader = parserFileReaderFactory.create(strUrl);
} catch (Exception exception) {
... | true |
899,588 | 4,758,044 | 17,956,015 | private static void readServicesFromUrl(Collection<String> list, URL url) throws IOException {
InputStream in = url.openStream();
try {
if (in == null) return;
BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
while (true) {
... | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/jar");
byte[] bufor = new byte[BUF_LEN];
ServletContext context = getServletContext();
URL url = context.getResource(FILE_NAME);... | false |
899,589 | 112,491 | 17,097,179 | 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 sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
899,590 | 23,407,527 | 7,460,229 | protected void downgradeHistory(Collection<String> versions) {
Assert.notEmpty(versions);
try {
Connection connection = this.database.getDefaultConnection();
PreparedStatement statement = connection.prepareStatement("UPDATE " + this.logTableName + " SET RESULT = 'DOWNGRADED' ... | private long getNextHighValue() throws Exception {
Connection con = null;
PreparedStatement psGetHighValue = null;
PreparedStatement psUpdateHighValue = null;
ResultSet rs = null;
long high = -1L;
int isolation = -1;
DBOperation... | true |
899,591 | 16,270,977 | 4,932,274 | public Scene load(URL url) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException {
BufferedReader reader;
if (baseUrl == null) setBaseUrlFromUrl(url);
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (IOException ... | public void testCommitRollback() throws Exception {
Statement stmt = con.createStatement();
assertNotNull(stmt);
assertTrue(con.getAutoCommit());
stmt.execute("CREATE TABLE #TESTCOMMIT (id int primary key)");
con.setAutoCommit(false);
assertFalse(con.getAutoCommit());... | false |
899,592 | 20,587,078 | 21,907,699 | 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... | public void getFile(OutputStream output, Fragment fragment) throws Exception {
Assert.Arg.notNull(output, "output");
Assert.Arg.notNull(fragment, "fragment");
Assert.Arg.notNull(fragment.getId(), "fragment.getId()");
if (this.delegate != null) {
this.delegate.getFile(outp... | true |
899,593 | 5,031,964 | 16,238,515 | public static String md5(String text) {
String encrypted = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
encrypted = hex(md.digest());
} catch (NoSuchAlgorithmException nsaEx) {
}
return encrypte... | public void register(URL codeBase, String filePath) throws Exception {
Properties properties = new Properties();
URL url = new URL(codeBase + filePath);
properties.load(url.openStream());
initializeContext(codeBase, properties);
}
| false |
899,594 | 303,331 | 10,941,155 | 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 detachFile(File file, Block b) throws IOException {
File tmpFile = volume.createDetachFile(b, file.getName());
try {
IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16 * 1024, true);
if (file.length() != tmpFile.length()) {
... | true |
899,595 | 22,544,688 | 536,114 | @Override
protected RequestLogHandler createRequestLogHandler() {
try {
File logbackConf = File.createTempFile("logback-access", ".xml");
IOUtils.copy(Thread.currentThread().getContextClassLoader().getResourceAsStream("logback-access.xml"), new FileOutputStream(logbackConf));
... | 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,596 | 4,341,090 | 8,043,217 | public Object run() {
if (type == GET_THEME_DIR) {
String sep = File.separator;
String[] dirs = new String[] { userHome + sep + ".themes", System.getProperty("swing.metacitythemedir"), "/usr/share/themes", "/usr/gnome/share/themes", "/opt/gnome2/share/themes" };
... | public static Image getImage(URL url) throws IOException {
InputStream is = null;
try {
is = url.openStream();
Image img = getImage(is);
img.setUrl(url);
return img;
} finally {
if (is != null) {
is.close();
... | false |
899,597 | 23,641,084 | 557,726 | @Override
public void run() {
EventType type = event.getEventType();
IBaseObject field = event.getField();
log.info("select----->" + field.getAttribute(IDatafield.URL));
try {
IParent parent = field.getParent();
String name = field.getName();
i... | public void extractPrincipalClasses(String[] info, int numFiles) {
String methodName = "";
String finalClass = "";
String WA;
String MC;
String RA;
int[] readCount = new int[numFiles];
int[] writeCount = new int[numFiles];
int[] methodCallCount = new i... | true |
899,598 | 7,704,001 | 11,998,193 | public void deleteGroupInstruction(int id, int rank) throws FidoDatabaseException, InstructionNotFoundException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit... | private static void executeSQLScript() {
File f = new File(System.getProperty("user.dir") + "/resources/umc.sql");
if (f.exists()) {
Connection con = null;
PreparedStatement pre_stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c... | true |
899,599 | 17,147,420 | 3,410,039 | public final String latestVersion() {
String latestVersion = "";
try {
URL url = new URL(Constants.officialSite + ":80/LatestVersion");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLi... | public void fillTableValues() {
java.util.ArrayList cpool = newgen.presentation.NewGenMain.getAppletInstance().getCataloguingPool();
String xmlreq = AdministrationXMLGenerator.getInstance().getPoolChronologicalSubDivision("4", cpool);
System.out.println(xmlreq);
try {
jav... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.