text string | label int64 |
|---|---|
[CLS] private boolean createFTPConnection() {
client = new FTPClient();
System.out.println("Client created");
try {
client.connect(this.hostname, this.port);
System.out.println("Connected: " + this.hostname + ", " + this.port);
client.login(username, password)... | 0 |
[CLS] public synchronized void deleteDocument(final String file) throws IOException {
SQLException ex = null;
try {
PreparedStatement findFileStmt = con.prepareStatement("SELECT ID AS \"ID\" FROM File_ WHERE Name = ?");
findFileStmt.setString(1, file);
ResultSet rs = ... | 1 |
[CLS] private void copyFile(File src_file, File dest_file) {
InputStream src_stream = null;
OutputStream dest_stream = null;
try {
int b;
src_stream = new BufferedInputStream(new FileInputStream(src_file));
dest_stream = new BufferedOutputStream(new FileOutput... | 1 |
[CLS] public File addFile(File file, String suffix) throws IOException {
if (file.exists() && file.isFile()) {
File nf = File.createTempFile(prefix, "." + suffix, workdir);
nf.delete();
if (!file.renameTo(nf)) {
IOUtils.copy(file, nf);
}
... | 1 |
[CLS] public static Model downloadModel(String url) {
Model model = ModelFactory.createDefaultModel();
try {
URLConnection connection = new URL(url).openConnection();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnect... | 0 |
[CLS] public boolean isWebServerAvaliable(String url) {
long inicial = new Date().getTime();
HttpURLConnection connection = null;
try {
URL urlBase = urlBase = new URL(url);
getLog().info("Verificando se WebServer esta no ar: " + urlBase.toString());
connectio... | 0 |
[CLS] 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 hom... | 1 |
[CLS] 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 = DcmObjectFact... | 1 |
[CLS] protected int sendData(String submitName, String submitValue) throws HttpException, IOException, SAXException {
PostMethod postMethod = null;
try {
postMethod = new PostMethod(getDocumentBase().toString());
postMethod.getParams().setCookiePolicy(org.apache.commons.httpclien... | 1 |
[CLS] private static void copy(String srcFilename, String dstFilename, boolean override) throws IOException, XPathFactoryConfigurationException, SAXException, ParserConfigurationException, XPathExpressionException {
File fileToCopy = new File(rootDir + "test-output/" + srcFilename);
if (fileToCopy.exist... | 0 |
[CLS] public static Image getPluginImage(final Object plugin, final String name) {
try {
try {
URL url = getPluginImageURL(plugin, name);
if (m_URLImageMap.containsKey(url)) return m_URLImageMap.get(url);
InputStream is = url.openStream();
... | 0 |
[CLS] private static void addFile(File file, TarArchiveOutputStream taos) throws IOException {
String filename = null;
filename = file.getName();
TarArchiveEntry tae = new TarArchiveEntry(filename);
tae.setSize(file.length());
taos.putArchiveEntry(tae);
FileInputStream fi... | 1 |
[CLS] public InputStream getResourceAsStream(String path) {
try {
URL url = getResource(path);
if (url == null) return null;
return url.openStream();
} catch (Exception e) {
Log.ignore(e);
return null;
}
... | 0 |
[CLS] public static void copyFile(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
... | 1 |
[CLS] public static String hashString(String sPassword) {
if (sPassword == null || sPassword.equals("")) {
return "empty:";
} else {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(sPassword.getBytes("UTF-8"));
... | 0 |
[CLS] private void initSerializerFiles(String fileName, HashSet<String> fileList, HashMap<Class, Class> classMap, Class type) {
try {
ClassLoader classLoader = getClassLoader();
if (classLoader == null) return;
Enumeration iter;
iter = classLoader.getResources(fil... | 0 |
[CLS] public Login authenticateClient() {
Object o;
String user, password;
Vector<Login> clientLogins = ClientLoginsTableModel.getClientLogins();
Login login = null;
try {
socket.setSoTimeout(25000);
objectOut.writeObject("JFRITZ SERVER 1.1");
... | 1 |
[CLS] public synchronized String encrypt(String plaintext) throws PasswordException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new PasswordException(e.getMessage());
}
try {
... | 0 |
[CLS] private String callPage(String urlStr) throws IOException {
URL url = new URL(urlStr);
BufferedReader reader = null;
StringBuilder result = new StringBuilder();
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
... | 1 |
[CLS] 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 = respon... | 0 |
[CLS] void copyFileOnPeer(String path, RServerInfo peerserver, boolean allowoverwrite) throws IOException {
RFile file = new RFile(path);
OutputStream out = null;
FileInputStream in = null;
try {
in = fileManager.openFileRead(path);
out = localClient.openWrite(fil... | 1 |
[CLS] public static int getContentLength(URL urlFileLocation) {
HttpURLConnection connFile = null;
int iFileSize = -1;
try {
connFile = (HttpURLConnection) urlFileLocation.openConnection();
connFile.setDoInput(true);
InputStream is = connFile.getInputStream();... | 0 |
[CLS] public int process(ProcessorContext context) throws InterruptedException, ProcessorException {
logger.info("JAISaveTask:process");
final RenderedOp im = (RenderedOp) context.get("RenderedOp");
final String path = "s3://s3.amazonaws.com/rssfetch/" + (new Guid());
final PNGEncodePara... | 1 |
[CLS] public void downloadTranslationsAndReload() {
File languages = new File(this.translationsFile);
try {
URL languageURL = new URL(languageServer);
InputStream is = languageURL.openStream();
OutputStream os = new FileOutputStream(languages);
byte[] read... | 1 |
[CLS] private static String getProviderName(URL url, PrintStream err) {
InputStream in = null;
try {
in = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
String result = null;
while (true) {
... | 0 |
[CLS] public Object execute(Connection connection) throws JAXRException {
RegistryObject registryObject = connection.getRegistryService().getBusinessQueryManager().getRegistryObject(id);
if (registryObject instanceof ExtrinsicObject) {
ExtrinsicObject extr... | 1 |
[CLS] public IUserProfile getUserProfile(String profileID) throws MM4UUserProfileNotFoundException {
SimpleUserProfile tempProfile = null;
String tempProfileString = this.profileURI + profileID + FILE_SUFFIX;
try {
URL url = new URL(tempProfileString);
Debug.println("Retr... | 0 |
[CLS] private void write(File src, File dst, byte id3v1Tag[], byte id3v2HeadTag[], byte id3v2TailTag[]) throws IOException {
if (src == null || !src.exists()) throw new IOException(Debug.getDebug("missing src", src));
if (!src.getName().toLowerCase().endsWith(".mp3")) throw new IOException(Debug.getDebu... | 1 |
[CLS] public boolean setRecipeToTimetable(int recipeId, Timestamp time, int meal) {
System.out.println("setRecipeToTimetable");
PreparedStatement statement = null;
StringBuffer query = new StringBuffer("insert into timetable (recipe_id, time, meal) values (?,?,?)");
try {
con... | 0 |
[CLS] private String encryptPassword(String password) throws NoSuchAlgorithmException {
MessageDigest encript = MessageDigest.getInstance("MD5");
encript.update(password.getBytes());
byte[] b = encript.digest();
int size = b.length;
StringBuffer h = new StringBuffer(size);
... | 1 |
[CLS] 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 = DcmObjectFact... | 1 |
[CLS] private static byte[] get256RandomBits() throws IOException {
URL url = null;
try {
url = new URL(SRV_URL);
} catch (MalformedURLException e) {
e.printStackTrace();
}
HttpsURLConnection hu = (HttpsURLConnection) url.openConnection();
hu.setCo... | 0 |
[CLS] protected InputStream[] getInputStreams(List<URL> files) throws ResourceException {
InputStream[] result = new InputStream[files.size()];
int i = 0;
try {
for (URL url : files) {
result[i++] = url.openStream();
}
} catch (IOException e) {
... | 0 |
[CLS] private void fileUpload() throws IOException {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(postURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("Filename", new StringBody(file.getName(... | 0 |
[CLS] 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 = DcmObjectFact... | 1 |
[CLS] public static String compute(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("UTF-8"), 0, text.length());
md5hash = md.digest();
return convertToHex(... | 1 |
[CLS] public static void joinFiles(FileValidator validator, File target, File[] sources) {
FileOutputStream fos = null;
try {
if (!validator.verifyFile(target)) return;
fos = new FileOutputStream(target);
FileInputStream fis = null;
byte[] bytes = new byte... | 1 |
[CLS] 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)), Base6... | 0 |
[CLS] public void remove(String oid) throws PersisterException {
String key = getLock(oid);
if (key == null) {
throw new PersisterException("Object does not exist: OID = " + oid);
} else if (!NULL.equals(key)) {
throw new PersisterException("The object is currently locked... | 1 |
[CLS] public void zipUp() throws PersistenceException {
ZipOutputStream out = null;
try {
if (!backup.exists()) backup.createNewFile();
out = new ZipOutputStream(new FileOutputStream(backup));
out.setLevel(Deflater.DEFAULT_COMPRESSION);
for (String file : ... | 1 |
[CLS] public DicomReader(URL url) throws java.io.IOException {
final URLConnection u = url.openConnection();
final int size = u.getContentLength();
final byte[] array = new byte[size];
int bytes_read = 0;
final DataInputStream in = new DataInputStream(u.getInputStream());
... | 0 |
[CLS] public static String Sha1(String s) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] hash = new byte[40];
md.update(s.getBytes("iso-8859-1"), 0, s.length());
hash = md.digest();
return toHex(hash);
} catch (Exception ... | 0 |
[CLS] private InputStream urlToInputStream(URL url) throws IOException {
URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent", IE);
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.connect();
String encoding = conn.getContentEncoding();... | 0 |
[CLS] public static String generateHash(final String sText, final String sAlgo) throws NoSuchAlgorithmException {
final MessageDigest md = MessageDigest.getInstance(sAlgo);
md.update(sText.getBytes());
final Formatter formatter = new Formatter();
for (final Byte curByte : md.digest()) fo... | 1 |
[CLS] public void store(Component component, String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("UPDATE component_prop " + "SET size_height = ?, size_width = ?, pos_x = ?, pos_y = ? " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.se... | 0 |
[CLS] public void print(PrintWriter out) {
out.println("<?xml version=\"1.0\"?>\n" + "<?xml-stylesheet type=\"text/xsl\" href=\"http://www.urbigene.com/foaf/foaf2html.xsl\" ?>\n" + "<rdf:RDF \n" + "xml:lang=\"en\" \n" + "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n" + "xmlns:rdfs=\"http://www.w... | 1 |
[CLS] private void translate(String sender, String message) {
StringTokenizer st = new StringTokenizer(message, " ");
message = message.replaceFirst(st.nextToken(), "");
String typeCode = st.nextToken();
message = message.replaceFirst(typeCode, "");
try {
String data ... | 0 |
[CLS] private String convert(InputStream input, String encoding) throws Exception {
Process p = Runtime.getRuntime().exec("tidy -q -f /dev/null -wrap 0 --output-xml yes --doctype omit --force-output true --new-empty-tags " + emptyTags + " --quote-nbsp no -utf8");
Thread t = new CopyThread(input, p.getO... | 0 |
[CLS] public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String version = req.getParameter("version");
String cdn = req.getParameter("cdn");
String dependencies = req.getParameter("dependencies");
String optimize = req.getParameter("... | 1 |
[CLS] public Object execute(ExecutionEvent event) throws ExecutionException {
final List<InformationUnit> informationUnitsFromExecutionEvent = InformationHandlerUtil.getInformationUnitsFromExecutionEvent(event);
Shell activeShell = HandlerUtil.getActiveShell(event);
DirectoryDialog fd = new Dire... | 1 |
[CLS] public void store(Component component, String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("UPDATE component_prop " + "SET size_height = ?, size_width = ?, pos_x = ?, pos_y = ? " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.se... | 1 |
[CLS] private static synchronized byte[] gerarHash(String frase) {
try {
MessageDigest md = MessageDigest.getInstance(algoritmo);
md.update(frase.getBytes());
return md.digest();
} catch (NoSuchAlgorithmException e) {
return null;
}
} [SEP] pub... | 0 |
[CLS] public RemotePolicyMigrator createRemotePolicyMigrator() {
return new RemotePolicyMigrator() {
public String migratePolicy(InputStream stream, String url) throws ResourceMigrationException, IOException {
ByteArrayOutputCreator oc = new ByteArrayOutputCreator();
... | 1 |
[CLS] public ActionForward dbExecute(ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse) throws DatabaseException {
Integer key;
SubmitUserForm form = (SubmitUserForm) pForm;
if (pRequest.getParameter("key") == null) {
key = form.getP... | 0 |
[CLS] public static final InputStream openStream(Bundle bundle, IPath file, boolean localized) throws IOException {
URL url = null;
if (!localized) {
url = findInPlugin(bundle, file);
if (url == null) url = findInFragments(bundle, file);
} else {
url = FindSup... | 0 |
[CLS] @Override
public String toString() {
String charsetName = getCharsetName();
if (charsetName == null) charsetName = "ISO-8859-1";
try {
if (unzip) {
GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArr... | 0 |
[CLS] 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 =... | 0 |
[CLS] 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 (IOExc... | 1 |
[CLS] public static void copy(File source, File dest) throws FileNotFoundException, IOException {
FileInputStream input = new FileInputStream(source);
FileOutputStream output = new FileOutputStream(dest);
System.out.println("Copying " + source + " to " + dest);
IOUtils.copy(input, output... | 0 |
[CLS] public static URLConnection openRemoteDescriptionFile(String urlstr) throws MalformedURLException {
URL url = new URL(urlstr);
try {
URLConnection conn = url.openConnection();
conn.connect();
return conn;
} catch (Exception e) {
Config conf =... | 0 |
[CLS] 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.f... | 1 |
[CLS] public static String encrypt(String plaintext) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new Exception(e.getMessage());
}
md.update(plaintext.getBytes(Charset... | 0 |
[CLS] private String listaArquivo() {
String arquivo = "";
String linha = "";
try {
URL url = new URL(this.getCodeBase(), "./listador?dir=" + "cenarios" + "/" + user);
URLConnection con = url.openConnection();
con.setUseCaches(false);
InputStream i... | 0 |
[CLS] public MapInfo getMap(double latitude, double longitude, double wanted_mapblast_scale, int image_width, int image_height, String file_path_wo_extension, ProgressListener progress_listener) throws IOException {
try {
double mapserver_scale = getDownloadScale(wanted_mapblast_scale);
... | 0 |
[CLS] public void zipDocsetFiles(SaxHandler theXmlHandler, int theEventId, Attributes theAtts) throws BpsProcessException {
ZipOutputStream myZipOut = null;
BufferedInputStream myDocumentInputStream = null;
String myFinalFile = null;
String myTargetPath = null;
String myTargetFil... | 1 |
[CLS] public static void copyFile(File oldFile, File newFile) throws Exception {
newFile.getParentFile().mkdirs();
newFile.createNewFile();
FileChannel srcChannel = new FileInputStream(oldFile).getChannel();
FileChannel dstChannel = new FileOutputStream(newFile).getChannel();
dst... | 0 |
[CLS] private static void writeUrl(String filePath, String data, String charCoding, boolean urlIsFile) throws IOException {
int chunkLength;
OutputStream os = null;
try {
if (!urlIsFile) {
URL urlObj = new URL(filePath);
URLConnection uc = urlObj.openC... | 0 |
[CLS] public void save(InputStream is) throws IOException {
File dest = Config.getDataFile(getInternalDate(), getPhysMessageID());
OutputStream os = null;
try {
os = new FileOutputStream(dest);
IOUtils.copyLarge(is, os);
} finally {
IOUtils.closeQuietl... | 1 |
[CLS] static void invalidSlave(String msg, Socket sock) throws IOException {
BufferedReader _sinp = null;
PrintWriter _sout = null;
try {
_sout = new PrintWriter(sock.getOutputStream(), true);
_sinp = new BufferedReader(new InputStreamReader(sock.getInputStream()));
... | 1 |
[CLS] public DialogueSymbole(final JFrame jframe, final Element el, final String srcAttr) {
super(jframe, JaxeResourceBundle.getRB().getString("symbole.Insertion"), true);
this.jframe = jframe;
this.el = el;
final String nomf = el.getAttribute(srcAttr);
boolean applet = false;
... | 0 |
[CLS] public static String hashStringMD5(String string) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(string.getBytes());
byte byteData[] = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i... | 0 |
[CLS] @org.junit.Test
public void simpleRead() throws Exception {
final InputStream istream = StatsInputStreamTest.class.getResourceAsStream("/testFile.txt");
final StatsInputStream ris = new StatsInputStream(istream);
assertEquals("read size", 0, ris.getSize());
IOUtils.copy(ris, ne... | 1 |
[CLS] public static void joinFiles(FileValidator validator, File target, File[] sources) {
FileOutputStream fos = null;
try {
if (!validator.verifyFile(target)) return;
fos = new FileOutputStream(target);
FileInputStream fis = null;
byte[] bytes = new byte... | 1 |
[CLS] public BufferedImage extract() throws DjatokaException {
boolean useRegion = false;
int left = 0;
int top = 0;
int width = 50;
int height = 50;
boolean useleftDouble = false;
Double leftDouble = 0.0;
boolean usetopDouble = false;
Double topDo... | 0 |
[CLS] public void testCreateNewXMLFile() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource emptySource = loadTestSource();
assertEquals(false, emptySource.exists());
OutputStream sourceOut = emptySource.getOutputStream();
assertNotNull(sourceOut);
Inpu... | 1 |
[CLS] public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpClientInfo clientInfo = HttpUtil.parseClientInfo((HttpServletRequest) request);
if (request.getParameter("_debug_") != null) {
StringBuffer buffer = new StringBuffer();
... | 0 |
[CLS] public String getData() throws ValueFormatException, RepositoryException, IOException {
InputStream is = getStream();
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
IOUtils.closeQuietly(is);
return sw.toString();
} [SEP] public void verRecordatorio... | 1 |
[CLS] public MapInfo getMap(double latitude, double longitude, double wanted_mapblast_scale, int image_width, int image_height, String file_path_wo_extension, ProgressListener progress_listener) throws IOException {
try {
if (web_request_ == null) {
web_request_ = new HttpRequester(H... | 0 |
[CLS] private void _connect() throws SocketException, IOException {
try {
ftpClient.disconnect();
} catch (Exception ex) {
}
ftpClient.connect(host, port);
ftpClient.login("anonymous", "");
ftpClient.enterLocalActiveMode();
} [SEP] public void actionPerfor... | 0 |
[CLS] public void encryptPassword() {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
System.out.print(e);
}
try {
digest.update(passwordIn.getBytes("UTF-8"));
} catch... | 1 |
[CLS] public void execute() throws BuildException {
Project proj = getProject();
if (templateFile == null) throw new BuildException("Template file not set");
if (targetFile == null) throw new BuildException("Target file not set");
try {
File template = new File(templateFile);... | 1 |
[CLS] public static String getPasswordHash(String password) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException(e);
}
md.update(password.getBytes());
byte[] dige... | 0 |
[CLS] 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());
... | 1 |
[CLS] protected void extractArchive(File archive) {
ZipInputStream zis = null;
FileOutputStream fos;
ZipEntry entry;
File curEntry;
int n;
try {
zis = new ZipInputStream(new FileInputStream(archive));
while ((entry = zis.getNextEntry()) != null) {
... | 0 |
[CLS] public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base6... | 1 |
[CLS] private static String getHash(char[] passwd, String algorithm) throws NoSuchAlgorithmException {
MessageDigest alg = MessageDigest.getInstance(algorithm);
alg.reset();
alg.update(new String(passwd).getBytes());
byte[] digest = alg.digest();
StringBuilder sb = new StringBuil... | 0 |
[CLS] public static final String getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
try {
localHost = InetAddress.get... | 0 |
[CLS] @Override
public boolean copyFile(String srcRootPath, String srcDir, String srcFileName, String destRootPath, String destDir, String destFileName) {
File srcPath = new File(srcRootPath + separator() + Database.getDomainName() + separator() + srcDir);
if (!srcPath.exists()) {
try {
... | 0 |
[CLS] public static void copyFile(File source, File dest) throws IOException {
if (source.equals(dest)) return;
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcC... | 1 |
[CLS] private void copy(final File src, final File dstDir) {
dstDir.mkdirs();
final File dst = new File(dstDir, src.getName());
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(src)... | 0 |
[CLS] public static void sendData(final HashMap<String, String> data) {
YProgressWindowRepeat y = new YProgressWindowRepeat(I18N.t("Send Data to yaams.de"));
try {
final StringBuffer send = new StringBuffer("1=1");
for (final String key : data.keySet()) {
send.app... | 0 |
[CLS] @Override
public ISource writeTo(ISource output) throws ResourceException {
try {
Document doc = getParent().getDocument();
Nodes places = doc.query(getPosition().getXpath());
if (places.size() == 0) {
places = doc.query("//html");
}
... | 0 |
[CLS] public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | 1 |
[CLS] public static byte[] SHA1byte(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.dige... | 0 |
[CLS] private String hash(String message) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new AssertionError("Can't find the SHA1 algorithm in the java.security package");
}
String saltS... | 1 |
[CLS] public static String SHA1(String password) throws BusinessException {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(password.getBytes());
BigInteger hash = new BigInteger(1, digest.digest());
return hash.toString(16);
... | 0 |
[CLS] public static void copyFile(File from, File to) {
try {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
byte[] buffer = new byte[1024 * 16];
int read = 0;
while ((read = in.... | 1 |
[CLS] public static byte[] encode(String origin, String algorithm) throws NoSuchAlgorithmException {
String resultStr = null;
resultStr = new String(origin);
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(resultStr.getBytes());
return md.digest();
} [SEP] ... | 1 |
[CLS] private void copyFile(String sourceFilename, String destDirname) throws BuildException {
log("Copying file " + sourceFilename + " to " + destDirname);
File destFile = getDestFile(sourceFilename, destDirname);
InputStream inStream = null;
OutputStream outStream = null;
try {... | 1 |
[CLS] @Override
protected void setUp() throws Exception {
super.setUp();
FTPConf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
FTPConf.setServerTimeZoneId("GMT");
FTP.configure(FTPConf);
try {
FTP.connect("tgftp.nws.noaa.gov");
FTP.login("anonymous... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.