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 |
|---|---|---|---|---|---|
900,200 | 3,008,655 | 10,824,317 | public static void copyFile(File srcFile, File desFile) throws IOException {
AssertUtility.notNull(srcFile);
AssertUtility.notNull(desFile);
FileInputStream fis = new FileInputStream(srcFile);
FileOutputStream fos = new FileOutputStream(desFile);
try {
FileChannel... | 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... | true |
900,201 | 2,310,752 | 11,088,622 | public static void copy(final String source, final String dest) {
final File s = new File(source);
final File w = new File(dest);
try {
final FileInputStream in = new FileInputStream(s);
final FileOutputStream out = new FileOutputStream(w);
int c;
... | public static void copyFile(File sourceFile, File destFile) throws IOException {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(sourceFile);
os = new FileOutputStream(destFile);
IOUtils.copy(is, os);
} finally {
... | true |
900,202 | 3,054,600 | 17,874,921 | 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 boolean buildCFItem2ItemStats(String outFileName, String movieAvgFileName, String custAvgFileName) {
try {
File infile = new File(completePath + fSep + "SmartGRAPE" + fSep + movieAvgFileName);
FileChannel inC = new FileInputStream(infile).getChannel();
int s... | true |
900,203 | 291,167 | 14,417,449 | 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]... | public static void compressAll(File dir, File file) throws IOException {
if (!dir.isDirectory()) throw new IllegalArgumentException("Given file is no directory");
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file));
out.setLevel(0);
String[] entries = dir.list();
... | true |
900,204 | 14,484,136 | 83,802 | public void copyJarContent(File jarPath, File targetDir) throws IOException {
log.info("Copying natives from " + jarPath.getName());
JarFile jar = new JarFile(jarPath);
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry file = entr... | private void doTask() {
try {
log("\n\n\n\n\n\n\n\n\n");
log(" =================================================");
log(" = Starting PSCafePOS =");
log(" =================================================");
log(" = An o... | true |
900,205 | 924,033 | 7,825,861 | public static void main(String[] args) throws Exception {
InputStream in = null;
try {
in = new URL(args[0]).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
} finally {
IOUtils.closeStream(in);
}
}
| @Override
public void run() {
while (true) {
StringBuilder buffer = new StringBuilder(128);
buffer.append("insert into DOMAIN ( ").append(LS);
buffer.append(" DOMAIN_ID,... | false |
900,206 | 11,776,522 | 5,438,231 | protected File getFile(NameCategory category) throws IOException {
File home = new File(System.getProperty("user.dir"));
String fileName = String.format("%s.txt", category);
File file = new File(home, fileName);
if (file.exists()) {
return file;
} else {
... | public int extract() throws Exception {
int count = 0;
if (VERBOSE) System.out.println("IAAE:Extractr.extract: getting ready to extract " + getArtDir().toString());
ITCFileFilter iff = new ITCFileFilter();
RecursiveFileIterator rfi = new RecursiveFileIterator(getArtDir(), iff);
... | true |
900,207 | 1,642,489 | 17,905,171 | public void testAddFiles() throws Exception {
File original = ZipPlugin.getFileInPlugin(new Path("testresources/test.zip"));
File copy = new File(original.getParentFile(), "1test.zip");
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream... | public static InputStream getResourceAsStream(String resourceName, Class callingClass) {
URL url = getResource(resourceName, callingClass);
try {
return (url != null) ? url.openStream() : null;
} catch (IOException e) {
return null;
}
}
| false |
900,208 | 16,064,530 | 5,389,524 | private void bubbleSort() {
for (int i = 0; i < testfield.length; i++) {
for (int j = 0; j < testfield.length - i - 1; j++) if (testfield[j] > testfield[j + 1]) {
short temp = testfield[j];
testfield[j] = testfield[j + 1];
testfield[j + 1] = temp;
... | 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 ... | false |
900,209 | 9,627,687 | 813,588 | private boolean isReservaOK(String urlAddress, String operationId, String idioma, String codigo_pedido, String merchantId) throws ServletException {
StringBuffer buf = new StringBuffer();
try {
URL url = new URL(urlAddress + "?Num_operacion=" + operationId + "&Idioma=" + idioma + "&Codig... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
900,210 | 14,287,646 | 1,172,494 | private String getStoreName() {
try {
final MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(protectionDomain.getBytes());
final byte[] bs = digest.digest();
final StringBuffer sb = new StringBuffer(bs.length * 2);
for (int i ... | public static String encrypt(String input) {
try {
MessageDigest md = MessageDigest.getInstance("SHA1");
md.update(input.getBytes("UTF-8"));
return toHexString(md.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (U... | true |
900,211 | 2,012,592 | 20,493,053 | private void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException {
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
return;
}
File outputFile = new File(outputDir, entry.getName());
if (!outputFile.getParen... | 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.... | true |
900,212 | 6,948,655 | 18,396,375 | public static void main(String[] args) throws IOException {
File fileIn = new File("D:\\zz_c\\study2\\src\\study\\io\\A.java");
InputStream fin = new FileInputStream(fileIn);
PipedInputStream pin = new PipedInputStream();
PipedOutputStream pout = new PipedOutputStream();
pout... | public static String hash(String plaintext) {
if (plaintext == null) {
return "";
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
md.update(plaintext.getBytes("UTF-8"));
} catch (Exception e) {
}
ret... | false |
900,213 | 6,270,867 | 17,874,921 | public static String md5Encrypt(final String txt) {
String enTxt = txt;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.error("Error:", e);
}
if (null != md) {
byte... | public static boolean buildCFItem2ItemStats(String outFileName, String movieAvgFileName, String custAvgFileName) {
try {
File infile = new File(completePath + fSep + "SmartGRAPE" + fSep + movieAvgFileName);
FileChannel inC = new FileInputStream(infile).getChannel();
int s... | false |
900,214 | 569,033 | 14,847,921 | 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 {
... | protected static void copyFile(File from, File to) throws IOException {
if (!from.isFile() || !to.isFile()) {
throw new IOException("Both parameters must be files. from is " + from.isFile() + ", to is " + to.isFile());
}
FileChannel in = (new FileInputStream(from)).getChannel();
... | false |
900,215 | 4,525,216 | 21,057,438 | private static void backupFile(File file) {
FileChannel in = null, out = null;
try {
if (!file.getName().endsWith(".bak")) {
in = new FileInputStream(file).getChannel();
out = new FileOutputStream(new File(file.toString() + ".bak")).getChannel();
... | public void run() {
try {
Socket socket = getSocket();
System.out.println("opening socket to " + address + " on " + port);
InputStream in = socket.getInputStream();
for (; ; ) {
FileTransferHeader header = FileTransferHeader.readHeader(in);
... | true |
900,216 | 17,530,413 | 11,346,792 | protected void serveStaticContent(HttpServletRequest request, HttpServletResponse response, String pathInfo) throws ServletException {
InputStream is = servletConfig.getServletContext().getResourceAsStream(pathInfo);
if (is == null) {
throw new ServletException("Static resource " + pathI... | public void generate(FileObject outputDirectory, FileObject generatedOutputDirectory, List<Library> libraryModels, String tapdocXml) throws FileSystemException {
if (!generatedOutputDirectory.exists()) {
generatedOutputDirectory.createFolder();
}
if (outputDirectory.exists()) {
... | true |
900,217 | 19,322,947 | 13,946,708 | @Test
public void test_lookupType_FullSearch_TwoWords() throws Exception {
URL url = new URL(baseUrl + "/lookupType/deep+core");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "a... | @Override
public String encryptPassword(String password) throws JetspeedSecurityException {
if (securePasswords == false) {
return password;
}
if (password == null) {
return null;
}
try {
if ("SHA-512".equals(passwordsAlgorithm)) {
... | false |
900,218 | 17,586,130 | 2,911,006 | protected N save(String sql, Object[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
pstmt = conn.prepareStatement(sql, Statement.RETURN_GENERA... | protected String encrypt(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
... | false |
900,219 | 765,071 | 5,985,718 | public static void testString(String string, String expected) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(string.getBytes(), 0, string.length());
String result = toString(md.digest());
System.out.println(expected);... | private String fetchLocalPage(String page) throws IOException {
final String fullUrl = HOST + page;
LOG.debug("Fetching local page: " + fullUrl);
URL url = new URL(fullUrl);
URLConnection connection = url.openConnection();
StringBuilder sb = new StringBuilder();
Buffe... | false |
900,220 | 10,816,804 | 10,247,943 | public static String md5(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException {
StringBuffer result = new StringBuffer();
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input.getBytes("utf-8"));
byte[] digest = md.digest();
for (byte b :... | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException, BadRequestException {
try {
if (vtf == null) {
LOG.debug("Serializing from database");
existDocument.st... | false |
900,221 | 11,305,839 | 550,697 | public boolean setCliente(int IDcliente, String nombre, String paterno, String materno, String ocupacion, String rfc) {
boolean inserto = false;
try {
stm = conexion.prepareStatement("insert into clientes values( '" + IDcliente + "' , '" + nombre.toUpperCase() + "' , '" + paterno.toUpper... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | false |
900,222 | 12,312,915 | 13,893,663 | public static void entering(String[] args) throws IOException, CodeCheckException {
ClassWriter writer = new ClassWriter();
writer.readClass(new BufferedInputStream(new FileInputStream(args[0])));
int constantIndex = writer.getStringConstantIndex("Entering ");
int fieldRefIndex = wri... | public static int executeNoQuery(String strStatement) throws SQLException {
MyDBConnection myc = new MyDBConnection();
myc.init();
Statement statement = myc.getMyConnection().createStatement();
try {
int rows = statement.executeUpdate(strStatement);
myc.myConn... | false |
900,223 | 23,537,684 | 665,978 | public static void copyResourceToFile(Class owningClass, String resourceName, File destinationDir) {
final byte[] resourceBytes = readResource(owningClass, resourceName);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(resourceBytes);
final File destinationFile = new File(d... | 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 |
900,224 | 10,161,744 | 831,649 | private void checkSites() {
Log.d(LOG_TAG, "Updating sites: " + sitesToCheck.keySet().toString());
for (Map.Entry<Site, Item> entry : sitesToCheck.entrySet()) {
final Site site = entry.getKey();
final Item oldItem = entry.getValue();
try {
... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | false |
900,225 | 18,741,084 | 8,596,528 | 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(... | @Override
public DaeScene loadScene(URL url) throws IOException, IncorrectFormatException, ParsingErrorException {
NullArgumentException.check(url);
boolean baseURLWasNull = setBaseURLFromModelURL(url);
DaeScene scene = loadScene(url.openStream());
if (baseURLWasNull) {
... | false |
900,226 | 12,197,342 | 3,246,556 | public void mousePressed(MouseEvent e) {
bannerLbl.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
HttpContext context = new BasicHttpContext();
context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
HttpGet method = new HttpGet(bannerURL);
... | public static void copyFile(File source, String target) throws FileNotFoundException, IOException {
File fout = new File(target);
fout.mkdirs();
fout.delete();
fout = new File(target);
FileChannel in = new FileInputStream(source).getChannel();
FileChannel out = new Fi... | false |
900,227 | 10,055,931 | 21,461,878 | private static Vector<String> getIgnoreList() {
try {
URL url = DeclarationTranslation.class.getClassLoader().getResource("ignorelist");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
Vector<String> ret = new Vector<String>();... | private boolean verifyAppId(String appid) {
try {
String urlstr = "http://" + appid + ".appspot.com";
URL url = new URL(urlstr);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
... | true |
900,228 | 9,733,447 | 420,619 | public static void unzipFile(File zipFile, File destFile, boolean removeSrcFile) throws Exception {
ZipInputStream zipinputstream = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry zipentry = zipinputstream.getNextEntry();
int BUFFER_SIZE = 4096;
while (zipentry != null) {
... | 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 |
900,229 | 8,139,665 | 22,223,563 | public ActionResponse executeAction(ActionRequest request) throws Exception {
BufferedReader in = null;
try {
CurrencyEntityManager em = new CurrencyEntityManager();
String id = (String) request.getProperty("ID");
CurrencyMonitor cm = getCurrencyMonitor(em, Long.v... | private String read(URL url) throws IOException {
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer text = new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
... | true |
900,230 | 7,366,470 | 3,694,549 | 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... | private File getTestFile() {
final URL url = TestCrueLOG.class.getResource(FICHIER_TEST_XML);
final File ctfaFile = new File(createTempDir(), "resultat.rtfa.xml");
try {
CtuluLibFile.copyStream(url.openStream(), new FileOutputStream(ctfaFile), true, true);
} catch (Except... | false |
900,231 | 21,870,536 | 6,190,163 | 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 void xtest7() throws Exception {
System.out.println("Lowagie");
FileInputStream inputStream = new FileInputStream("C:/Temp/arquivo.pdf");
PDFBoxManager manager = new PDFBoxManager();
InputStream[] images = manager.toImage(inputStream, "jpeg");
int count = 0;
fo... | true |
900,232 | 10,499,553 | 10,228,411 | private static InputStream connect(final String url) throws IOException {
InputStream in = null;
try {
final URLConnection conn = new URL(url).openConnection();
conn.setConnectTimeout(YahooGeocoding.connectTimeOut);
conn.setReadTimeout(YahooGeocoding.readTimeOut);... | public File createReadmeFile(File dir, MavenProject mavenProject) throws IOException {
InputStream is = getClass().getResourceAsStream("README.template");
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw);
String content = sw.getBuffer().toString();
content = StringU... | false |
900,233 | 9,062,063 | 7,020,500 | public String setEncryptedPassword(String rawPassword) {
String out = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(rawPassword.getBytes());
byte raw[] = md.digest();
out = new String();
... | public static URL[] getURLsForAllJars(URL url, File tmpDir) {
FileInputStream fin = null;
InputStream in = null;
ZipInputStream zin = null;
try {
ArrayList array = new ArrayList();
in = url.openStream();
String fileName = url.getFile();
... | false |
900,234 | 22,043,834 | 7,954,779 | public void _testConvertIntoOneFile() {
File csvFile = new File("C:/DE311/solution_workspace/WorkbookTaglib/WorkbookTagDemoWebapp/src/main/resources/csv/google.csv");
try {
Charset guessedCharset = com.glaforge.i18n.io.CharsetToolkit.guessEncoding(csvFile, 4096);
CSVReader re... | 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 |
900,235 | 13,365,065 | 21,575,638 | public Object downloadFile(File destinationFile, URL[] urls, DownloadListener listener, Object checksum, long length, PRIORITY priority) throws DownloadException {
URL url = urls[0];
if (!url.getProtocol().equalsIgnoreCase("http")) {
throw new DownloadException(" Only HTTP is supported i... | protected void writeGZippedBytes(byte array[], TupleOutput out) {
if (array == null || array.length == 0) {
out.writeBoolean(false);
writeBytes(array, out);
return;
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(array.length);
... | true |
900,236 | 21,442,625 | 941,896 | private void copyFile(String from, String to) throws Exception {
URL monitorCallShellScriptUrl = Thread.currentThread().getContextClassLoader().getResource(from);
File inScriptFile = null;
try {
inScriptFile = new File(monitorCallShellScriptUrl.toURI());
} catch (URISynta... | 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 |
900,237 | 16,915,670 | 19,935,037 | public static byte[] resolveRef(String url) throws MalformedURLException, IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
URL addressurl = new URL(url);
InputStream in = addressurl.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in))... | public byte[] getByteCode() throws IOException {
InputStream in = null;
ByteArrayOutputStream buf = new ByteArrayOutputStream(2048);
try {
in = url.openStream();
int b = in.read();
while (b != -1) {
buf.write(b);
b = in.read... | false |
900,238 | 18,924,485 | 21,320,070 | public void processExplicitSchemaAndWSDL(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
HashMap services = configContext.getAxisConfiguration().getServices();
String filePart = req.getRequestURL().toString();
String schema = filePart.substring(filePar... | public static void copy(File from_file, File to_file) throws IOException {
if (!from_file.exists()) {
throw new IOException("FileCopy: no such source file: " + from_file.getPath());
}
if (!from_file.isFile()) {
throw new IOException("FileCopy: can't copy directory: " ... | true |
900,239 | 4,988,270 | 12,660,385 | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | @Override
public boolean accept(File file) {
if (file.getName().equals(".svn")) {
return false;
}
final long modify = file.lastModified();
final long time = DateUtils.toDate("2012-03-21 17:43", "yyyy-MM-dd HH:mm"... | true |
900,240 | 555,865 | 21,803,552 | public void testServletTesterClient() throws Exception {
String base_url = tester.createSocketConnector(true);
URL url = new URL(base_url + "/context/hello/info");
String result = IO.toString(url.openStream());
assertEquals("<h1>Hello Servlet</h1>", result);
}
| public void doRender() throws IOException {
File file = new File(fileName);
if (!file.exists()) {
logger.error("Static resource not found: " + fileName);
isNotFound = true;
return;
}
if (fileName.endsWith("xml") || fileName.endsWith("asp")) servlet... | false |
900,241 | 9,516,458 | 6,146,146 | public String getHash(String type, String text, String salt) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance(type);
byte[] hash = new byte[md.getDigestLength()];
if (!salt.isEmpty()) {
md.update(salt.getByte... | public static String encrypt(String text) throws NoSuchAlgorithmException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
try {
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (UnsupportedEncodingExceptio... | true |
900,242 | 792,644 | 6,430,125 | 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... | protected Object openDialogBox(Control cellEditorWindow) {
FileDialog dialog = new FileDialog(parent.getShell(), SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.jpg;*.JPG;*.JPEG;*.gif;*.GIF;*.png;*.PNG", "*.jpg;*.JPG;*.JPEG", "*.gif;*.GIF", "*.png;*.PNG" });
dialog.setFilterNames(new... | true |
900,243 | 555,928 | 11,875,445 | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | private static void loadFromZip() {
InputStream in = Resources.class.getResourceAsStream("data.zip");
if (in == null) {
return;
}
ZipInputStream zipIn = new ZipInputStream(in);
try {
while (true) {
ZipEntry entry = zipIn.getNextEntry();... | true |
900,244 | 16,519,742 | 9,405,784 | public File getFile(String file) {
DirProperties dp;
List files = new ArrayList();
for (int i = 0; i < locs.size(); i++) {
dp = (DirProperties) locs.get(i);
if (dp.isReadable()) {
File g = new File(dp.getLocation() + slash() + file);
if... | public void startImport(ActionEvent evt) {
final PsiExchange psiExchange = PsiExchangeFactory.createPsiExchange(IntactContext.getCurrentInstance().getSpringContext());
for (final URL url : urlsToImport) {
try {
if (log.isInfoEnabled()) log.info("Importing: " + url);
... | false |
900,245 | 20,377,776 | 3,430,781 | public static void assertEquals(String xmlpath, Object actualObject) throws Exception {
InputStreamReader isr;
try {
isr = new FileReader(xmlpath);
} catch (FileNotFoundException e) {
URL url = AssertHelper.class.getClassLoader().getResource(xmlpath);
if (... | public static String getTextFromPart(Part part) {
try {
if (part != null && part.getBody() != null) {
InputStream in = part.getBody().getInputStream();
String mimeType = part.getMimeType();
if (mimeType != null && MimeUtility.mimeTypeMatches(mimeTy... | false |
900,246 | 16,001,374 | 13,915,960 | static void copyFile(File file, File destDir) {
File destFile = new File(destDir, file.getName());
if (destFile.exists() && (!destFile.canWrite())) {
throw new SyncException("Cannot overwrite " + destFile + " because " + "it is read-only");
}
try {
FileInputSt... | protected void copyFile(final String sourceFileName, final File path) throws IOException {
final File source = new File(sourceFileName);
final File destination = new File(path, source.getName());
FileChannel srcChannel = null;
FileChannel dstChannel = null;
FileInputStream fi... | true |
900,247 | 10,785,896 | 21,370,186 | private void createProperty(String objectID, String value, String propertyID, Long userID) throws JspTagException {
ClassProperty classProperty = new ClassProperty(new Long(propertyID));
String newValue = value;
if (classProperty.getName().equals("Password")) {
try {
... | public static void replaceAll(File file, String substitute, String substituteReplacement) throws IOException {
log.debug("Replace " + substitute + " by " + substituteReplacement);
Pattern pattern = Pattern.compile(substitute);
FileInputStream fis = new FileInputStream(file);
FileChan... | false |
900,248 | 8,075,978 | 13,395,834 | public String getDataAsString(String url) throws RuntimeException {
try {
String responseBody = "";
URLConnection urlc;
if (!url.toUpperCase().startsWith("HTTP://") && !url.toUpperCase().startsWith("HTTPS://")) {
urlc = tryOpenConnection(url);
... | TreeMap<Integer, Integer> initProperties(URL propurl) {
String zoneFileName = null;
String costFileName = null;
String homesFileName = null;
String jobsFileName = null;
Properties props = new Properties();
try {
props.loadFromXML(propurl.openStream());
... | false |
900,249 | 11,290,317 | 2,469,707 | 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, ... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.addHeader("Cache-Control", "max-age=" + Constants.HTTP_CACHE_SECONDS);
String uuid = req.getRequestURI().substring(req.getRequestURI().indexOf(Constants.SERVLET_FULL_PREFI... | true |
900,250 | 15,183,953 | 15,113,437 | private byte[] cacheInputStream(URL url) throws IOException {
InputStream ins = url.openStream();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
byte[] buf = new byte[256];
while (true) {
int n = ins.read(buf);
if (n == -... | protected void loadUrl(URL url) throws BuildException {
Properties props = new Properties();
log("Loading " + url, Project.MSG_VERBOSE);
try {
InputStream is = url.openStream();
try {
loadProperties(props, is, url.getFile().endsWith(".xml"));
... | false |
900,251 | 15,904,654 | 16,951,197 | protected static DynamicJasperDesign generateJasperDesign(DynamicReport dr) throws CoreException {
DynamicJasperDesign jd = null;
try {
if (dr.getTemplateFileName() != null) {
log.info("loading template file: " + dr.getTemplateFileName());
log.info("Attemp... | public void testReleaseOnEntityWriteTo() throws Exception {
HttpParams params = defaultParams.copy();
ConnManagerParams.setMaxTotalConnections(params, 1);
ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
ThreadSafeClientConnManager mgr = createTSCCM(param... | false |
900,252 | 9,830,269 | 2,199,598 | public final void deliver(final String from, final String recipient, final InputStream data) throws TooMuchDataException, IOException {
System.out.println("FROM: " + from);
System.out.println("TO: " + recipient);
final File tmpD... | public static void copyFile(File file, String pathExport) throws IOException {
File out = new File(pathExport);
FileChannel sourceChannel = new FileInputStream(file).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sou... | true |
900,253 | 479,674 | 20,836,131 | public static synchronized String getSequenceNumber(String SequenceName) {
String result = "0";
Connection conn = null;
Statement ps = null;
ResultSet rs = null;
try {
conn = TPCW_Database.getConnection();
conn.setAutoCommit(false);
String ... | public void modify(String strName, String strNewPass) {
String str = "update jb_user set V_PASSWORD =? where V_USERNAME =?";
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbForumFactory.getConnection();
con.setAutoCommit(false);
... | true |
900,254 | 7,842,021 | 19,295,210 | public FileInputStream execute() {
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
String pdfPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/pdf");
try {... | public static String generateHash(String value) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(value.getBytes());
} catch (NoSuchAlgorithmException e) {
log.error("Could not find the requested ... | false |
900,255 | 8,255,076 | 19,423,749 | public static void main(String args[]) {
if (args.length < 1) {
printUsage();
}
URL url;
BufferedReader in = null;
try {
url = new URL(args[0]);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
int respon... | public void removerQuestaoMultiplaEscolha(QuestaoMultiplaEscolha multiplaEscolha) throws ClassNotFoundException, SQLException {
this.criaConexao(false);
String sql = "DELETE FROM \"Disciplina\" " + " WHERE ID_Disciplina = ? )";
PreparedStatement stmt = null;
try {
... | false |
900,256 | 9,061,980 | 3,419,825 | public static void copyFile(String source, String destination, TimeSlotTracker timeSlotTracker) {
LOG.info("copying [" + source + "] to [" + destination + "]");
BufferedInputStream sourceStream = null;
BufferedOutputStream destStream = null;
try {
File destinationFile = n... | 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 |
900,257 | 4,684,601 | 11,872,567 | 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... | protected HttpResponseImpl makeRequest(final HttpMethod m, final String requestId) {
try {
HttpResponseImpl ri = new HttpResponseImpl();
ri.setRequestMethod(m);
ri.setResponseCode(_client.executeMethod(m));
ByteArrayOutputStream bos = new ByteArrayOutputStream... | true |
900,258 | 10,949,790 | 10,176,882 | private void loadDBpediaOntology() {
try {
URL url = new URL("http://downloads.dbpedia.org/3.6/dbpedia_3.6.owl.bz2");
InputStream is = new BufferedInputStream(url.openStream());
CompressorInputStream in = new CompressorStreamFactory().createCompressorInputStream("bzip2", ... | @SuppressWarnings("unchecked")
protected void processDownloadAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
File transformationFile = new File(xslBase, "file-info.xsl");
HashMap<String, Object> params = new HashMap<String, Object>();
params.putAll(req... | false |
900,259 | 6,403,005 | 497,400 | @SuppressWarnings("unchecked")
protected void processTransformAction(HttpServletRequest request, HttpServletResponse response, String action) throws Exception {
File transformationFile = null;
String tr = request.getParameter(Definitions.REQUEST_PARAMNAME_XSLT);
if (StringUtils.isNotBlan... | public TVRageShowInfo(String xmlShowName) {
String[] tmp, tmp2;
String line = "";
this.usrShowName = xmlShowName;
try {
URL url = new URL("http://www.tvrage.com/quickinfo.php?show=" + xmlShowName.replaceAll(" ", "%20"));
BufferedReader in = new BufferedReader(... | false |
900,260 | 15,295,408 | 5,305,335 | private final long test(final boolean applyFilter, final int executionCount) throws NoSuchAlgorithmException, NoSuchPaddingException, FileNotFoundException, IOException, RuleLoadingException {
final boolean stripHtmlEnabled = true;
final boolean injectSecretTokensEnabled = true;
final boolea... | public void testRenderRules() {
try {
MappingManager manager = new MappingManager();
OWLOntologyManager omanager = OWLManager.createOWLOntologyManager();
OWLOntology srcOntology;
OWLOntology targetOntology;
manager.loadMapping(rulesDoc.toURL());
... | true |
900,261 | 4,336,715 | 11,113,074 | 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 void backupXML() {
try {
TimeStamp timeStamp = new TimeStamp();
String fnameIn = this.fnameXML();
String pathBackup = this.pathXML + "\\Backup\\";
String fnameOut = fnameIn.substring(fnameIn.indexOf(this.fname), fnameIn.length());
fnameOut =... | true |
900,262 | 17,930,257 | 392,357 | public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new ImageFilter());
fc.setFileView(new ImageFileView());
fc.setAccessory(new ImagePreview(fc));
... | 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 |
900,263 | 1,718,589 | 9,924,413 | @Override
public ImageData getImageData(URL url) {
InputStream in = null;
try {
URLConnection conn = url.openConnection();
conn.setRequestProperty("user-agent", "Tahiti/Alpha5x");
conn.setRequestProperty("agent-system", "aglets");
conn.setAllowUser... | private void startOpening(final URL url) {
final WebAccessor wa = this;
openerThread = new Thread() {
public void run() {
iStream = null;
try {
tryProxy = false;
URLConnection connection = url.openConnection();
... | false |
900,264 | 10,193,598 | 4,948,580 | public static String encodePassword(String password) {
try {
MessageDigest messageDiegest = MessageDigest.getInstance("SHA-1");
messageDiegest.update(password.getBytes("UTF-8"));
return Base64.encodeToString(messageDiegest.digest(), false);
} catch (NoSuchAlgorith... | public InputStream getResourceAsStream(String path) {
try {
URL url = getResource(path);
if (url != null) {
return url.openStream();
} else {
return null;
}
} catch (IOException ioe) {... | false |
900,265 | 11,305,839 | 8,841,555 | public boolean setCliente(int IDcliente, String nombre, String paterno, String materno, String ocupacion, String rfc) {
boolean inserto = false;
try {
stm = conexion.prepareStatement("insert into clientes values( '" + IDcliente + "' , '" + nombre.toUpperCase() + "' , '" + paterno.toUpper... | public String getMd5CodeOf16(String str) {
StringBuffer buf = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte b[] = md.digest();
int i;
buf = new StringBuffer("");
for (int offset... | false |
900,266 | 12,127,276 | 17,444,336 | public void testGetResource_FileOutsideOfClasspath() throws Exception {
File temp = File.createTempFile("dozerfiletest", ".txt");
temp.deleteOnExit();
String resourceName = "file:" + temp.getAbsolutePath();
URL url = loader.getResource(resourceName);
assertNotNull("URL should... | public static synchronized String encrypt(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
return new BASE64Encoder().encode(raw);
} catch (NoSuchA... | false |
900,267 | 1,327,097 | 7,103,225 | public String generateMappackMD5(File mapPackFile) throws IOException, NoSuchAlgorithmException {
ZipFile zip = new ZipFile(mapPackFile);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
MessageDigest md5Total = MessageDigest.getInstance("MD5");
Mess... | public void testGetWithKeepAlive() throws Exception {
HttpGet request = new HttpGet(baseUri + "/test");
HttpResponse response = client.execute(request);
assertEquals(200, response.getStatusLine().getStatusCode());
assertEquals("test", TestUtil.getResponseAsString(response));
... | false |
900,268 | 15,889,430 | 9,872,510 | public Parameters getParameters(HttpExchange http) throws IOException {
ParametersImpl params = new ParametersImpl();
String query = null;
if (http.getRequestMethod().equalsIgnoreCase("GET")) {
query = http.getRequestURI().getRawQuery();
} else if (http.getRequestMethod()... | private static String makeTempTraceFile(String base) throws IOException {
File temp = File.createTempFile(base, ".trace");
temp.deleteOnExit();
FileChannel dstChannel = new FileOutputStream(temp).getChannel();
FileChannel srcChannel = new FileInputStream(base + ".key").getChannel();
... | true |
900,269 | 11,032,545 | 16,803,474 | @Test
public void testCopyOverSize() throws IOException {
final InputStream in = new ByteArrayInputStream(TEST_DATA);
final ByteArrayOutputStream out = new ByteArrayOutputStream(TEST_DATA.length);
final int cpySize = ExtraIOUtils.copy(in, out, TEST_DATA.length + Long.SIZE);
asser... | public static void copyFile(File source, File dest) throws Exception {
FileInputStream fis = new FileInputStream(source);
try {
FileOutputStream fos = new FileOutputStream(dest);
try {
int read = fis.read();
while (read != -1) {
... | true |
900,270 | 5,826,730 | 17,729,553 | private void copyFromZip(File zipFile) throws GLMRessourceManagerException {
if (zipFile == null) throw new GLMRessourceZIPException(1);
if (!zipFile.exists()) throw new GLMRessourceZIPException(2);
int len = 0;
byte[] buffer = ContentManager.getDefaultBuffer();
try {
... | public boolean clonarFichero(String rutaFicheroOrigen, String rutaFicheroDestino) {
System.out.println("");
System.out.println("*********** DENTRO DE 'clonarFichero' ***********");
boolean estado = false;
try {
FileInputStream entrada = new FileInputStream(rutaFicheroOrig... | true |
900,271 | 3,410,039 | 9,327,524 | 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... | @Test
public void test01_ok_failed_500() throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
try {
HttpPost post = new HttpPost(chartURL);
HttpResponse response = client.execute(post);
assertEquals("failed code for ", 500, response.getStatus... | false |
900,272 | 44,823 | 13,299,924 | 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 void foundNewVersion() {
updater = new UpdaterView();
updater.setLabelText("Initiating Updater...");
updater.setProgress(0);
updater.setLocationRelativeTo(null);
updater.setVisible(true);
URL pathUrl = ClassLoader.getSystemResource("img/icon.png");
Str... | true |
900,273 | 13,039,812 | 5,246,170 | public String getImageURL(String text) {
String imgURL = "";
try {
URL url = new URL("http://images.search.yahoo.com/search/images?p=" + URLEncoder.encode(text));
URLConnection connection = url.openConnection();
DataInputStream in = new DataInputStream(connection.... | public static void fileCopy(String src, String dst) {
try {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dst);
int read = -1;
byte[] buf = new byte[8192];
while ((read = fis.read(buf)) != -1) {
... | false |
900,274 | 19,366,418 | 679,959 | public static Photo createPhoto(String title, String userLogin, String pathToPhoto, String basePathImage) throws NoSuchAlgorithmException, IOException {
String id = CryptSHA1.genPhotoID(userLogin, title);
String extension = pathToPhoto.substring(pathToPhoto.lastIndexOf("."));
String destinat... | 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 |
900,275 | 810,884 | 22,841,783 | 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 GridDirectoryList(URL url) throws McIDASException {
try {
urlc = (AddeURLConnection) url.openConnection();
inputStream = new DataInputStream(new BufferedInputStream(urlc.getInputStream()));
} catch (IOException e) {
throw new McIDASException("Error opening ... | false |
900,276 | 3,459,078 | 3,673,887 | public static void copyFile(File source, File target) {
try {
target.getParentFile().mkdirs();
byte[] buffer = new byte[4096];
int len = 0;
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(target);
... | public static final void copyFile(File source, File destination) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel targetChannel = new FileOutputStream(destination).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChan... | true |
900,277 | 18,048,830 | 22,717,352 | public void add(AddInterceptorChain chain, Entry entry, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + this.dbInsertName);
if (con == null) {
throw new LDAPException("Operations Error", LDAPException.OPERA... | public void add(AddInterceptorChain chain, Entry entry, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + "LDAPBaseServer");
if (con == null) {
throw new LDAPException("Operations Error", LDAPException.OPERAT... | true |
900,278 | 4,822,222 | 12,760,982 | public static void copy(String srcFileName, String destFileName) throws IOException {
if (srcFileName == null) {
throw new IllegalArgumentException("srcFileName is null");
}
if (destFileName == null) {
throw new IllegalArgumentException("destFileName is null");
... | public static String MD5Encode(String password) {
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(password.getBytes());
final byte[] digest = messageDigest.digest();
final StringBuilder buf = ne... | false |
900,279 | 7,132,186 | 6,771,711 | 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.... | @SuppressWarnings("deprecation")
public static final ReturnCode runCommand(IOBundle io, String[] args) {
if ((args.length < 3) || (args.length > 4)) return ReturnCode.makeReturnCode(ReturnCode.RET_INVALID_NUM_ARGS, "Invalid number of arguments: " + args.length);
if ((args.length == 3) && (!args[... | true |
900,280 | 1,189,509 | 489,386 | public void testRoundTrip_1(String resource) throws Exception {
long start1 = System.currentTimeMillis();
File originalFile = File.createTempFile("RoundTripTest", "testRoundTrip_1");
FileOutputStream fos = new FileOutputStream(originalFile);
IOUtils.copy(getClass().getResourceAsStrea... | 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 |
900,281 | 44,823 | 19,579,830 | 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 toCopy, File dest) throws IOException {
FileInputStream src = new FileInputStream(toCopy);
FileOutputStream out = new FileOutputStream(dest);
try {
while (src.available() > 0) {
out.write(src.read());
}
} finally {
... | true |
900,282 | 23,370,708 | 12,524,506 | private final long test(final boolean applyFilter, final int executionCount) throws NoSuchAlgorithmException, NoSuchPaddingException, FileNotFoundException, IOException, RuleLoadingException {
final boolean stripHtmlEnabled = true;
final boolean injectSecretTokensEnabled = true;
final boolea... | public static void copyFile(File in, File outDir) throws IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
File out = new File(outDir, in.getName());
destinati... | true |
900,283 | 18,731,109 | 23,047,157 | 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.... | @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()) {
... | true |
900,284 | 10,539,421 | 11,312,022 | public static String sha1(String clearText, String seed) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update((seed + clearText).getBytes());
return convertToHex(md.digest());
} catch (Exception e) {
throw new RuntimeException(e.get... | public static void downloadFromUrl(URL url, String localFilename, String userAgent) throws IOException {
InputStream is = null;
FileOutputStream fos = null;
System.setProperty("java.net.useSystemProxies", "true");
try {
URLConnection urlConn = url.openConnection();
... | false |
900,285 | 13,312,539 | 17,136,338 | private void executeScript(SQLiteDatabase sqlDatabase, InputStream input) {
StringWriter writer = new StringWriter();
try {
IOUtils.copy(input, writer);
} catch (IOException e) {
throw new ComixException("Could not read the database script", e);
}
Stri... | protected void checkWeavingJar() throws IOException {
OutputStream out = null;
try {
final File weaving = new File(getWeavingPath());
if (!weaving.exists()) {
new File(getWeavingFolder()).mkdir();
weaving.createNewFile();
final ... | true |
900,286 | 2,113,293 | 3,657,883 | protected void setUp() throws Exception {
testOutputDirectory = new File(getClass().getResource("/").getPath());
zipFile = new File(this.testOutputDirectory, "/plugin.zip");
zipOutputDirectory = new File(this.testOutputDirectory, "zip");
zipOutputDirectory.mkdir();
logger.fin... | @Override
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException {
String context = request.getContextPath();
String resource = request.getRequestURI().replace(context, "");
resource = resource.replaceAll("^/\\w*/", "");
... | true |
900,287 | 17,630,908 | 5,433,055 | public static int[] sortDescending(float input[]) {
int[] order = new int[input.length];
for (int i = 0; i < order.length; i++) order[i] = i;
for (int i = input.length; --i >= 0; ) {
for (int j = 0; j < i; j++) {
if (input[j] < input[j + 1]) {
... | public static Coordinate getCoordenadas(String RCoURL) {
Coordinate coord = new Coordinate();
String pURL;
String iniPC1 = "<pc1>";
String iniPC2 = "<pc2>";
String finPC1 = "</pc1>";
String finPC2 = "</pc2>";
String iniX = "<xcen>";
String iniY = "<yce... | false |
900,288 | 5,274,229 | 7,844,497 | public String post(Map<String, String> headersMap, String monitoringRequest) {
HttpClient httpClient = new DefaultHttpClient();
httpClient.getParams().setParameter("http.useragent", "sla@soi OCCI Client v0.2");
HttpPost httpPost = new HttpPost("http://" + hostname + ":" + port + resource);
... | public static String simplePostRequest(String path, Map<String, Object> model) {
try {
URL url = new URL(path);
URLConnection con = url.openConnection();
con.setDoOutput(true);
OutputStream out = con.getOutputStream();
OutputStream bout = new Buffe... | false |
900,289 | 4,648,562 | 16,981,231 | public String Hash(String plain) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(plain.getBytes(), 0, plain.length());
return new BigInteger(1, md5.digest()).toString(16);
} catch (Exception ex) {
Log.serverlogger.warn("No such... | public static boolean verify(final String password, final String encryptedPassword) {
MessageDigest digest = null;
int size = 0;
String base64 = null;
if (encryptedPassword.regionMatches(true, 0, "{CRYPT}", 0, 7)) {
throw new InternalError("Not implemented");
} el... | true |
900,290 | 21,386,162 | 5,438,231 | public void writeToFile(File file, File source) throws IOException {
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(file));
BufferedInputStream bin = new BufferedInputStream(new FileInputStream(source));
bin.skip(header.getHeaderEndingOffset());
for (long i... | public int extract() throws Exception {
int count = 0;
if (VERBOSE) System.out.println("IAAE:Extractr.extract: getting ready to extract " + getArtDir().toString());
ITCFileFilter iff = new ITCFileFilter();
RecursiveFileIterator rfi = new RecursiveFileIterator(getArtDir(), iff);
... | true |
900,291 | 245,163 | 14,024,978 | @Override
public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException {
String url = request.getParameter(URL_PARAM_NAME);
if (StringUtils.isEmpty(url)) {
log.error("url parameter not provided.");
throw new DataSourceException(Re... | public static final String generate(String value) {
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(value.getBytes());
byte[] hash = md.digest();
StringBuffer hexString = new StringBuffer();
for (int... | false |
900,292 | 5,439,181 | 19,166,563 | private String hash(String text) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);
}
| private String doSearch(String query) {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("http://boss.yahooapis.com/ysearch/web/v1/").append(query).append("?appid=wGsFV_DV34EwXnC.2Bt_Ql8Kcir_HmrxMzWUF2fv64CA8ha7e4zgudqXFA8K_J4-&format=xml&filter=-porn");
try {
... | false |
900,293 | 15,796,324 | 4,776,598 | public static List importSymbols(List symbols) throws ImportExportException {
List quotes = new ArrayList();
String URLString = constructURL(symbols);
IDQuoteFilter filter = new YahooIDQuoteFilter();
PreferencesManager.ProxyPreferences proxyPreferences = PreferencesManager.loadProxyS... | private void init(URL url) {
frame = new JInternalFrame(name);
frame.addInternalFrameListener(this);
listModel.add(listModel.size(), this);
area = new JTextArea();
area.setMargin(new Insets(5, 5, 5, 5));
try {
BufferedReader... | true |
900,294 | 7,034,031 | 3,160,590 | 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();
... | @Override
public final byte[] getDigest() {
try {
final MessageDigest hashing = MessageDigest.getInstance("SHA-256");
final Charset utf16 = Charset.forName("UTF-16");
for (final CollationKey wordKey : this.words) {
hashing.update(wordKey.toByteArray())... | false |
900,295 | 15,480,455 | 17,662,157 | public static void TestDBStore() throws PDException, Exception {
StoreDDBB StDB = new StoreDDBB("jdbc:derby://localhost:1527/Prodoc", "Prodoc", "Prodoc", "org.apache.derby.jdbc.ClientDriver;STBLOB");
System.out.println("Driver[" + StDB.getDriver() + "] Tabla [" + StDB.getTable() + "]");
StD... | public static void main(String[] argz) {
int X, Y, Z;
X = 256;
Y = 256;
Z = 256;
try {
String work_folder = "C:\\Documents and Settings\\Entheogen\\My Documents\\school\\jung\\vol_data\\CT_HEAD3";
FileOutputStream out_stream = new FileOutputStream(new ... | true |
900,296 | 7,553,634 | 10,432,257 | public static String calcolaMd5(String messaggio) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
md.reset();
md.update(messaggio.getBytes());
byte... | private void createImageArchive() throws Exception {
imageArchive = new File(resoutFolder, "images.CrAr");
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(imageArchive)));
out.writeInt(toNativeEndian(imageFiles.size()));
for (int i = 0; i < i... | false |
900,297 | 19,841,852 | 369,572 | public static final boolean checkForUpdate(final String currentVersion, final String updateURL, boolean noLock) throws Exception {
try {
final String parentFDTConfDirName = System.getProperty("user.home") + File.separator + ".fdt";
final String fdtUpdateConfFileName = "update.propert... | 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 |
900,298 | 8,620,255 | 372,172 | private void sendMessages() {
Configuration conf = Configuration.getInstance();
for (int i = 0; i < errors.size(); i++) {
String msg = null;
synchronized (this) {
msg = errors.get(i);
if (DEBUG) System.out.println(msg);
errors.r... | public static void main(String[] args) throws Exception {
String linesep = System.getProperty("line.separator");
FileOutputStream fos = new FileOutputStream(new File("lib-licenses.txt"));
fos.write(new String("JCP contains the following libraries. Please read this for comments on copyright e... | false |
900,299 | 17,534,703 | 15,854,397 | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | public static Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileIn... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.