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,900 | 12,448,713 | 2,857,623 | private void writeGif(String filename, String outputFile) throws IOException {
File file = new File(filename);
InputStream in = new FileInputStream(file);
FileOutputStream fout = new FileOutputStream(outputFile);
int totalRead = 0;
int readBytes = 0;
int blockSize = 6... | private void copy(File src, File dest, String name) {
File srcFile = new File(src, name);
File destFile = new File(dest, name);
if (destFile.exists()) {
if (destFile.lastModified() == srcFile.lastModified()) return;
destFile.delete();
}
FileChannel in ... | true |
4,901 | 15,760,850 | 2,215,295 | public static void main(String[] args) {
File container = new File(ArchiveFeature.class.getProtectionDomain().getCodeSource().getLocation().toURI());
if (container == null) {
throw new RuntimeException("this use-case isn't being invoked from the executable jar");
}
JarFil... | static ConversionMap create(String file) {
ConversionMap out = new ConversionMap();
URL url = ConversionMap.class.getResource("data/" + file);
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = in.readLine();
... | false |
4,902 | 297,790 | 19,693,366 | public static String get(String strUrl) {
try {
URL url = new URL(strUrl);
URLConnection conn = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String s = "";
String sRet = "";
... | @Override
public void exec() {
BufferedReader in = null;
try {
URL url = new URL(getUrl());
in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer result = new StringBuffer();
String str;
while ((str = in.readLin... | true |
4,903 | 1,820,410 | 6,680,022 | public static void zipDirectory(String dir, String zipfile) throws IOException, IllegalArgumentException {
File d = new File(dir);
if (!d.isDirectory()) throw new IllegalArgumentException("Not a directory: " + dir);
String[] entries = d.list();
byte[] buffer = new byte[4096];
... | public ResourceMigratorBuilder createResourceMigratorBuilder(NotificationReporter reporter) {
return new ResourceMigratorBuilder() {
public ResourceMigrator getCompletedResourceMigrator() {
return new ResourceMigrator() {
public void migr... | true |
4,904 | 5,883,596 | 6,512,878 | public void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inChannel.siz... | public static String readAsString(final URL url) throws java.io.IOException {
InputStream inputStream = url.openStream();
try {
return readAsString(inputStream);
} finally {
try {
inputStream.close();
} catch (Throwable t) {
}
... | false |
4,905 | 892,621 | 11,324,607 | 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... | @Override
@Transactional
public FileData store(FileData data, InputStream stream) {
try {
FileData file = save(data);
file.setPath(file.getGroup() + File.separator + file.getId());
file = save(file);
File folder = new File(PATH, file.getGroup());
... | true |
4,906 | 19,100,902 | 9,737,790 | public static void saveURL(URL url, Writer writer) throws IOException {
BufferedInputStream in = new BufferedInputStream(url.openStream());
for (int c = in.read(); c != -1; c = in.read()) {
writer.write(c);
}
}
| public String md5Encode(String pass) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md.update(pass.getBytes());
byte[] result = md.digest();
return n... | false |
4,907 | 2,310,752 | 23,439,557 | 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 main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("arguments: sourcefile destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | true |
4,908 | 950,938 | 5,305,335 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public void testRenderRules() {
try {
MappingManager manager = new MappingManager();
OWLOntologyManager omanager = OWLManager.createOWLOntologyManager();
OWLOntology srcOntology;
OWLOntology targetOntology;
manager.loadMapping(rulesDoc.toURL());
... | true |
4,909 | 11,090,449 | 8,570,520 | public static Drawable fetchCachedDrawable(String url) throws MalformedURLException, IOException {
Log.d(LOG_TAG, "Fetching cached : " + url);
String cacheName = md5(url);
checkAndCreateDirectoryIfNeeded();
File r = new File(CACHELOCATION + cacheName);
if (!r.exists()) {
... | public String doAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("doAdd(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) - start");
}
t_informati... | true |
4,910 | 11,288,113 | 8,896,249 | public AssemblyConfig load() {
AssemblyConfig assembly = null;
Digester digester = createParser();
try {
if (inputStream != null) {
if (logger.isDebugEnabled()) {
logger.debug("XML config loader is parsing an inputstream:" + inputStream);
... | Response doSend() throws IOException {
HttpURLConnection connection;
String str = this.headers.get("Authorization");
if (str != null) {
String hs[] = str.split(",");
if (hs[0].startsWith("OAuth ")) {
hs[0] = hs[0].substring("OAuth ".length());
... | false |
4,911 | 22,415,294 | 21,754,657 | private String getRenderedBody(String spec) throws Exception {
log.entering(Rss2MailTask.class.getName(), "getRenderedBody");
final URL url = new URL(spec);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
final InputStream ... | private JButton getButtonImagen() {
if (buttonImagen == null) {
buttonImagen = new JButton();
buttonImagen.setText(Messages.getString("gui.AdministracionResorces.6"));
buttonImagen.setIcon(new ImageIcon(getClass().getResource("/es/unizar/cps/tecnoDiscap/data/icons/view_si... | false |
4,912 | 4,407,823 | 21,374,041 | public static void copyFolderStucture(String strPath, String dstPath) throws IOException {
Constants.iLog.LogInfoLine("copying " + strPath);
File src = new File(strPath);
File dest = new File(dstPath);
if (src.isDirectory()) {
dest.mkdirs();
String list[] = sr... | public void writeToStream(OutputStream out) throws IOException {
InputStream result = null;
if (tempFile != null) {
InputStream input = new BufferedInputStream(new FileInputStream(tempFile));
IOUtils.copy(input, out);
IOUtils.closeQuietly(input);
} else if... | true |
4,913 | 2,467,221 | 3,246,556 | void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
out.close... | 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... | true |
4,914 | 11,188,585 | 14,843,540 | public static void initStaticStuff() {
Enumeration<URL> urls = null;
try {
urls = Play.class.getClassLoader().getResources("play.static");
} catch (Exception e) {
}
while (urls != null && urls.hasMoreElements()) {
URL url = urls.nextElement();
... | @Test
public void shouldDownloadFileUsingPublicLink() throws Exception {
String bucketName = "test-" + UUID.randomUUID();
Service service = new WebClientService(credentials);
service.createBucket(bucketName);
File file = folder.newFile("foo.txt");
FileUtils.writeStringToF... | false |
4,915 | 7,954,779 | 601,526 | 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... | 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,916 | 4,591,684 | 9,958,260 | public static void copyDirs(File sourceDir, File destDir) throws IOException {
if (!destDir.exists()) destDir.mkdirs();
for (File file : sourceDir.listFiles()) {
if (file.isDirectory()) {
copyDirs(file, new File(destDir, file.getName()));
} else {
... | public String doAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
UploadFileForm vo = (UploadFileForm) form;
FormFile file = vo.getFile();
String inforId = request.getParameter("inforId");
System.out.println("info... | true |
4,917 | 6,644,748 | 23,069,799 | public static void initialize(Monitor monitor, final JETEmitter jetEmitter) throws JETException {
IProgressMonitor progressMonitor = BasicMonitor.toIProgressMonitor(monitor);
progressMonitor.beginTask("", 10);
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_G... | 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(... | false |
4,918 | 13,139,266 | 8,309,142 | public static String encripta(String senha) throws GCIException {
LOGGER.debug(INICIANDO_METODO + "encripta(String)");
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(senha.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
... | public boolean check(String password) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes("ISO-8859-1"));
md.update((byte) ':');
md.update(realm.getBytes("ISO-8859-1"));
md.update((by... | true |
4,919 | 2,113,293 | 1,854,053 | 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 handle(String s, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, int i) throws IOException, ServletException {
expected = new StringBuilder();
System.out.println("uri: " + httpServletRequest.getRequestURI());
... | true |
4,920 | 12,973,146 | 11,322,572 | public static void copyFile(String fromFile, String toFile) {
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
to = new FileOutputStream(toFile);
byte[] buffer = new byte[4096];
int bytesRead;... | private void preprocessImages(GeoImage[] detailedImages) throws IOException {
for (int i = 0; i < detailedImages.length; i++) {
BufferedImage img = loadImage(detailedImages[i].getPath());
detailedImages[i].setLatDim(img.getHeight());
detailedImages[i].setLonDim(img.getWid... | true |
4,921 | 22,832,422 | 21,925,739 | private void backupOriginalFile(String myFile) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_S");
String datePortion = format.format(date);
try {
FileInputStream fis = new FileInputStream(myFile);
FileOutputStream fos = n... | public static void buildPerMovieDiffBinary(String completePath, String slopeOneDataFolderName, String slopeOneDataFileName) {
try {
File inFile = new File(completePath + fSep + "SmartGRAPE" + fSep + slopeOneDataFolderName + fSep + slopeOneDataFileName);
FileChannel inC = new FileInpu... | true |
4,922 | 20,019,830 | 14,770,729 | public static void fileCopy(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(sourceFile);
fos = new ... | public static boolean joinFiles(File dest, Collection<File> sources) {
FileInputStream fis = null;
FileOutputStream fos = null;
boolean rv = false;
byte[] buf = new byte[1000000];
int bytesRead = 0;
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
... | true |
4,923 | 15,115,748 | 2,150,993 | public void render(final HttpServletRequest request, final HttpServletResponse response, InputStream inputStream, final Throwable t, final String contentType, final String encoding) throws Exception {
if (contentType != null) {
response.setContentType(contentType);
}
if (encoding... | public static void main(String[] args) {
if (args.length <= 0) {
System.out.println(" *** SQL script generator and executor ***");
System.out.println(" You must specify name of the file with SQL script data");
System.out.println(" Fisrt rows of this file must be:");
... | true |
4,924 | 3,386,551 | 18,810,216 | public static String convertStringToMD5(String toEnc) {
try {
MessageDigest mdEnc = MessageDigest.getInstance("MD5");
mdEnc.update(toEnc.getBytes(), 0, toEnc.length());
return new BigInteger(1, mdEnc.digest()).toString(16);
} catch (Exception e) {
retu... | private void doIt() throws Throwable {
int numCachedTiles = 0;
try {
List<MapTile> backTiles = new ArrayList<MapTile>();
final LatLngRectangle bounds = new LatLngRectangle(new LatLngPoint(south, west), new LatLngPoint(north, east));
final String backMapGuid = "gst... | false |
4,925 | 792,644 | 2,633,238 | 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 getResourceFromURL(URL url, String acceptHeader) throws java.io.IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setUseCaches(false);
urlConnection.setRequestProperty("Accept", acceptHeader);
urlConnection.se... | false |
4,926 | 6,189,963 | 12,082,137 | public String jsFunction_send(String postData) {
URL url = null;
try {
if (_uri.startsWith("http")) {
url = new URL(_uri);
} else {
url = new URL("file://./" + _uri);
}
} catch (MalformedURLException e) {
IdeLog.... | public static Set<Municipality> getMunicipios(String pURL) {
Set<Municipality> result = new HashSet<Municipality>();
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String iniDesErr = "<des>";
String finDesErr = "</des>";
String iniMun = "<muni>";
S... | true |
4,927 | 175,778 | 20,597,304 | public void sendShape(String s) {
try {
URLConnection uc = new URL(url + "&add=" + s).openConnection();
InputStream in = uc.getInputStream();
int b;
while ((b = in.read()) != -1) {
}
in.close();
} catch (IOException ex) {
... | public void addPropertyColumns(WCAChannel destination, Set<Property> properties) throws SQLException {
Session session = HibernateUtil.getSessionFactory().openSession();
Connection con = session.connection();
try {
createPropertyTable(destination);
extendPropertyList(... | false |
4,928 | 3,672,078 | 9,371,509 | public byte[] loadResource(String name) throws IOException {
ClassPathResource cpr = new ClassPathResource(name);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(cpr.getInputStream(), baos);
return baos.toByteArray();
}
| public SWORDEntry ingestDepost(final DepositCollection pDeposit, final ServiceDocument pServiceDocument) throws SWORDException {
try {
ZipFileAccess tZipFile = new ZipFileAccess(super.getTempDir());
LOG.debug("copying file");
String tZipTempFileName = super.getTempDir() +... | true |
4,929 | 18,648,407 | 181,591 | public static void copyFile(File file, File destination) throws Exception {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
out = new BufferedOutputStream(new FileOutputStream(destination))... | 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,930 | 8,990,219 | 10,959,933 | private boolean getCached(Get g) throws IOException {
boolean ret = false;
File f = getCachedFile(g);
if (f.exists()) {
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(f);
os = new FileOutputStr... | public static void main(String[] args) throws Exception {
FileChannel fc = new FileOutputStream("data.txt").getChannel();
fc.write(ByteBuffer.wrap("some text ".getBytes()));
fc.close();
fc = new RandomAccessFile("data.txt", "rw").getChannel();
fc.position(fc.size());
... | true |
4,931 | 339,301 | 4,591,683 | 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 copyFile(File source, File dest) throws IOException {
if (source.equals(dest)) throw new IOException("Source and destination cannot be the same file path");
FileChannel srcChannel = new FileInputStream(source).getChannel();
if (!dest.exists()) dest.createNewFile();
... | true |
4,932 | 6,032,985 | 6,491,370 | private byte[] md5Digest(String pPassword) {
if (pPassword == null) {
throw new NullPointerException("input null text for hashing");
}
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pPassword.getBytes());
return md.digest(... | @Override
protected Object transform(Row inputs) throws FunctionException {
StringBuffer buffer = new StringBuffer();
for (IColumn c : inputs.getColumns()) {
buffer.append(c.getValueAsString() + "|");
}
try {
MessageDigest digest = java.security.MessageDig... | true |
4,933 | 1,884,327 | 7,300,267 | public void actionPerformed(java.awt.event.ActionEvent e) {
try {
setStatus(DigestSignTask.RESET, "");
if (e.getSource() == sd) if (retriveEncodedDigestFromServer()) setStatus(DigestSignTask.RESET, "Inserire il pin e battere INVIO per firmare.");
if (e.getSource() == pwd)... | public void appendMessage(MimeMessage oMsg) throws FolderClosedException, StoreClosedException, MessagingException {
if (DebugFile.trace) {
DebugFile.writeln("Begin DBFolder.appendMessage()");
DebugFile.incIdent();
}
final String EmptyString = "";
if (!((DBSto... | false |
4,934 | 266,990 | 12,909,291 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType(s_contentType);
response.setHeader("Cache-control", "no-cache");
InputStream graphStream = getGraphStream(request);
OutputStream out = getOutputStream(re... | true |
4,935 | 20,983,672 | 20,601,756 | public void sendResponse(DjdocRequest req, HttpServletResponse res) throws IOException {
File file = (File) req.getResult();
InputStream in = null;
try {
in = new FileInputStream(file);
IOUtils.copy(in, res.getOutputStream());
} finally {
if (in !=... | public static File copyFile(String path) {
File src = new File(path);
File dest = new File(src.getName());
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
FileChann... | true |
4,936 | 5,636,800 | 21,266,476 | public static void main(String[] args) throws IOException {
System.setProperty("java.protocol.xfile", "com.luzan.common.nfs");
if (args.length < 1) usage();
final String cmd = args[0];
if ("delete".equalsIgnoreCase(cmd)) {
final String path = getParameter(args, 1);
... | public static String md5(String word) {
MessageDigest alg = null;
try {
alg = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ServletUtils.class.getName()).log(Level.SEVERE, null, ex);
}
alg.reset();
a... | false |
4,937 | 10,634,007 | 922,476 | public static EXISchema getEXISchema(String fileName, Class<?> cls, EXISchemaFactoryErrorHandler compilerErrorHandler) throws IOException, ClassNotFoundException, EXISchemaFactoryException {
EXISchemaFactory schemaCompiler = new EXISchemaFactory();
schemaCompiler.setCompilerErrorHandler(compilerErro... | 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,938 | 1,638,505 | 6,853,664 | private Vendor createVendor() throws SQLException, IOException {
Connection conn = null;
Statement st = null;
String query = null;
ResultSet rs = null;
try {
conn = dataSource.getConnection();
st = conn.createStatement();
query = "insert in... | public static String getServiceContent(String serviceURL) throws IOException {
URL url = new URL(serviceURL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int code = connection.getResponseCo... | false |
4,939 | 16,116,225 | 21,722,036 | public void process(String t) {
try {
MessageDigest md5 = MessageDigest.getInstance(MD5_DIGEST);
md5.reset();
md5.update(t.getBytes());
callback.display(null, digestToHexString(md5.digest()));
} catch (Exception ex) {
callback.display(null,... | public void loadXML(URL flux, int status, File file) {
try {
SAXBuilder sbx = new SAXBuilder();
try {
if (file.exists()) {
file.delete();
}
if (!file.exists()) {
URLConnection conn = flux.openConn... | false |
4,940 | 12,561,704 | 11,892,804 | private void bubbleSort(int[] mas) {
boolean t = true;
while (t) {
t = false;
for (int i = 0; i < mas.length - 1; i++) {
if (mas[i] > mas[i + 1]) {
int temp = mas[i];
mas[i] = mas[i + 1];
mas[i + 1] =... | private int[] Tri(int[] pertinence, int taille) {
boolean change = true;
int tmp;
while (change) {
change = false;
for (int i = 0; i < taille - 2; i++) {
if (pertinence[i] < pertinence[i + 1]) {
tmp = pertinence[i];
... | true |
4,941 | 16,864,880 | 10,349,788 | public String md5(String phrase) {
MessageDigest m;
String coded = new String();
try {
m = MessageDigest.getInstance("MD5");
m.update(phrase.getBytes(), 0, phrase.length());
coded = (new BigInteger(1, m.digest()).toString(16)).toString();
} catch (... | public static boolean checkEncode(String origin, byte[] mDigest, String algorithm) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(origin.getBytes());
if (MessageDigest.isEqual(mDigest, md.digest())) {
return true;
} el... | true |
4,942 | 7,981,028 | 1,730,524 | public static String getEncryptedPwd(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
byte[] pwd = null;
SecureRandom random = new SecureRandom();
byte[] salt = new byte[SALT_LENGTH];
random.nextBytes(salt);
MessageDigest md = null;
md ... | public static boolean update(Departamento objDepartamento) {
int result = 0;
Connection c = DBConnection.getConnection();
PreparedStatement pst = null;
if (c == null) {
return false;
}
try {
c.setAutoCommit(false);
String sql = "upd... | false |
4,943 | 1,528,296 | 15,353,022 | public static Hashtable DefaultLoginValues(String firstName, String lastName, String password, String mac, String startLocation, int major, int minor, int patch, int build, String platform, String viewerDigest, String userAgent, String author) throws Exception {
Hashtable values = new Hashtable();
M... | private String calculateHash(String s) {
if (s == null) {
return null;
}
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
logger.error("Could not find a message dige... | true |
4,944 | 23,241,520 | 6,288,460 | private FeedIF retrieveFeed(String uri) throws FeedManagerException {
try {
URL urlToRetrieve = new URL(uri);
URLConnection conn = null;
try {
conn = urlToRetrieve.openConnection();
if (conn instanceof HttpURLConnection) {
... | private static void createNonCompoundData(String dir, String type) {
try {
Set s = new HashSet();
File nouns = new File(dir + "index." + type);
FileInputStream fis = new FileInputStream(nouns);
InputStreamReader reader = new InputStreamReader(fis);
... | false |
4,945 | 9,913,167 | 15,936,092 | private Image getIcon(Element e) {
if (!addIconsToButtons) {
return null;
} else {
NodeList nl = e.getElementsByTagName("rc:iconURL");
if (nl.getLength() > 0) {
String urlString = nl.item(0).getTextContent();
try {
... | public java.io.Serializable getContent() throws org.osid.repository.RepositoryException {
logger.logMethod();
if (!this.cached) {
logger.logTrace("not cached.. getting content");
Object object = this.asset.getContent();
if (object instanceof String) {
... | false |
4,946 | 11,305,841 | 1,263,069 | public boolean setDeleteCliente(int IDcliente) {
boolean delete = false;
try {
stm = conexion.prepareStatement("delete clientes where IDcliente='" + IDcliente + "'");
stm.executeUpdate();
conexion.commit();
delete = true;
} catch (SQLException ... | public boolean getAuth(String content) throws IOException {
String resp_remote;
try {
URL url = new URL(remoteurl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
... | false |
4,947 | 9,935,769 | 13,534,692 | public static InputSource openInputSource(String resource) {
InputSource src = null;
URL url = findResource(resource);
if (url != null) {
try {
InputStream in = url.openStream();
src = new InputSource(in);
src.setSystemId(url.toExte... | public JythonWrapperAction(AActionBO.ActionDTO dto, URL url) throws IOException {
super(dto);
InputStream in = url.openStream();
InputStreamReader rin = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(rin);
StringBuffer s = new StringBuffer();
St... | false |
4,948 | 19,121,580 | 1,607,805 | public static String toMd5(String s) {
String res = "";
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
res = toHexString(messageDigest);
} catch ... | public void create(String oid, Serializable obj) throws PersisterException {
String key = getLock(oid);
if (key != null) {
throw new PersisterException("Object already exists: OID = " + oid);
}
Connection conn = null;
PreparedStatement ps = null;
try {
... | false |
4,949 | 3,597,316 | 8,330,065 | 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 testWriteAndReadBiggerUnbuffered() throws Exception {
JCFSFileServer server = new JCFSFileServer(defaultTcpPort, defaultTcpAddress, defaultUdpPort, defaultUdpAddress, dir, 0, 0);
JCFS.configureDiscovery(defaultUdpAddress, defaultUdpPort);
try {
server.start(... | true |
4,950 | 1,050,422 | 21,068,911 | 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... | protected ResourceBundle loadBundle(String prefix) {
URL url = Thread.currentThread().getContextClassLoader().getResource(prefix + ".properties");
if (url != null) {
try {
return new PropertyResourceBundle(url.openStream());
} catch (IOException e) {
... | false |
4,951 | 8,562,659 | 19,550,140 | protected void validate(long googcmId, long reservePrice, String description, String category, int days, String status, String title, byte[] imgBytes) throws PortalException, SystemException {
if (Validator.isNull(description)) throw new AuctionDescriptionException(); else if (Validator.isNull(title)) throw... | private static void ensure(File pFile) throws IOException {
if (!pFile.exists()) {
FileOutputStream fos = new FileOutputStream(pFile);
String resourceName = "/" + pFile.getName();
InputStream is = BaseTest.class.getResourceAsStream(resourceName);
Assert.assert... | false |
4,952 | 13,361,852 | 7,460,370 | public static File copyFile(File from, File to) throws IOException {
FileOutputStream fos = new FileOutputStream(to);
FileInputStream fis = new FileInputStream(from);
FileChannel foc = fos.getChannel();
FileChannel fic = fis.getChannel();
foc.transferFrom(fic, 0, fic.size());... | 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.B64InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base... | true |
4,953 | 13,863,615 | 20,020,133 | protected String getLibJSCode() throws IOException {
if (cachedLibJSCode == null) {
InputStream is = getClass().getResourceAsStream(JS_LIB_FILE);
StringWriter output = new StringWriter();
IOUtils.copy(is, output);
cachedLibJSCode = output.toString();
}... | private boolean loadSymbol(QuoteCache quoteCache, Symbol symbol, TradingDate startDate, TradingDate endDate) {
boolean success = true;
String URLString = constructURL(symbol, startDate, endDate);
PreferencesManager.ProxyPreferences proxyPreferences = PreferencesManager.loadProxySettings();
... | false |
4,954 | 1,966,311 | 2,967,951 | public void run() {
if (_plot == null) {
_plot = newPlot();
}
getContentPane().add(plot(), BorderLayout.NORTH);
int width;
int height;
String widthspec = getParameter("width");
... | public void showGetStartedBox() {
String message = new String("Error: Resource Not Found.");
java.net.URL url = ClassLoader.getSystemResource("docs/get_started.html");
if (url != null) {
try {
StringBuffer buf = new StringBuffer();
BufferedReader r... | false |
4,955 | 223,631 | 200,484 | 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... | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | false |
4,956 | 214,357 | 13,821,141 | public void loadSourceCode() {
int length = MAX_SOURCE_LENGTH;
try {
File file = new File(filename);
length = (int) file.length();
} catch (SecurityException ex) {
}
char[] buff = new char[length];
InputStream is;
InputStreamReader isr;... | public static String readUrlText(String urlString) throws IOException {
URL url = new URL(urlString);
InputStream stream = url.openStream();
StringBuilder buf = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(stre... | true |
4,957 | 6,061,403 | 5,135,686 | 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 boolean loadNodeData(NodeInfo info) {
String query = mServer + "load.php" + ("?id=" + info.getId()) + ("&mask=" + NodePropertyFlag.Data);
boolean rCode = false;
try {
URL url = new URL(query);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
... | false |
4,958 | 11,838,691 | 12,461,924 | private void externalizeFiles(Document doc, File out) throws IOException {
File[] files = doc.getImages();
if (files.length > 0) {
File dir = new File(out.getParentFile(), out.getName() + ".images");
if (!dir.mkdirs()) throw new IOException("cannot create directory " + dir);
... | private void removeSessionId(InputStream inputStream, Output output) throws IOException {
String jsessionid = RewriteUtils.getSessionId(target);
boolean textContentType = ResourceUtils.isTextContentType(httpClientResponse.getHeader(HttpHeaders.CONTENT_TYPE), target.getDriver().getConfiguration().get... | true |
4,959 | 704,314 | 820,872 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void 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,960 | 12,908,415 | 17,398,520 | private synchronized void persist() {
Connection conn = null;
try {
PoolManager pm = PoolManager.getInstance();
conn = pm.getConnection(JukeXTrackStore.DB_NAME);
conn.setAutoCommit(false);
Statement state = conn.createStatement();
state.exe... | public void SendFile(File testfile) {
try {
SocketChannel sock = SocketChannel.open(new InetSocketAddress("127.0.0.1", 1234));
sock.configureBlocking(true);
while (!sock.finishConnect()) {
System.out.println("NOT connected!");
}
Sys... | false |
4,961 | 765,103 | 1,675,976 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void setPilot(PilotData pilotData) throws UsernameNotValidException {
try {
if (pilotData.username.trim().equals("") || pilotData.password.trim().equals("")) throw new UsernameNotValidException(1, "Username or password missing");
PreparedStatement psta;
if (pilotDa... | false |
4,962 | 3,694,549 | 5,313,536 | 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... | public void merge(VMImage image, VMSnapShot another) throws VMException {
if (path == null || another.getPath() == null) throw new VMException("EmuVMSnapShot is NULL!");
logging.debug(LOG_NAME, "merge images " + path + " and " + another.getPath());
File target = new File(path);
File... | false |
4,963 | 21,456,138 | 12,306,296 | @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "getServerCertificates", args = { })
public final void test_getServerCertificates() throws Exception {
try {
URL url = new URL("https://localhost:55555");
HttpsURLConnection connection = (HttpsURLConnection) url.ope... | public static void copyFile(File source, File destination, long copyLength) throws IOException {
if (!source.exists()) {
String message = "File " + source + " does not exist";
throw new FileNotFoundException(message);
}
if (destination.getParentFile() != null && !dest... | false |
4,964 | 7,781,594 | 22,788,900 | @Override
protected IStatus runCancelableRunnable(IProgressMonitor monitor) {
IStatus returnValue = Status.OK_STATUS;
monitor.beginTask(NLS.bind(Messages.SaveFileOnDiskHandler_SavingFiles, open), informationUnitsFromExecutionEvent.size());
... | @Override
public void saveStructure(long userId, TreeStructureInfo info, List<TreeStructureNode> structure) throws DatabaseException {
if (info == null) throw new NullPointerException("info");
if (structure == null) throw new NullPointerException("structure");
try {
getConnec... | false |
4,965 | 22,321,272 | 15,127,557 | 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[BUFFER_SIZE];
int bytes_read;
while (true) {
... | public static void find(String pckgname, Class tosubclass) {
String name = new String(pckgname);
if (!name.startsWith("/")) {
name = "/" + name;
}
name = name.replace('.', '/');
URL url = RTSI.class.getResource(name);
System.out.println(name + "->" + url);... | false |
4,966 | 13,351,384 | 11,228,284 | public void copieFichier(String fileIn, String fileOut) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(fileIn).getChannel();
out = new FileOutputStream(fileOut).getChannel();
in.transferTo(0, in.size(), out);
} catc... | public static boolean copy(File src, File dest) {
boolean result = true;
String files[] = null;
if (src.isDirectory()) {
files = src.list();
result = dest.mkdir();
} else {
files = new String[1];
files[0] = "";
}
if (fil... | true |
4,967 | 9,668,598 | 19,121,580 | public static Properties parse() {
try {
String userHome = System.getProperty("user.home");
File dsigFolder = new File(userHome, ".dsig");
if (!dsigFolder.exists() && !dsigFolder.mkdir()) {
throw new IOException("Could not create .dsig folder in user home ... | public static String toMd5(String s) {
String res = "";
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
res = toHexString(messageDigest);
} catch ... | false |
4,968 | 13,337,915 | 17,804,386 | private static String calculateMD5(String s) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(s.getBytes());
return new BigInteger(1, m.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
throw new ... | public void refreshStatus() {
if (!enabledDisplay) return;
try {
String url = getServerFortURL();
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
String data = null;
int counter = 0;
while ((dat... | false |
4,969 | 22,262,998 | 17,166,549 | public static String SHA512(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-512");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("UTF-8"), 0, text.length());
sha1hash = md.digest();
... | private static void userAuth(String challenge) throws IOException {
try {
MessageDigest md = MessageDigest.getInstance("BrokenMD4");
String passwd = null;
if (System.getProperty("jarsync.password.gui") != null) {
JPasswordField pass = new JPasswordField();... | true |
4,970 | 8,224,584 | 10,062,078 | @Override
public boolean checkConnection() {
int status = 0;
try {
URL url = new URL(TupeloProxy.endpoint);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
status = conn.getResponseCode();
} catch (Exception e) {
logger.s... | private void copy(File fin, File fout) throws IOException {
FileOutputStream out = null;
FileInputStream in = null;
try {
out = new FileOutputStream(fout);
in = new FileInputStream(fin);
byte[] buf = new byte[2048];
int read = in.read(buf);
... | false |
4,971 | 3,024,983 | 5,198,622 | @Test
public void testCopy_inputStreamToWriter_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out... | public byte[] getFile(final String file) throws IOException {
if (this.files.contains(file)) {
ZipInputStream input = new ZipInputStream(new ByteArrayInputStream(this.bytes));
ZipEntry entry = input.getNextEntry();
while (entry != null) {
entry = input.get... | true |
4,972 | 8,702,780 | 20,200,144 | final void saveProject(Project project, final File file) {
if (projectsList.contains(project)) {
if (project.isDirty() || !file.getParentFile().equals(workspaceDirectory)) {
try {
if (!file.exists()) {
if (!file.createNewFile()) throw n... | public void copyFile(final File sourceFile, final File destinationFile) throws FileIOException {
final FileChannel sourceChannel;
try {
sourceChannel = new FileInputStream(sourceFile).getChannel();
} catch (FileNotFoundException exception) {
final String message = COP... | true |
4,973 | 5,017,412 | 12,270,268 | public static void copyFile(File source, File target) throws Exception {
if (source.isDirectory()) {
if (!target.isDirectory()) {
target.mkdirs();
}
String[] children = source.list();
for (int i = 0; i < children.length; i++) {
... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
if (System.getProperty("os.name").toUpperCase().indexOf("WIN") != -1) {
... | true |
4,974 | 8,809,710 | 2,608,416 | public void salva(UploadedFile imagem, Usuario usuario) {
File destino = new File(pastaImagens, usuario.getId() + ".imagem");
try {
IOUtils.copyLarge(imagem.getFile(), new FileOutputStream(destino));
} catch (IOException e) {
throw new RuntimeException("Erro ao copiar... | public static Model downloadModel(String url) {
Model model = ModelFactory.createDefaultModel();
try {
URLConnection connection = new URL(url).openConnection();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnectio... | false |
4,975 | 15,143,217 | 4,533,931 | @Override
public String getMD5(String host) {
String res = "";
Double randNumber = Math.random() + System.currentTimeMillis();
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(randNumber.toString().g... | public void initForEncryption() throws CryptographyException, IOException {
String ownerPassword = pdDocument.getOwnerPasswordForEncryption();
String userPassword = pdDocument.getUserPasswordForEncryption();
if (ownerPassword == null) {
ownerPassword = "";
}
if (u... | true |
4,976 | 8,292,552 | 8,232,814 | public void run() {
BufferedReader inp = null;
try {
String urlString = "http://www.hubtracker.com/query.php?action=add&username=" + user + "&password=" + pass + "&email=" + e_mail + "&address=" + Vars.Hub_Host;
URL url = new URL(urlString);
URLConnection conn;
... | public ChatClient registerPlayer(int playerId, String playerLogin) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.reset();
md.update(playerLogin.getBytes("UTF-8"), 0, playerLogin.length());
byte[] accountTok... | false |
4,977 | 3,024,985 | 11,517,213 | @Test
public void testCopy_readerToOutputStream_nullIn() throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
OutputStream out = new YellOnFlushAndCloseOutputStreamTest(baout, true, true);
try {
IOUtils.copy((Reader) null, out);
fail();
... | private static void copyFile(File sourceFile, File destFile) {
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream... | true |
4,978 | 4,781,643 | 21,250,114 | public static void loadConfig(URL urlFile) throws CacheException {
Document document;
try {
document = Utilities.getDocument(urlFile.openStream());
} catch (IOException e) {
throw new CacheException("Could not open '" + urlFile.getFile() + "'", e);
} catch (JA... | public static void main(String[] args) throws UnsupportedEncodingException {
MessageDigest md = null;
String password = "admin!@#$" + "ZKNugmkm";
try {
md = MessageDigest.getInstance("SHA-512");
md.update(password.getBytes("utf8"));
byte[] b = md.digest();... | false |
4,979 | 23,677,145 | 8,054,454 | public static <T extends Comparable<T>> void BubbleSortComparable1(T[] num) {
int j;
boolean flag = true; // set flag to true to begin first pass
T temp; // holding variable
while (flag) {
flag = false; // set flag to false awaiting a possible swap
for (j = 0; j < num.length - 1; j++) {
if (num[j].c... | public void sortIndexes() {
int i, j, count;
int t;
count = m_ItemIndexes.length;
for (i = 1; i < count; i++) {
for (j = 0; j < count - i; j++) {
if (m_ItemIndexes[j] > m_ItemIndexes[j + 1]) {
t = m_ItemIndexes[j];
m... | true |
4,980 | 3,236,017 | 11,566,433 | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | public void write(File file) throws Exception {
if (getGEDCOMFile() != null) {
size = getGEDCOMFile().length();
if (!getGEDCOMFile().renameTo(file)) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
... | true |
4,981 | 5,537,139 | 12,349,562 | public static String getDigest(String seed, byte[] code) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(seed.getBytes("UTF-8"));
byte[] passwordMD5Byte = md.digest(code);
StringBuffer sb = new StringBuffer();
for (int i = 0;... | public byte[] loadResource(String location) throws IOException {
if ((location == null) || (location.length() == 0)) {
throw new IOException("The given resource location must not be null and non empty.");
}
URL url = buildURL(location);
URLConnection cxn = url.openConnect... | false |
4,982 | 4,520,177 | 21,172,450 | public void fetchKey() throws IOException {
String strurl = MessageFormat.format(keyurl, new Object[] { username, secret, login, session });
StringBuffer result = new StringBuffer();
BufferedReader reader = null;
URL url = null;
try {
url = new URL(strurl);
... | public static void unzip2(String strZipFile, String folder) throws IOException, ArchiveException {
FileUtil.fileExists(strZipFile, true);
final InputStream is = new FileInputStream(strZipFile);
ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
Zi... | false |
4,983 | 1,685,861 | 10,793,696 | public static String SHA(String s) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(s.getBytes(), 0, s.getBytes().length);
byte[] hash = md.digest();
StringBuilder sb = new StringBuilder();
int msb;
int lsb = 0;
... | public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | true |
4,984 | 18,426,418 | 2,608,416 | protected void load() throws IOException {
for (ClassLoader classLoader : classLoaders) {
Enumeration<URL> en = classLoader.getResources("META-INF/services/" + serviceClass.getName());
while (en.hasMoreElements()) {
URL url = en.nextElement();
InputStr... | public static Model downloadModel(String url) {
Model model = ModelFactory.createDefaultModel();
try {
URLConnection connection = new URL(url).openConnection();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnectio... | true |
4,985 | 3,803,023 | 14,121,759 | public static String callApi(String api, String paramname, String paramvalue) {
String loginapp = SSOFilter.getLoginapp();
String u = SSOUtil.addParameter(loginapp + "/api/" + api, paramname, paramvalue);
u = SSOUtil.addParameter(u, "servicekey", SSOFilter.getServicekey());
String re... | public static void main(String[] args) {
FTPClient client = new FTPClient();
try {
client.connect("192.168.1.10");
boolean login = client.login("a", "123456");
if (login) {
System.out.println("Dang nhap thanh cong...");
boolean logo... | false |
4,986 | 13,490,964 | 280,040 | public void write(File file) throws Exception {
if (isInMemory()) {
FileOutputStream fout = null;
try {
fout = new FileOutputStream(file);
fout.write(get());
} finally {
if (fout != null) {
fout.close();
... | 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,987 | 20,644,476 | 18,101,018 | private static AtomContainer askForMovieSettings() throws IOException, QTException {
final InputStream inputStream = QuickTimeFormatGenerator.class.getResourceAsStream(REFERENCE_MOVIE_RESOURCE);
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream(1024 * 100);
IOUtils.copy(input... | public void write(HttpServletRequest req, HttpServletResponse res, Object bean) throws IntrospectionException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException {
res.setContentType(contentType);
final Object r;
if (HttpRpcServer.HttpRpcOutput.class.isAssi... | true |
4,988 | 3,734,994 | 23,047,157 | private void fetchTree() throws IOException {
String urlString = BASE_URL + TREE_URL + DATASET_URL + "&family=" + mFamily;
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String toParse = in.readLine();
while (in.... | @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()) {
... | false |
4,989 | 369,844 | 17,239,344 | 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(... | @Override
public void doMove(File from, File to) throws IOException {
int res = showConfirmation("File will be moved in p4, are you sure to move ", from.getAbsolutePath());
if (res == JOptionPane.NO_OPTION) {
return;
}
Status status = fileS... | true |
4,990 | 12,512,647 | 12,335,897 | @Override
public void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
String userAgentGroup = processUserAgent(request);
final LiwenxRequest lRequest = new LiwenxRequestImpl(request, response, messageSource, userAgentGroup);
Locator loc = router.route... | protected void assignListeners() {
groupsList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
refreshInfo();
}
});
saveButton.addActionListener(new ActionListener() {
... | true |
4,991 | 6,043,997 | 17,435,276 | protected String md5sum(String toCompute) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(toCompute.getBytes());
java.math.BigInteger hash = new java.math.BigInteger(1, md.digest());
return hash.toString(16);
}
| public void show(HttpServletRequest request, HttpServletResponse response, String pantalla, Atributos modelos) {
URL url = getRecurso(pantalla);
try {
IOUtils.copy(url.openStream(), response.getOutputStream());
} catch (IOException e) {
throw new RuntimeException(e);
... | false |
4,992 | 17,586,130 | 14,501,401 | 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... | private void checkServerAccess() throws IOException {
URL url = new URL("https://testnetbeans.org/bugzilla/index.cgi");
try {
URLConnection conn = url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.connect();
} ... | false |
4,993 | 13,254,235 | 1,734,007 | public static void copy(File file, File dir, boolean overwrite) throws IOException {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
File out = new File(dir, file.getName());
if (out.exists() && !overwrite) {
throw new IOException("File: " + out + " ... | private InputStream getConnection() throws BaseException {
OutputStreamWriter wr = null;
try {
StringBuilder sb = new StringBuilder();
sb.append(getBaseString());
sb.append(AND);
sb.append(encode(ACTION, ENCODING));
sb.append(EQUAL);
... | false |
4,994 | 21,319,238 | 5,775,448 | FileCacheInputStreamFountain(FileCacheInputStreamFountainFactory factory, InputStream in) throws IOException {
file = factory.createFile();
OutputStream out = new FileOutputStream(file);
IOUtils.copy(in, out);
in.close();
out.close();
}
| private void writeData(IBaseType dataType, Writer writer) throws XMLStreamException {
InputStream isData;
DataType data = (DataType) baseType;
if (data.isSetInputStream()) {
isData = data.getInputStream();
try {
IOUtils.copy(isData, writer);
... | true |
4,995 | 6,750,354 | 6,031,248 | HTTPValuePatternComponent(final String url, final long seed) throws IOException {
seedRandom = new Random(seed);
random = new ThreadLocal<Random>();
final ArrayList<String> lineList = new ArrayList<String>(100);
final URL parsedURL = new URL(url);
final HttpURLConnection urlC... | 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 ... | false |
4,996 | 15,712,380 | 18,956,180 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Specify name of the file, just one entry per line");
System.exit(0);
}
File inFile = new File(args[0]);
BufferedReader myBR = null;
File outFile = new File(args[0] + "... | private void copyMerge(Path[] sources, OutputStream out) throws IOException {
Configuration conf = getConf();
for (int i = 0; i < sources.length; ++i) {
FileSystem fs = sources[i].getFileSystem(conf);
InputStream in = fs.open(sources[i]);
try {
IOU... | true |
4,997 | 15,909,533 | 18,326,088 | public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpClientInfo clientInfo = HttpUtil.parseClientInfo((HttpServletRequest) request);
if (request.getParameter("_debug_") != null) {
StringBuffer buffer = new StringBuffer();
... | public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/html");
String year = req.getParameter("year").toString();
String round = req.getParameter("round").toString();
resp.getWriter().println("<html><body>");
resp.g... | false |
4,998 | 647,710 | 11,346,465 | 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... | protected static final void download(String address, File localFileName) {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
URL url = new URL(address);
out = new BufferedOutputStream(new FileOutputStream(localFileName));
... | false |
4,999 | 3,746,824 | 7,034,031 | private static void unzipEntry(final ZipFile zipfile, final ZipEntry entry, final File outputDir) throws IOException {
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
return;
}
File outputFile = new File(outputDir, entry.getName());
... | 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();
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.