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 |
|---|---|---|---|---|---|
4,700 | 23,390,255 | 9,040,848 | 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... | @SuppressWarnings("unused")
private static int chkPasswd(final String sInputPwd, final String sSshaPwd) {
assert sInputPwd != null;
assert sSshaPwd != null;
int r = ERR_LOGIN_ACCOUNT;
try {
BASE64Decoder decoder = new BASE64Decoder();
byte[] ba = decoder.d... | false |
4,701 | 8,558,207 | 3,883,870 | private byte[] _generate() throws NoSuchAlgorithmException {
if (host == null) {
try {
seed = InetAddress.getLocalHost().toString();
} catch (UnknownHostException e) {
seed = "localhost/127.0.0.1";
} catch (SecurityException e) {
... | public String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | true |
4,702 | 6,381,991 | 20,869,815 | private static String hashToMD5(String sig) {
try {
MessageDigest lDigest = MessageDigest.getInstance("MD5");
lDigest.update(sig.getBytes());
BigInteger lHashInt = new BigInteger(1, lDigest.digest());
return String.format("%1$032X", lHashInt).toLowerCase();
... | private static String encode(String str, String method) {
MessageDigest md = null;
String dstr = null;
try {
md = MessageDigest.getInstance(method);
md.update(str.getBytes());
dstr = new BigInteger(1, md.digest()).toString(16);
} catch (NoSuchAlgor... | true |
4,703 | 12,678,589 | 16,822,377 | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public String buscarArchivos(String nUsuario) {
String responce = "";
String request = conf.Conf.buscarArchivo;
OutputStreamWriter wr = null;
BufferedReader rd = null;
try {
URL url = new URL(request);
URLConnection conn = url.openConnection();
... | false |
4,704 | 20,514,301 | 11,930,427 | List<String> options(String path) throws TwinException {
try {
BasicHttpRequest request = new BasicHttpRequest("OPTIONS", url + path);
HttpClient client = getClient();
HttpResponse response = client.execute(new HttpHost(url.getHost(), url.getPort()), request);
... | private static String getServiceResponse(final String requestName, final Template template, final Map variables) {
OutputStreamWriter outputWriter = null;
try {
final StringWriter writer = new StringWriter();
final VelocityContext context = new VelocityContext(variables);
... | false |
4,705 | 1,423,646 | 441,377 | public void removerDisciplina(Disciplina disciplina) throws ClassNotFoundException, SQLException {
this.criaConexao(false);
String sql = "DELETE FROM \"Disciplina\" " + " WHERE ID_Disciplina = ? )";
PreparedStatement stmt = null;
try {
stmt = connection.prepareSt... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
4,706 | 20,784,790 | 6,310,814 | private static void copy(File source, File target) throws IOException {
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(target);
byte[] buffer = new byte[4096];
int no = 0;
try {
while ((no = in.read(buffer)) != -1) ou... | public boolean downloadNextTLE() {
boolean success = true;
if (!downloadINI) {
errorText = "startTLEDownload() must be ran before downloadNextTLE() can begin";
return false;
}
if (!this.hasMoreToDownload()) {
errorText = "There are no more TLEs to ... | false |
4,707 | 21,234,510 | 2,936,895 | public static void zip(String destination, String folder) {
File fdir = new File(folder);
File[] files = fdir.listFiles();
PrintWriter stdout = new PrintWriter(System.out, true);
int read = 0;
FileInputStream in;
byte[] data = new byte[1024];
try {
... | protected byte[] createFileID() {
try {
COSDocument cosDoc = cosGetDoc();
if (cosDoc == null) {
return null;
}
ILocator locator = cosDoc.getLocator();
if (locator == null) {
return null;
}
IRa... | false |
4,708 | 4,291,745 | 13,586,003 | private String[] readFile(String filename) {
final Vector<String> buf = new Vector<String>();
try {
final URL url = new URL(getCodeBase(), filename);
final InputStream in = url.openStream();
BufferedReader dis = new BufferedReader(new InputStreamReader(in));
... | public ObservationResult[] call(String url, String servicename, String srsname, String version, String offering, String observed_property, String responseFormat) {
System.out.println("GetObservationBasic.call url " + url);
URL service = null;
URLConnection connection = null;
ArrayLis... | false |
4,709 | 3,597,316 | 3,024,990 | 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(... | @Test
public void testCopy_readerToOutputStream_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
Reader reader = new InputStreamReader(in, "US-ASCII");
ByteArrayOutputStream baout = new ByteArra... | true |
4,710 | 7,034,031 | 21,840,703 | 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();
... | @Test
public void parse() throws Exception {
URL url = new URL("http://www.oki.com");
HtmlParser parser = new HtmlParser();
byte[] bytes = FileUtilities.getContents(url.openStream(), Integer.MAX_VALUE).toByteArray();
OutputStream parsed = parser.parse(new ByteArrayInputStream(byt... | false |
4,711 | 8,250,358 | 16,031,757 | private static InputStream connect(String url) throws IOException {
int status = 0;
String currentlyActiveServer = getCurrentlyActiveServer();
try {
long begin = System.currentTimeMillis();
HttpURLConnection httpConnection = (HttpURLConnection) new URL(currentlyActive... | private void createProject(IProgressMonitor monitor, boolean launchNewTestWizard) {
try {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(namePage.getProjectName());
IProjectDescription description = ResourcesPlugin.getWo... | false |
4,712 | 708,766 | 6,680,022 | 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 ResourceMigratorBuilder createResourceMigratorBuilder(NotificationReporter reporter) {
return new ResourceMigratorBuilder() {
public ResourceMigrator getCompletedResourceMigrator() {
return new ResourceMigrator() {
public void migr... | true |
4,713 | 16,797,428 | 4,569,312 | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | public 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... | false |
4,714 | 14,373,268 | 6,190,355 | public static String encode(String username, String password) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(username.getBytes());
digest.update(password.getBytes());
return new String(digest.digest());
} catch (Except... | public static String hashPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-512");
md.update(password.getBytes("UTF-8"));
byte[] bytes = md.digest();
String result = encodeBase64(bytes);
return result.trim();
... | true |
4,715 | 16,050,015 | 10,432,260 | public static void downloadFile(String htmlUrl, String dirUrl) {
try {
URL url = new URL(htmlUrl);
System.out.println("Opening connection to " + htmlUrl + "...");
URLConnection urlC = url.openConnection();
InputStream is = url.openStream();
Date da... | private void appendArchive() throws Exception {
String cmd;
if (profile == CompilationProfile.UNIX_GCC) {
cmd = "cat";
} else if (profile == CompilationProfile.MINGW_WINDOWS) {
cmd = "type";
} else {
throw new Exception("Unknown cat equivalent for ... | false |
4,716 | 18,773,782 | 12,539,808 | @Override
public void render(IContentNode contentNode, Request req, Response resp, Application app, ServerInfo serverInfo) {
Node fileNode = contentNode.getNode();
try {
Node res = fileNode.getNode("jcr:content");
if (checkLastModified(res, req.getServletRequset(), resp.g... | public void jsFunction_extract(ScriptableFile outputFile) throws IOException, FileSystemException, ArchiveException {
InputStream is = file.jsFunction_createInputStream();
OutputStream output = outputFile.jsFunction_createOutputStream();
BufferedInputStream buf = new BufferedInputStream(is);... | true |
4,717 | 12,078,160 | 12,980,532 | public String getIpAddress() {
try {
URL url = new URL("http://checkip.dyndns.org");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String linha;
String rtn = "";
while ((linha = in.readLine()) != null) rtn += linh... | public String htmlContentSimple(String urlStr, String charset) {
StringBuffer html = new StringBuffer();
URL url = null;
BufferedReader reader = null;
try {
url = new URL(urlStr);
reader = new BufferedReader(new InputStreamReader(url.openStream(), charset));
... | true |
4,718 | 2,310,752 | 649,639 | 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 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 |
4,719 | 11,149,084 | 14,406,880 | private void deleteProject(String uid, String home, HttpServletRequest request, HttpServletResponse response) throws Exception {
String project = request.getParameter("project");
String line;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
htmlHe... | @Override
public void setDocumentSpace(DocumentSpace space) {
for (Document doc : space) {
if (doc instanceof XMLDOMDocument) {
writer.writeDocument(doc);
} else if (doc instanceof BinaryDocument) {
BinaryDocument bin = (BinaryDocument) doc;
... | true |
4,720 | 9,733,447 | 5,659,863 | 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 static FileChannel newFileChannel(File file, String rw, boolean enableException) throws IOException {
if (file == null) return null;
if (rw == null || rw.length() == 0) {
return null;
}
rw = rw.toLowerCase();
if (rw.equals(MODE_READ)) {
if (File... | true |
4,721 | 11,404,999 | 14,832,930 | public boolean moveFileSafely(final File in, final File out) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel inChannel = null;
FileChannel outChannel = null;
final File tempOut = File.createTempFile("move", ".tmp");
try {
... | private static String format(String check) throws NoSuchAlgorithmException, UnsupportedEncodingException {
check = check.replaceAll(" ", "");
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(check.getBytes("ISO-8859-1"));
byte[] end = md5.digest();
String dige... | false |
4,722 | 4,567,361 | 5,021,676 | private Attachment setupSimpleAttachment(Context context, long messageId, boolean withBody) throws IOException {
Attachment attachment = new Attachment();
attachment.mFileName = "the file.jpg";
attachment.mMimeType = "image/jpg";
attachment.mSize = 0;
attachment.mContentId = ... | public static String getSHA1Digest(String inputStr) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
byte[] sha1hash = null;
md = MessageDigest.getInstance("SHA");
sha1hash = new byte[40];
md.update(inputStr.getBytes("iso-8859-1"), 0, i... | false |
4,723 | 914,073 | 8,912,110 | 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 {
... | private static void salvarArtista(Artista artista) throws Exception {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = C3P0Pool.getConnection();
String sql = "insert into artista VALUES (?,?,?,?,?,?,?)";
ps = conn.prepareStatement(sql);
... | false |
4,724 | 7,390,666 | 2,103,971 | private Source getStylesheetSource(String stylesheetResource) throws ApplicationContextException {
if (LOG.isDebugEnabled()) {
LOG.debug("Loading XSLT stylesheet from " + stylesheetResource);
}
try {
URL url = this.getClass().getClassLoader().getResource(stylesheetRes... | @Override
protected void writeFile() {
super.writeFile();
try {
String tagListFilePath = file.toURI().toASCIIString();
tagListFilePath = tagListFilePath.substring(0, tagListFilePath.lastIndexOf(FileManager.GLIPS_VIEW_EXTENSION)) + FileManager.TAG_LIST_FILE_EXTENSION;
... | false |
4,725 | 8,009,241 | 10,671,991 | public static final synchronized String md5(final String data) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
md.update(data.getBytes());
final byte[] b = md.digest();
return toHexString(b);
} catch (final Exception e) {
}
... | public static String md5(String value) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(value.getBytes());
return bytesToString(messageDigest.digest());
} catch (Exception ex) {
Tools.logException(Tools.class... | true |
4,726 | 19,660,641 | 17,420,328 | public static String MD5_hex(String p) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
md.update(p.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
String ret = hash.toString(16);
return ret;
} catch (... | public static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | true |
4,727 | 11,265,072 | 10,778,361 | public static void unzip(File sourceZipFile, File unzipDestinationDirectory, FileFilter filter) throws IOException {
unzipDestinationDirectory.mkdirs();
if (!unzipDestinationDirectory.exists()) {
throw new IOException("Unable to create destination directory: " + unzipDestinationDirectory... | 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... | true |
4,728 | 6,312,931 | 18,032,425 | int openBinaryLut(FileInfo fi, boolean isURL, boolean raw) throws IOException {
InputStream is;
if (isURL) is = new URL(fi.url + fi.fileName).openStream(); else is = new FileInputStream(fi.directory + fi.fileName);
DataInputStream f = new DataInputStream(is);
int nColors = 256;
... | public boolean reject(String surl, ProgressMonitor mon) throws IllegalArgumentException {
DocumentBuilder builder = null;
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
URISplit split = URISplit.parse(surl);
URL url = new URL(split.file... | false |
4,729 | 1,699,613 | 1,639,107 | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | public void copy(File source, File destination) {
try {
FileInputStream fileInputStream = new FileInputStream(source);
FileOutputStream fileOutputStream = new FileOutputStream(destination);
FileChannel inputChannel = fileInputStream.getChannel();
FileChannel o... | true |
4,730 | 12,816,795 | 9,760,847 | public static FileChannel getFileChannel(Object o) throws IOException {
Class c = o.getClass();
try {
Method m = c.getMethod("getChannel", null);
return (FileChannel) m.invoke(o, null);
} catch (IllegalAccessException x) {
} catch (NoSuchMethodException x) {
... | public static String getServerVersion() throws IOException {
URL url;
url = new URL(CHECKVERSIONURL);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(false);
httpURLConne... | true |
4,731 | 22,441,245 | 19,322,942 | public void saveDraft(org.hibernate.Session hsession, Session session, String repositoryName, int ideIdint, String to, String cc, String bcc, String subject, String body, Vector attachments, boolean isHtml, String charset, InternetHeaders headers, String priority) throws MailException {
try {
if... | @Test
public void test_lookupType() throws Exception {
URL url = new URL(baseUrl + "/lookupType/Tri");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/json");
... | false |
4,732 | 19,002,330 | 9,591,960 | public static void copyFile(File src, File dst) throws ResourceNotFoundException, ParseErrorException, Exception {
if (src.getAbsolutePath().endsWith(".vm")) {
copyVMFile(src, dst.getAbsolutePath().substring(0, dst.getAbsolutePath().lastIndexOf(".vm")));
} else {
FileInputStr... | protected Object serveFile(MyServerSocket socket, String filenm, URL url) {
PrintStream out = null;
InputStream in = null;
long len = 0;
try {
out = new PrintStream(socket.getOutputStream());
in = url.openStream();
len = in.available();
} c... | false |
4,733 | 11,798,810 | 461,629 | private synchronized Document executeHttpMethod(final HttpUriRequest httpRequest) throws UnauthorizedException, ThrottledException, ApiException {
if (!isNextRequestAllowed()) {
try {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Wait " + WAITING_TIME + "ms for... | 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... | false |
4,734 | 601,908 | 14,960,576 | 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 String encrypt(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
throw new WebDocRuntimeException(ex);
}
md.update(text.getBytes());
BigInteger hash = new ... | false |
4,735 | 1,428,038 | 7,395,775 | public void initializeWebInfo() throws MalformedURLException, IOException, DOMException {
Tidy tidy = new Tidy();
URL url = new URL(YOUTUBE_URL + videoId);
InputStream in = url.openConnection().getInputStream();
Document doc = tidy.parseDOM(in, null);
Element e = doc.getDocum... | private void copyReportFile(ServletRequest req, String reportName, Report report) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, FileNotFoundException, IOException {
String reportFileName = (String) Class.forName("org.eclipse.birt.report.utility.Para... | false |
4,736 | 9,819,955 | 4,068,544 | @Override
public void write(OutputStream output) throws IOException, WebApplicationException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final GZIPOutputStream gzipOs = new GZIPOutputStream(baos);
IOUtils.copy(is, gzipOs);
baos.close();
gzipOs.close(... | public static void saveDigraph(mainFrame parentFrame, DigraphView digraphView, File tobeSaved) {
DigraphFile digraphFile = new DigraphFile();
DigraphTextFile digraphTextFile = new DigraphTextFile();
try {
if (!DigraphFile.DIGRAPH_FILE_EXTENSION.equals(getExtension(tobeSaved))) {
... | true |
4,737 | 324,681 | 13,586,003 | public boolean import_status(String filename) {
int pieceId;
int i, j, col, row;
int rotation;
int number;
boolean byurl = false;
e2piece temppiece;
String lineread;
StringTokenizer tok;
BufferedReader entree;
try {
if (byur... | public ObservationResult[] call(String url, String servicename, String srsname, String version, String offering, String observed_property, String responseFormat) {
System.out.println("GetObservationBasic.call url " + url);
URL service = null;
URLConnection connection = null;
ArrayLis... | false |
4,738 | 19,660,598 | 23,206 | private static void replaceEntityMappings(File signserverearpath, File entityMappingXML) throws ZipException, IOException {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(signserverearpath));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream tempZip =... | public static BufferedReader getUserInfoStream(String name) throws IOException {
BufferedReader in;
try {
URL url = new URL("http://www.spoj.pl/users/" + name.toLowerCase() + "/");
in = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (MalformedURL... | false |
4,739 | 5,891,092 | 1,162,514 | public static IProject createSimplemodelEnabledJavaProject() throws CoreException {
IWorkspaceDescription desc = ResourcesPlugin.getWorkspace().getDescription();
desc.setAutoBuilding(false);
ResourcesPlugin.getWorkspace().setDescription(desc);
String name = "TestProject";
for... | private LSInput resolveResource(String aPublicId, String aSystemId, String aBaseURI, boolean baseUsed) {
LSInput lsInput = new DefaultLSInput();
lsInput.setPublicId(aPublicId);
lsInput.setSystemId(aSystemId);
String base = null;
try {
int baseEndPos = -1;
... | false |
4,740 | 10,425,169 | 15,402,323 | private void getRandomGUID(boolean secure, Object o) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
... | public static String getMd5Hash(String text) {
StringBuffer result = new StringBuffer(32);
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
Formatter f = new Formatter(result);
byte[] digest = md5.digest();
... | true |
4,741 | 22,950,125 | 16,337,161 | private boolean importPKC(String keystoreLocation, String pw, String pkcFile, String alias) {
boolean imported = false;
KeyStore ks = null;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new BufferedInputStream(new FileInputStream(keystoreLocation... | public String index(URL url) {
InputStream is = null;
try {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setInstanceFollowRedirects(true);
urlConnection.setAllowUserInteraction(false);
System.setProperty("su... | false |
4,742 | 21,808,206 | 14,053,971 | public static void main(String args[]) {
try {
URL url = new URL("http://dev.activeanalytics.ca/piwik.php?url=http%3a%2f%2flyricscatcher.sourceforge.net%2fpiwik.php&action_name=&idsite=1&res=1440x900&h=17&m=2&s=16&fla=1&dir=1&qt=1&realp=1&pdf=1&wma=1&java=1&cookie=0&title=JAVAACCESS&urlref=http%... | private static String fetchUrl(String url, boolean keepLineEnds) throws IOException, MalformedURLException {
URLConnection destConnection = (new URL(url)).openConnection();
BufferedReader br;
String inputLine;
StringBuffer doc = new StringBuffer();
String contentEncoding;
... | true |
4,743 | 22,625,096 | 22,010,538 | public void run() {
long starttime = (new Date()).getTime();
Matcher m = Pattern.compile("(\\S+);(\\d+)").matcher(Destination);
boolean completed = false;
if (OutFile.length() > IncommingProcessor.MaxPayload) {
logger.warn("Payload is too large!");
close();
... | private byte[] getBytes(String resource) throws IOException {
InputStream is = HttpServletFileDownloadTest.class.getResourceAsStream(resource);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(is, out);
IOUtils.closeQuietly(is);
return out.toByteArray();
... | true |
4,744 | 679,959 | 20,103,762 | 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 boolean backupLastAuditSchema(File lastAuditSchema) {
boolean isBkupFileOK = false;
String writeTimestamp = DateFormatUtils.format(new java.util.Date(), configFile.getTimestampPattern());
File target = new File(configFile.getAuditSchemaFileDir() + File.separator + configFile.getAuditS... | true |
4,745 | 811,157 | 7,655,679 | 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 void copy(String sourceName, String destName) throws IOException {
File src = new File(sourceName);
File dest = new File(destName);
BufferedInputStream source = null;
BufferedOutputStream destination = null;
byte[] buffer;
int bytes_read;
long by... | true |
4,746 | 12,940,372 | 12,763,612 | private String encryptPassword(String password) {
String result = password;
if (password != null) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(password.getBytes());
BigInteger hash = ... | @Override
protected String doInBackground(MarketData... market) {
publishProgress(-1);
InputStream input = null;
OutputStream output = null;
long lenghtOfFile = 0;
int lengthRead = 0;
try {
HttpGet newReq = new HttpGet(market[0].apkURL);
Ht... | false |
4,747 | 22,690,093 | 22,137,915 | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException {
FileChannel inputChannel = new FileInputStream(inputFile).getChannel();
FileChannel outputChannel = new FileOutputStream(outputFile).getChannel();
try {
inpu... | true |
4,748 | 23,596,949 | 9,830,269 | public static void copyFile(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf ... | 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... | true |
4,749 | 2,711,645 | 8,106,130 | 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.... | private void copyFile(File source, File dest) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
so... | true |
4,750 | 1,676,011 | 7,505,934 | ServiceDescription getServiceDescription() throws ConfigurationException {
final XPath pathsXPath = this.xPathFactory.newXPath();
try {
final Node serviceDescriptionNode = (Node) pathsXPath.evaluate(ConfigurationFileTagsV1.SERVICE_DESCRIPTION_ELEMENT_XPATH, this.configuration, XPathConst... | public static byte[] generateAuthId(String userName, String password) {
byte[] ret = new byte[16];
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
String str = userName + password;
messageDigest.update(str.getBytes());
ret = messa... | true |
4,751 | 3,767,763 | 7,126,817 | @Override
public long insertStatement(String sql) {
Statement statement = null;
try {
statement = getConnection().createStatement();
long result = statement.executeUpdate(sql.toString());
if (result == 0) log.warn(sql + " result row count is 0");
g... | private static String getRegistrationClasses() {
CentralRegistrationClass c = new CentralRegistrationClass();
String name = c.getClass().getCanonicalName().replace('.', '/').concat(".class");
try {
Enumeration<URL> urlEnum = c.getClass().getClassLoader().getResources("META-INF/MA... | false |
4,752 | 16,687,411 | 16,085,714 | private ByteBuffer readProgram(URL url) throws IOException {
StringBuilder program = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = in.readLine()) != null) ... | public int delete(BusinessObject o) throws DAOException {
int delete = 0;
Currency curr = (Currency) o;
try {
PreparedStatement pst = connection.prepareStatement(XMLGetQuery.getQuery("DELETE_CURRENCY"));
pst.setInt(1, curr.getId());
delete = pst.executeUpd... | false |
4,753 | 7,366,687 | 38,361 | public static void DecodeMapFile(String mapFile, String outputFile) throws Exception {
byte magicKey = 0;
byte[] buffer = new byte[2048];
int nread;
InputStream map;
OutputStream output;
try {
map = new FileInputStream(mapFile);
} catch (Exception ... | 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 |
4,754 | 15,599,613 | 10,941,155 | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | 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 |
4,755 | 14,504,556 | 21,462,055 | public void doNew(Vector userId, String shareFlag, String folderId) throws AddrException {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement ps = null;
ResultSet rset = null;
String sql = "insert into " + SHARE_TABLE + " values(?,?,?)";
try {
... | public int unindexRecord(String uuid) throws SQLException, CatalogIndexException {
Connection con = null;
boolean autoCommit = true;
PreparedStatement st = null;
int nRows = 0;
StringSet fids = new StringSet();
if (cswRemoteRepository.isActive()) {
StringS... | true |
4,756 | 8,908,943 | 12,528,437 | public static String GetMD5SUM(String s) throws NoSuchAlgorithmException {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(s.getBytes());
byte messageDigest[] = algorithm.digest();
String md5sum = Base64.encode(messageDigest);
... | public static void main(String[] args) throws Exception {
SocketConnector socketConnector = new SocketConnector();
socketConnector.setPort(6080);
SslSocketConnector sslSocketConnector = new SslSocketConnector();
sslSocketConnector.setPort(6443);
String serverKeystore = MockHt... | false |
4,757 | 810,724 | 16,966,539 | 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 MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5hash)... | false |
4,758 | 20,641,594 | 6,190,163 | public static InputStream getInputStreamFromUrl(String url) {
InputStream content = null;
try {
HttpGet httpGet = new HttpGet(url);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpGet);
content = response... | public 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... | false |
4,759 | 21,461,424 | 3,533,517 | public static final void copy(String source, String destination) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
java.nio.channels.FileChannel channelSrc = fis.get... | public String loadGeneratorXML() {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(this.getFolienKonvertierungsServer().getUrl());
System.out.println("Connected to " + this.getFolienKonvertierungsServer().getUrl() + ".");
System.out.print... | false |
4,760 | 3,541,461 | 8,764,605 | public static String get(String strUrl) {
if (NoMuleRuntime.DEBUG) System.out.println("GET : " + strUrl);
try {
URL url = new URL(strUrl);
URLConnection conn = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()... | public void test1() throws Exception {
String senha = "minhaSenha";
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(senha.getBytes());
byte[] bytes = digest.digest();
BASE64Encoder encoder = new BASE64Encoder();
String senhaCodificada = encode... | false |
4,761 | 83,802 | 21,321,506 | private void doTask() {
try {
log("\n\n\n\n\n\n\n\n\n");
log(" =================================================");
log(" = Starting PSCafePOS =");
log(" =================================================");
log(" = An o... | public static int convertImage(InputStream is, OutputStream os, String command) throws IOException, InterruptedException {
if (logger.isInfoEnabled()) {
logger.info(command);
}
Process p = Runtime.getRuntime().exec(command);
ByteArrayOutputStream errOut = new ByteArrayOut... | true |
4,762 | 13,356,869 | 380,318 | public void createZip(File zipFileName, Vector<File> selected) {
try {
byte[] buffer = new byte[4096];
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFileName), 8096));
out.setLevel(Deflater.BEST_COMPRESSION);
out.se... | static void conditionalCopyFile(File dst, File src) throws IOException {
if (dst.equals(src)) return;
if (!dst.isFile() || dst.lastModified() < src.lastModified()) {
System.out.println("Copying " + src);
InputStream is = new FileInputStream(src);
OutputStream os =... | true |
4,763 | 20,661,433 | 975,289 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | public static void copy(File from, File to, CopyMode mode) throws IOException {
if (!from.exists()) {
IllegalArgumentException e = new IllegalArgumentException("Source doesn't exist: " + from.getCanonicalFile());
log.throwing("Utils", "copy", e);
throw e;
}
... | true |
4,764 | 13,547,845 | 12,962,189 | 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);
... | private boolean verifyPassword(String password, byte[] hash) {
boolean returnValue = false;
try {
MessageDigest msgDigest = MessageDigest.getInstance("SHA-1");
msgDigest.update(password.getBytes("UTF-8"));
byte[] digest = msgDigest.digest();
returnValu... | false |
4,765 | 1,951,103 | 10,151,252 | private List<File> ungzipFile(File directory, File compressedFile) throws IOException {
List<File> files = new ArrayList<File>();
TarArchiveInputStream in = new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(compressedFile)));
try {
TarArchiveEntry entry = in.getNe... | public static void upload(FTPDetails ftpDetails) {
FTPClient ftp = new FTPClient();
try {
String host = ftpDetails.getHost();
logger.info("Connecting to ftp host: " + host);
ftp.connect(host);
logger.info("Received reply from ftp :" + ftp.getReplyStrin... | true |
4,766 | 22,899,260 | 15,102,902 | public static String sha1Hash(String input) {
try {
MessageDigest sha1Digest = MessageDigest.getInstance("SHA-1");
sha1Digest.update(input.getBytes());
return byteArrayToString(sha1Digest.digest());
} catch (Exception e) {
logger.error(e.getMessage(), ... | public static void translateTableMetaData(String baseDir, String tableName, NameSpaceDefinition nsDefinition) throws Exception {
setVosiNS(baseDir, "table", nsDefinition);
String filename = baseDir + "table.xsl";
Scanner s = new Scanner(new File(filename));
PrintWriter fw = new Print... | false |
4,767 | 14,581,601 | 8,117,581 | public static void fileCopy(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 ... | public static String getStringFromInputStream(InputStream in) throws Exception {
CachedOutputStream bos = new CachedOutputStream();
IOUtils.copy(in, bos);
in.close();
bos.close();
return bos.getOut().toString();
}
| true |
4,768 | 20,251,886 | 8,428,267 | private void initJarURL() {
try {
URL url = getKwantuJarURLInMavenRepo(artifactId, version);
File tempJarFile = File.createTempFile(artifactId + "-" + version, ".jar");
OutputStream out = new FileOutputStream(tempJarFile);
InputStream in = url.openStream();
... | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException nsae) {
nsae.printStackTrace();
}
}
try {
digest.up... | false |
4,769 | 1,811,744 | 778,678 | public void testSimpleHttpPostsWithContentLength() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
rnd... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
4,770 | 5,848,851 | 14,763,206 | private static InputStream stream(String input) {
try {
if (input.startsWith("http://")) return URIFactory.url(input).openStream(); else return stream(new File(input));
} catch (IOException e) {
throw new RuntimeException(e);
} catch (URISyntaxException e) {
... | public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException {
FileChannel inputChannel = new FileInputStream(inputFile).getChannel();
FileChannel outputChannel = new FileOutputStream(outputFile).getChannel();
try {
inpu... | false |
4,771 | 750,310 | 21,946,945 | public static boolean changeCredentials() {
boolean passed = false;
boolean credentials = false;
HashMap info = null;
Debug.log("Main.changeCredentials", "show dialog for userinfo");
info = getUserInfo();
if ((Boolean) info.get("submit")) {
try {
... | public static String SHA1(String text) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes());
byte byteData[] = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
... | true |
4,772 | 19,002,330 | 12,247,514 | public static void copyFile(File src, File dst) throws ResourceNotFoundException, ParseErrorException, Exception {
if (src.getAbsolutePath().endsWith(".vm")) {
copyVMFile(src, dst.getAbsolutePath().substring(0, dst.getAbsolutePath().lastIndexOf(".vm")));
} else {
FileInputStr... | public static void main(String[] args) throws Exception {
if (args.length != 2) {
PrintUtil.prt("arguments: sourcefile, destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | true |
4,773 | 20,684,330 | 9,426,072 | public String downloadToSdCard(String localFileName, String suffixFromHeader, String extension) {
InputStream in = null;
FileOutputStream fos = null;
String absolutePath = null;
try {
Log.i(TAG, "Opening URL: " + url);
StreamAndHeader inAndHeader = HTTPUtils.o... | public void addButtons() {
BufferedImage bufImage = null;
BufferedImage bufImage1 = null;
for (int i = 0; i < urls.size(); i++) {
String url = (String) urls.elementAt(i);
if (url.contains(java.util.ResourceBundle.getBundle("com/jjcp/resources/Strings").getString("IHER... | false |
4,774 | 19,752,875 | 6,095,507 | public void resumereceive(HttpServletRequest req, HttpServletResponse resp, SessionCommand command) {
setHeader(resp);
try {
logger.debug("ResRec: Resume a 'receive' session with session id " + command.getSession() + " this client already received " + command.getLen() + " bytes");
... | private StringBuffer hashPassword(StringBuffer password, String mode) {
MessageDigest m = null;
StringBuffer hash = new StringBuffer();
try {
m = MessageDigest.getInstance(mode);
m.update(password.toString().getBytes("UTF8"));
} catch (NoSuchAlgorithmException... | false |
4,775 | 10,301,544 | 18,744,498 | 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 read(String url) {
session.beginTransaction();
try {
Document doc = reader.read(new URL(url).openStream());
Element root = doc.getRootElement();
Dict dic = new Dict();
Vector<Cent> v = new Vector<Cent>();
for (Object o : root.e... | false |
4,776 | 3,054,600 | 21,900,384 | 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();
... | @Override
protected ActionForward executeAction(ActionMapping mapping, ActionForm form, User user, HttpServletRequest request, HttpServletResponse response) throws Exception {
long resourceId = ServletRequestUtils.getLongParameter(request, "resourceId", 0L);
String attributeIdentifier = request.... | true |
4,777 | 12,571,472 | 16,382,503 | public static ParsedXML parseXML(URL url) throws ParseException {
try {
InputStream is = url.openStream();
ParsedXML px = parseXML(is);
is.close();
return px;
} catch (IOException e) {
throw new ParseException("could not read from URL" + ur... | void copyTo(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException {
if (shouldMock()) {
return;
}
assert httpRequest != null;
assert httpResponse != null;
final long start = System.currentTimeMillis();
try {
final... | false |
4,778 | 7,757,210 | 3,575,255 | @RequestMapping("/download")
public void download(HttpServletRequest request, HttpServletResponse response) {
InputStream input = null;
ServletOutputStream output = null;
try {
String savePath = request.getSession().getServletContext().getRealPath("/upload");
Stri... | public static void sendSimpleHTMLMessage(Map<String, String> recipients, String object, String htmlContent, String from) {
String message;
try {
File webinfDir = ClasspathUtils.getClassesDir().getParentFile();
File mailDir = new File(webinfDir, "mail");
File templ... | true |
4,779 | 18,565,406 | 19,741,469 | public Stopper(String stopWordsFile) {
try {
BufferedReader br = null;
FileReader fr = null;
if (stopWordsFile.startsWith("http")) {
URL url = new URL(stopWordsFile);
br = new BufferedReader(new InputStreamReader(url.openStream()));
... | public static InputStream getData(DataTransferDescriptor desc, GlobusCredential creds) throws Exception {
URL url = new URL(desc.getUrl());
if (url.getProtocol().equals("http")) {
URLConnection conn = url.openConnection();
conn.connect();
return conn.getInputStrea... | false |
4,780 | 20,239,268 | 8,766,831 | public static File[] splitFile(FileValidator validator, File source, long target_length, File todir, String prefix) {
if (target_length == 0) return null;
if (todir == null) {
todir = new File(System.getProperty("java.io.tmpdir"));
}
if (prefix == null || prefix.equals(""... | public static byte[] loadFile(File file) throws IOException {
BufferedInputStream in = null;
ByteArrayOutputStream sink = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
sink = new ByteArrayOutputStream();
IOUtils.copy(in, sink);
... | true |
4,781 | 16,464,790 | 9,830,269 | private void fileCopy(final File src, final File dest) throws IOException {
final FileChannel srcChannel = new FileInputStream(src).getChannel();
final FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChan... | 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... | true |
4,782 | 3,800,349 | 8,389,315 | private boolean _copyPath(String source, String destination, Object handler) {
try {
FileInputStream fis = new FileInputStream(_fullPathForPath(source));
FileOutputStream fos = new FileOutputStream(_fullPathForPath(destination));
byte[] buffer = new byte[fis.available()];... | public void copy(File s, File t) throws IOException {
FileChannel in = (new FileInputStream(s)).getChannel();
FileChannel out = (new FileOutputStream(t)).getChannel();
in.transferTo(0, s.length(), out);
in.close();
out.close();
}
| true |
4,783 | 845,651 | 15,882,289 | public static void main(String[] args) throws IOException, WrongFormatException, URISyntaxException {
System.out.println(new URI("google.com.ua.css").toString());
Scanner scc = new Scanner(System.in);
System.err.print(scc.nextLine().substring(1));
ServerSocket s = new ServerSocket(53... | public GetMessages(String messageType) {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetMessages";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "messages.xml";
try {
String urldata = urlString + "?username=" + URL... | true |
4,784 | 13,753,266 | 4,794,470 | public static void s_copy(FileInputStream fis, FileOutputStream fos) throws Exception {
FileChannel in = fis.getChannel();
FileChannel out = fos.getChannel();
in.transferTo(0, in.size(), out);
if (in != null) in.close();
if (out != null) out.close();
}
| private void load() throws SQLException {
Connection conn = null;
Statement stmt = null;
try {
conn = FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
ClearData.clearTables(stmt);
stmt.execut... | false |
4,785 | 13,753,266 | 20,623,710 | public static void s_copy(FileInputStream fis, FileOutputStream fos) throws Exception {
FileChannel in = fis.getChannel();
FileChannel out = fos.getChannel();
in.transferTo(0, in.size(), out);
if (in != null) in.close();
if (out != null) out.close();
}
| public static synchronized void repartition(File[] sourceFiles, File targetDirectory, String prefix, long maxUnitBases, long maxUnitEntries) throws Exception {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) throw new Exception("Could not create directory " + targetDirectory.getA... | true |
4,786 | 5,266,380 | 12,454,182 | public WordEntry[] getVariants(String word) throws MatchPackException {
String upperWord = word.toUpperCase();
if (variantsDictionary == null) {
try {
long start = System.currentTimeMillis();
URL url = this.getClass().getResource("varlex.dic");
... | public void excluirTopico(Integer idDisciplina) throws Exception {
String sql = "DELETE from topico WHERE id_disciplina = ?";
PreparedStatement stmt = null;
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1, idDisciplina);
stmt.executeUpdate();
... | false |
4,787 | 14,138,097 | 346,058 | public static void copy(File src, File dest) throws IOException {
if (dest.exists() && dest.isFile()) {
logger.fine("cp " + src + " " + dest + " -- Destination file " + dest + " already exists. Deleting...");
dest.delete();
}
final File parent = dest.getParentFile();
... | 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 |
4,788 | 10,271,558 | 19,442,138 | private void processBasicContent() {
String[] packageNames = sourceCollector.getPackageNames();
for (int i = 0; i < packageNames.length; i++) {
XdcSource[] sources = sourceCollector.getXdcSources(packageNames[i]);
File dir = new File(outputDir, packageNames[i]);
d... | public static final void copyFile(File source, File target) {
try {
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(target).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
... | true |
4,789 | 5,036,265 | 3,282,600 | public void save() throws IOException {
CodeTimer saveTimer;
if (!dirty) {
return;
}
saveTimer = new CodeTimer("PackedFile.save");
saveTimer.setEnabled(log.isDebugEnabled());
File newFile = new File(tmpDir.getAbsolutePath() + "/" + new GUID() + ".pak");
... | private static void copyFile(String src, String dst) throws InvocationTargetException {
try {
FileChannel srcChannel;
srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel();
dstChannel.transferFrom(s... | true |
4,790 | 15,826,299 | 15,958,994 | public static void printResponseHeaders(String address) {
logger.info("Address: " + address);
try {
URL url = new URL(address);
URLConnection conn = url.openConnection();
for (int i = 0; ; i++) {
String headerName = conn.getHeaderFieldKey(i);
... | public String loadURLString(java.net.URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String s = "";
while (br.ready() && s != null) {
s = br.readLine();
... | false |
4,791 | 16,545,678 | 16,851,956 | private boolean copyFile(File inFile, File outFile) {
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new FileReader(inFile));
writer = new BufferedWriter(new FileWriter(outFile));
while (reader.ready()) {
... | @Test
public void testCascadeTraining() throws IOException {
File temp = File.createTempFile("fannj_", ".tmp");
temp.deleteOnExit();
IOUtils.copy(this.getClass().getResourceAsStream("parity8.train"), new FileOutputStream(temp));
Fann fann = new FannShortcut(8, 1);
Trainer... | true |
4,792 | 13,600,574 | 21,756,553 | public String getWeather(String cityName, String fileAddr) {
try {
URL url = new URL("http://www.google.com/ig/api?hl=zh_cn&weather=" + cityName);
InputStream inputstream = url.openStream();
String s, str;
BufferedReader in = new BufferedReader(new InputStream... | public static List<String> list() throws IOException {
List<String> providers = new ArrayList<String>();
Enumeration<URL> urls = ClassLoader.getSystemResources("sentrick.classifiers");
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
String provider = nu... | true |
4,793 | 4,349,491 | 17,874,921 | public void migrateTo(String newExt) throws IOException {
DigitalObject input = new DigitalObject.Builder(Content.byReference(new File(AllJavaSEServiceTestsuite.TEST_FILE_LOCATION + "PlanetsLogo.png").toURI().toURL())).build();
System.out.println("Input: " + input);
FormatRegistry format = F... | 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 |
4,794 | 9,295,754 | 6,085,964 | public static String encryptPassword(String password) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("SHA1");
digest.update(password.getBytes("UTF-8"));
byte[] hash = digest.digest();
StringBuffer buf = new StringBuffer();
f... | private static String readStreamToString(InputStream is, boolean passInVelocity, String tplName, Map<String, Object> templateVarsMap) throws IOException {
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
if (passInVelocity) {
return tpl.formatStr(sw.toString()... | false |
4,795 | 369,844 | 1,102,936 | private boolean enregistreToi() {
PrintWriter lEcrivain;
String laDest = "./img_types/" + sonImage;
if (!new File("./img_types").exists()) {
new File("./img_types").mkdirs();
}
try {
FileChannel leFicSource = new FileInputStream(sonFichier).getChannel(... | public static void writeInputStreamToFile(final InputStream stream, final File target) {
long size = 0;
FileOutputStream fileOut;
try {
fileOut = new FileOutputStream(target);
size = IOUtils.copyLarge(stream, fileOut);
} catch (FileNotFoundException e) {
... | true |
4,796 | 17,957,004 | 5,264,337 | @Override
public List<Type> getArtifactTypes(String organisationName, String artifactName, String version) {
if (cache != null) {
Date d;
try {
d = cache.getTypesLastUpdate(organisationName, artifactName, version);
if (d.compareTo(cacheExpirationDa... | @Override
public AC3DModel loadModel(URL url, String skin) throws IOException, IncorrectFormatException, ParsingErrorException {
boolean baseURLWasNull = setBaseURLFromModelURL(url);
AC3DModel model = loadModel(url.openStream(), skin);
if (baseURLWasNull) {
popBaseURL();
... | false |
4,797 | 14,843,583 | 21,902,615 | public static String encryptSHA(String pwd) throws NoSuchAlgorithmException {
MessageDigest d = java.security.MessageDigest.getInstance("SHA-1");
d.reset();
d.update(pwd.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(d.digest());
}
| public static String encrypt(String plaintext) throws EncryptionException {
if (plaintext == null) {
throw new EncryptionException();
}
try {
final MessageDigest md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
ret... | true |
4,798 | 7,427,547 | 10,846,738 | public List tree(String cat, int branch) {
Pattern p = Pattern.compile("<a href=\"javascript:checkBranch\\(([0-9]+), 'true'\\)\">([^<]*)</a>");
Matcher m;
List res = new ArrayList();
URL url;
HttpURLConnection conn;
System.out.println();
try {
url ... | private static <OS extends OutputStream> OS getUnzipAndDecodeOutputStream(InputStream inputStream, final OS outputStream) {
final PipedOutputStream pipedOutputStream = new PipedOutputStream();
final List<Throwable> ungzipThreadThrowableList = new LinkedList<Throwable>();
Writer decoderWriter... | false |
4,799 | 22,075,089 | 2,831,663 | public static void executa(String arquivo, String filial, String ip) {
String drive = arquivo.substring(0, 2);
if (drive.indexOf(":") == -1) drive = "";
Properties p = Util.lerPropriedades(arquivo);
String servidor = p.getProperty("servidor");
String impressora = p.getPropert... | public void onMessage(Message message) {
LOG.debug("onMessage");
DownloadMessage downloadMessage;
try {
downloadMessage = new DownloadMessage(message);
} catch (JMSException e) {
LOG.error("JMS error: " + e.getMessage(), e);
return;
}
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.