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 |
|---|---|---|---|---|---|
500 | 9,096,612 | 1,605,515 | public void include(String href) throws ProteuException {
try {
if (href.toLowerCase().startsWith("http://")) {
java.net.URLConnection urlConn = (new java.net.URL(href)).openConnection();
Download.sendInputStream(this, urlConn.getInputStream());
} else... | public void createZip(String baseDir, String objFileName) throws Exception {
logger.info("createZip: [ " + baseDir + "] [" + objFileName + "]");
baseDir = baseDir + "/" + timesmpt;
File folderObject = new File(baseDir);
if (folderObject.exists()) {
List<?> fileList = ge... | false |
501 | 11,723,383 | 8,452,131 | private void getImage(String filename) throws MalformedURLException, IOException, SAXException, FileNotFoundException {
String url = Constants.STRATEGICDOMINATION_URL + "/images/gameimages/" + filename;
WebRequest req = new GetMethodWebRequest(url);
SiteResponse response = getSiteResponse(re... | public void put(String path, File fileToPut) throws IOException {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(this.endpointURL, this.endpointPort);
log.debug("Ftp put reply: " + ftp.getReplyString());
reply = ftp.getReplyCode();
... | false |
502 | 18,464,490 | 6,322,440 | @Override
public void actionPerformed(ActionEvent e) {
if (copiedFiles_ != null) {
File[] tmpFiles = new File[copiedFiles_.length];
File tmpDir = new File(Settings.getPropertyString(ConstantKeys.project_dir), "tmp/");
tmpDir.mkdirs();
... | public static void copyFile(final File fromFile, File toFile) throws IOException {
try {
if (!fromFile.exists()) {
throw new IOException("FileCopy: " + "no such source file: " + fromFile.getAbsoluteFile());
}
if (!fromFile.isFile()) {
throw... | true |
503 | 20,112,083 | 11,701,818 | @Override
public void connect() throws IOException {
URL url = getLocator().getURL();
if (url.getProtocol().equals("file")) {
final String newUrlStr = URLUtils.createAbsoluteFileUrl(url.toExternalForm());
if (newUrlStr != null) {
if (!newUrlStr.toString().... | private static void copyFile(File source, File destination) throws IOException, SecurityException {
if (!destination.exists()) destination.createNewFile();
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(s... | false |
504 | 16,588,230 | 23,484,507 | public static void main(String[] args) throws IOException {
MSPack pack = new MSPack(new FileInputStream(args[0]));
String[] files = pack.getFileNames();
for (int i = 0; i < files.length; i++) System.out.println(i + ": " + files[i] + ": " + pack.getLengths()[i]);
System.out.println("... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getName());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getName());
if... | true |
505 | 19,045,087 | 12,800,568 | public static void copyfile(String src, String dst) throws IOException {
dst = new File(dst).getAbsolutePath();
new File(new File(dst).getParent()).mkdirs();
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel(... | public void exportFile() {
String expfolder = PropertyHandler.getInstance().getProperty(PropertyHandler.KINDLE_EXPORT_FOLDER_KEY);
File out = new File(expfolder + File.separator + previewInfo.getTitle() + ".prc");
File f = new File(absPath);
try {
FileOutputStream fout = ... | true |
506 | 552,314 | 13,368,519 | public void refreshFileItem(YahooInfo legroup) throws Exception {
String lapage = new String("");
String ledir = new String("");
Pattern pat;
Matcher mat;
Pattern pat2;
Matcher mat2;
int data;
URL myurl = new URL("http://groups.yahoo.com/mygroups");
... | public void sendTemplate(String filename, TemplateValues values) throws IOException {
Checker.checkEmpty(filename, "filename");
Checker.checkNull(values, "values");
URL url = _getFile(filename);
boolean writeSpaces = Context.getRootContext().getRunMode() == RUN_MODE.DEV ? true : fals... | false |
507 | 11,988,852 | 22,998,999 | public static final void parse(String infile, String outfile) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(infile));
DataOutputStream output = new DataOutputStream(new FileOutputStream(outfile));
int w = Integer.parseInt(reader.readLine());
int h = I... | public static void concatFiles(List<File> sourceFiles, File destFile) throws IOException {
FileOutputStream outFile = new FileOutputStream(destFile);
FileChannel outChannel = outFile.getChannel();
for (File f : sourceFiles) {
FileInputStream fis = new FileInputStream(f);
... | true |
508 | 12,721,185 | 3,904,948 | public static int fileUpload(long lngFileSize, InputStream inputStream, String strFilePath, String strFileName) throws IOException {
String SEPARATOR = System.getProperty("file.separator");
if (lngFileSize > (10 * 1024 * 1024)) {
return -1;
}
InputStream is = null;
... | public ManageUsers() {
if (System.getProperty("user.home") != null) {
dataFile = new File(System.getProperty("user.home") + File.separator + "MyRx" + File.separator + "MyRx.dat");
File dataFileDir = new File(System.getProperty("user.home") + File.separator + "MyRx");
data... | true |
509 | 16,199,085 | 10,816,494 | @Override
public byte[] read(String path) throws PersistenceException {
path = fmtPath(path);
try {
S3Object fileObj = s3Service.getObject(bucketObj, path);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(fileObj.getDataInputStream(), out... | @Override
public void sendData(String serverUrl, String fileName, String type, InputStream is) throws IOException {
ClientSession clientSession = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + serverUrl);
}
clientSes... | true |
510 | 4,162,691 | 20,239,270 | private static String getData(String myurl) throws Exception {
URL url = new URL(myurl);
uc = (HttpURLConnection) url.openConnection();
if (login) {
uc.setRequestProperty("Cookie", usercookie + ";" + pwdcookie);
}
br = new BufferedReader(new InputStreamReader(uc.g... | public static void nioJoinFiles(FileLib.FileValidator validator, File target, File[] sources) {
boolean big_files = false;
for (int i = 0; i < sources.length; i++) {
if (sources[i].length() > Integer.MAX_VALUE) {
big_files = true;
break;
}
... | false |
511 | 5,090,669 | 5,040,724 | private static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel... | public Document parse(Document document) {
CSSCompilerBuilder compilerBuilder = new CSSCompilerBuilder();
StyleSheetCompilerFactory compilerFactory = getStyleSheetCompilerFactory();
compilerBuilder.setStyleSheetCompilerFactory(compilerFactory);
CSSCompiler cssCompiler = compilerBuild... | false |
512 | 7,356,945 | 15,497,380 | public void run() {
try {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Checking for updates at " + checkUrl);
}
URL url = new URL(checkUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect... | public static String generateSig(Map<String, String> params, String secret) {
SortedSet<String> keys = new TreeSet<String>(params.keySet());
keys.remove(FacebookParam.SIGNATURE.toString());
String str = "";
for (String key : keys) {
str += key + "=" + params.get(key);
... | false |
513 | 16,034,464 | 11,113,074 | public void generate(String rootDir, RootModel root) throws Exception {
IOUtils.copyStream(HTMLGenerator.class.getResourceAsStream("stylesheet.css"), new FileOutputStream(new File(rootDir, "stylesheet.css")));
Velocity.init();
VelocityContext context = new VelocityContext();
context.... | public void backupXML() {
try {
TimeStamp timeStamp = new TimeStamp();
String fnameIn = this.fnameXML();
String pathBackup = this.pathXML + "\\Backup\\";
String fnameOut = fnameIn.substring(fnameIn.indexOf(this.fname), fnameIn.length());
fnameOut =... | true |
514 | 18,675,737 | 20,009,109 | private void post(String title, Document content, Set<String> tags) throws HttpException, IOException, TransformerException {
PostMethod method = null;
try {
method = new PostMethod("http://www.blogger.com/feeds/" + this.blogId + "/posts/default");
method.addRequestHeader("GD... | public static void concatFiles(final String as_base_file_name) throws IOException, FileNotFoundException {
new File(as_base_file_name).createNewFile();
final OutputStream lo_out = new FileOutputStream(as_base_file_name, true);
int ln_part = 1, ln_readed = -1;
final byte[] lh_buffer =... | true |
515 | 12,238,227 | 941,896 | public void doActionxxx() {
try {
System.out.println("app: ggc");
String server_name = "http://192.168.4.3:8080/";
server_name = server_name.trim();
if (server_name.length() == 0) {
server_name = "http://www.atech-software.com/";
} ... | 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 |
516 | 20,082,006 | 11,149,084 | public static void copyFile(File src, File dst) throws IOException {
FileChannel sourceChannel = new FileInputStream(src).getChannel();
FileChannel destinationChannel = new FileOutputStream(dst).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sour... | 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... | true |
517 | 8,372,919 | 16,544,386 | private String MD5(String s) {
Log.d("MD5", "Hashing '" + s + "'");
String hash = "";
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
hash = new BigInteger(1, m.digest()).toString(16);
Log.d("MD5... | public static String getEncodedHex(String text) {
MessageDigest md = null;
String encodedString = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
... | true |
518 | 17,994,731 | 12,568,442 | public static String encrypt(String txt) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(txt.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
| public static String MD5(String text) {
byte[] md5hash = new byte[32];
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
} catch (Exception e) {
... | true |
519 | 17,270,255 | 16,157,869 | @SuppressWarnings("static-access")
public void run() {
valuesRow = new String[this.getMaxCounter()];
for (int i = 0; i < this.getMaxCounter(); i++) {
InputStream is = null;
try {
String surl = "http://download.finance.yahoo.com/d/quotes.csv?s=^GDAXI&f=sl1d... | public void insertStringInFile(String file, String textToInsert, long fromByte, long toByte) throws Exception {
String tmpFile = file + ".tmp";
BufferedInputStream in = null;
BufferedOutputStream out = null;
long byteCount = 0;
try {
in = new BufferedInputStream(n... | false |
520 | 17,212,288 | 228,925 | private void copyFile(File source, File destination) throws IOException {
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = new FileInputStream(source);
fileOutputStream = new FileOutputStream(destination);
... | 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 |
521 | 100,791 | 21,361,961 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | private void transform(CommandLine commandLine) throws IOException {
Reader reader;
if (commandLine.hasOption('i')) {
reader = createFileReader(commandLine.getOptionValue('i'));
} else {
reader = createStandardInputReader();
}
Writer writer;
if... | true |
522 | 9,543,284 | 23,050,895 | public static final void copyFile(String srcFilename, String dstFilename) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel ifc = null;
FileChannel ofc = null;
Util.copyBuffer.clear();
try {
fis = new FileInputStream... | protected void saveResponse(final WebResponse response, final WebRequest request) throws IOException {
counter_++;
final String extension = chooseExtension(response.getContentType());
final File f = createFile(request.getUrl(), extension);
final InputStream input = response.getConten... | true |
523 | 21,374,041 | 17,671,343 | public void writeToStream(OutputStream out) throws IOException {
InputStream result = null;
if (tempFile != null) {
InputStream input = new BufferedInputStream(new FileInputStream(tempFile));
IOUtils.copy(input, out);
IOUtils.closeQuietly(input);
} else if... | public void unzip(String zipFileName, String outputDirectory) throws Exception {
ZipInputStream in = new ZipInputStream(new FileInputStream(zipFileName));
ZipEntry z;
while ((z = in.getNextEntry()) != null) {
System.out.println("unziping " + z.getName());
if (z.isDire... | true |
524 | 7,631,411 | 22,808,166 | public static final byte[] getHttpStream(final String uri) {
URL url;
try {
url = new URL(uri);
} catch (Exception e) {
return null;
}
InputStream is = null;
try {
is = url.openStream();
} catch (Exception e) {
r... | protected void init() throws MXQueryException {
String add = getStringValueOrEmpty(subIters[0]);
if (add == null) {
currentToken = BooleanToken.FALSE_TOKEN;
return;
}
URI uri;
if (!TypeLexicalConstraints.isValidURI(add)) throw new DynamicException(Erro... | false |
525 | 1,639,107 | 5,644,911 | public void copy(File source, File destination) {
try {
FileInputStream fileInputStream = new FileInputStream(source);
FileOutputStream fileOutputStream = new FileOutputStream(destination);
FileChannel inputChannel = fileInputStream.getChannel();
FileChannel o... | private static long writeVMDKFile(String absoluteFile, String urlString) throws Exception {
URL urlCon = new URL(urlString);
HttpsURLConnection conn = (HttpsURLConnection) urlCon.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setAllowUserInteraction(tru... | false |
526 | 282,874 | 9,492,898 | public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | public static Object getInputStream(String name, boolean showMsg, URL appletDocumentBase, String appletProxy) {
String errorMessage = null;
int iurlPrefix;
for (iurlPrefix = urlPrefixes.length; --iurlPrefix >= 0; ) if (name.startsWith(urlPrefixes[iurlPrefix])) break;
boolean isURL = ... | false |
527 | 3,386,551 | 9,542,520 | 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... | @SuppressWarnings("static-access")
public void run() {
while (true) {
try {
thisThread.sleep(10000);
} catch (InterruptedException e) {
System.out.print("no connection");
}
++i;
umat.flush();
umat = n... | false |
528 | 6,850,521 | 17,577,733 | @SuppressWarnings({ "ProhibitedExceptionDeclared" })
public int run(@NotNull final List<String> args) throws Exception {
int returnCode = 0;
if (args.size() == 0) {
log(Level.SEVERE, "noarguments");
returnCode++;
}
final byte[] buf = new byte[BUF_SIZE];
... | 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 |
529 | 3,734,993 | 5,623,479 | private void fetchAlignment() throws IOException {
String urlString = BASE_URL + ALN_URL + DATASET_URL + "&family=" + mFamily;
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
processAlignment(in);
}
| public static String getHash(String text) {
String ret = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(text.getBytes());
ret = getHex(md.digest());
} catch (NoSuchAlgorithmException e) {
log.error(e);
... | false |
530 | 924,033 | 18,096,549 | public static void main(String[] args) throws Exception {
InputStream in = null;
try {
in = new URL(args[0]).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
} finally {
IOUtils.closeStream(in);
}
}
| public static void copyFile(File src, File dest, boolean notifyUserOnError) {
if (src.exists()) {
try {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
BufferedInputStream in = new BufferedInputStream(new FileInputStream(src));
... | true |
531 | 137,780 | 692,680 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | true |
532 | 22,900,247 | 3,402,511 | public static void copyDirectory(File sourceDirectory, File targetDirectory) throws IOException {
File[] sourceFiles = sourceDirectory.listFiles(FILE_FILTER);
File[] sourceDirectories = sourceDirectory.listFiles(DIRECTORY_FILTER);
targetDirectory.mkdirs();
if (sourceFiles != null && ... | private static FileEntry writeEntry(Zip64File zip64File, FileEntry targetPath, File toWrite, boolean compress) {
InputStream in = null;
EntryOutputStream out = null;
processAndCreateFolderEntries(zip64File, parseTargetPath(targetPath.getName(), toWrite), compress);
try {
... | true |
533 | 13,356,869 | 19,660,598 | 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... | private static void replaceEntityMappings(File signserverearpath, File entityMappingXML) throws ZipException, IOException {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(signserverearpath));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream tempZip =... | true |
534 | 10,426,070 | 6,814,855 | public static long copy(File src, long amount, File dst) {
final int BUFFER_SIZE = 1024;
long amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputS... | public static boolean decodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
535 | 12,985,350 | 14,293,059 | public static String encryptPassword(String password) {
String hash = null;
try {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
byte raw[] = md.digest();
hash = Base64.encode(raw, fal... | public static final String crypt(final String password, String salt, final String magic) {
if (password == null) throw new IllegalArgumentException("Null password!");
if (salt == null) throw new IllegalArgumentException("Null salt!");
if (magic == null) throw new IllegalArgumentException("Nu... | true |
536 | 13,376,846 | 13,536,658 | private String hashPassword(String password) {
if (password != null && password.trim().length() > 0) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.trim().getBytes());
BigInteger hash = new BigInteger(1, md5.diges... | private String protectMarkup(String content, String markupRegex, String replaceSource, String replaceTarget) {
Matcher matcher = Pattern.compile(markupRegex, Pattern.MULTILINE | Pattern.DOTALL).matcher(content);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
S... | true |
537 | 7,177,879 | 17,226,920 | public SM2Client(String umn, String authorizationID, String protocol, String serverName, Map props, CallbackHandler handler) {
super(SM2_MECHANISM + "-" + umn, authorizationID, protocol, serverName, props, handler);
this.umn = umn;
complete = false;
state = 0;
if (sha == null... | public void setUrl(URL url) throws PDFException, PDFSecurityException, IOException {
InputStream in = null;
try {
URLConnection urlConnection = url.openConnection();
in = urlConnection.getInputStream();
String pathOrURL = url.toString();
setInputStream... | false |
538 | 13,028,546 | 18,318,816 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public static void invokeMvnArtifact(final IProject project, final IModuleExtension moduleExtension, final String location) throws CoreException, InterruptedException, IOException {
final Properties properties = new Properties();
properties.put("archetypeGroupId", "org.nexopenframework.plugins");
... | true |
539 | 9,958,260 | 14,717,089 | 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... | public static boolean copyFileCover(String srcFileName, String descFileName, boolean coverlay) {
File srcFile = new File(srcFileName);
if (!srcFile.exists()) {
System.out.println("�����ļ�ʧ�ܣ�Դ�ļ�" + srcFileName + "������!");
return false;
} else if (!srcFile.isFile())... | true |
540 | 19,657,516 | 7,507,773 | private static Map loadHandlerList(final String resourceName, ClassLoader loader) {
if (loader == null) loader = ClassLoader.getSystemClassLoader();
final Map result = new HashMap();
try {
final Enumeration resources = loader.getResources(resourceName);
if (resources ... | public boolean restore(File directory) {
log.debug("restore file from directory " + directory.getAbsolutePath());
try {
if (!directory.exists()) return false;
String[] operationFileNames = directory.list();
if (operationFileNames.length < 6) {
log.... | false |
541 | 18,374,477 | 21,262,909 | public void insertUser(final User user) throws IOException {
try {
Connection conn = null;
boolean autoCommit = false;
try {
conn = pool.getConnection();
autoCommit = conn.getAutoCommit();
conn.setAutoCommit(false);
... | public static void find(String pckgname, Class<?> tosubclass) {
String name = new String(pckgname);
if (!name.startsWith("/")) {
name = "/" + name;
}
name = name.replace('.', '/');
URL url = tosubclass.getResource(name);
System.out.println(name + "->" + ur... | false |
542 | 4,505,945 | 23,099,329 | private BinaryDocument documentFor(String code, String type, int diagramIndex) {
code = code.replaceAll("\n", "").replaceAll("\t", "").trim().replaceAll(" ", "%20");
StringBuilder builder = new StringBuilder("http://yuml.me/diagram/");
builder.append(type).append("/");
builder.append... | @Override
public void close() throws IOException {
super.close();
byte[] signatureData = toByteArray();
ZipOutputStream zipOutputStream = new ZipOutputStream(this.targetOutputStream);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(this.originalZipFile));
... | true |
543 | 22,135,201 | 21,781,575 | public void testCodingFromFileSmaller() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);... | private String loadSchemas() {
StringWriter writer = new StringWriter();
try {
IOUtils.copy(CoreOdfValidator.class.getResourceAsStream("schema_list.properties"), writer);
} catch (IOException e) {
e.printStackTrace();
}
return writer.toString();
}
| true |
544 | 5,951,609 | 1,953,115 | public void testCryptHash() {
Log.v("Test", "[*] testCryptHash()");
String testStr = "Hash me";
byte messageDigest[];
MessageDigest digest = null;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(testStr.getBytes());
... | protected int doWork() {
SAMFileReader reader = new SAMFileReader(IoUtil.openFileForReading(INPUT));
reader.getFileHeader().setSortOrder(SORT_ORDER);
SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), false, OUTPUT);
Iterator<SAMRecord> itera... | false |
545 | 13,299,925 | 15,333,826 | public void run() {
try {
FileChannel in = (new FileInputStream(file)).getChannel();
FileChannel out = (new FileOutputStream(updaterFile)).getChannel();
in.transferTo(0, file.length(), out);
... | public synchronized String encrypt(String password) {
try {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA-1");
md.update(password.getBytes("UTF-8"));
byte raw[] = md.digest();
byte[] hash = (new Base64()).encode(raw);
ret... | false |
546 | 658,771 | 13,275,192 | public static void main(String[] args) throws Exception {
String codecClassname = args[0];
Class<?> codecClass = Class.forName(codecClassname);
Configuration conf = new Configuration();
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, conf);
... | public static void main(String[] args) throws Exception {
BufferedImage image = ImageIO.read(BitmapFont.class.getResource("Candara-38-Bold.png"));
URL url = BitmapFontData.class.getResource("Candara-38-Bold.fnt");
BitmapFontData bitmapFontData = new BitmapFontData(url.openStream(), true);
... | false |
547 | 16,588,230 | 7,553,634 | public static void main(String[] args) throws IOException {
MSPack pack = new MSPack(new FileInputStream(args[0]));
String[] files = pack.getFileNames();
for (int i = 0; i < files.length; i++) System.out.println(i + ": " + files[i] + ": " + pack.getLengths()[i]);
System.out.println("... | public static String calcolaMd5(String messaggio) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
md.reset();
md.update(messaggio.getBytes());
byte... | false |
548 | 793,386 | 16,236,980 | public void bubbleSort(int[] arr) {
BasicProcessor.getInstance().getStartBlock();
BasicProcessor.getInstance().getVarDeclaration();
boolean swapped = true;
BasicProcessor.getInstance().getVarDeclaration();
int j = 0;
BasicProcessor.getInstance().getVarDeclaration();
... | public void loadProperties() {
try {
java.util.Properties props = new java.util.Properties();
java.net.URL url = ClassLoader.getSystemResource("env.properties");
props.load(url.openStream());
this.proxyCertificatePath = props.getProperty("proxy.certificate.pat... | false |
549 | 14,058,237 | 22,525,884 | public boolean renameTo(File dest) throws IOException {
if (dest == null) {
throw new NullPointerException("dest");
}
if (!file.renameTo(dest)) {
FileInputStream inputStream = new FileInputStream(file);
FileOutputStream outputStream = new FileOutputStream(... | public String generateKey(String className, String methodName, String text, String meaning) {
if (text == null) {
return null;
}
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw n... | false |
550 | 3,210,076 | 5,266,380 | private void readHomePage(ITestThread testThread) throws IOException {
if (null == testThread) {
throw new IllegalArgumentException("Test thread may not be null.");
}
final InputStream urlIn = new URL(testUrl).openStream();
final int availableBytes = urlIn.available();
... | 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");
... | false |
551 | 21,150,258 | 1,427,758 | 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.getOut... | private static void ensureJavaScriptHostBytes(TreeLogger logger) throws UnableToCompleteException {
if (javaScriptHostBytes != null) {
return;
}
String className = JavaScriptHost.class.getName();
try {
String path = className.replace('.', '/') + ".class";
... | false |
552 | 23,494,305 | 13,433,127 | private static void copy(File src, File dst) {
try {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();... | public void save(File selectedFile) throws IOException {
if (storeEntriesInFiles) {
boolean moved = false;
for (int i = 0; i < tempFiles.size(); i++) {
File newFile = new File(selectedFile.getAbsolutePath() + "_" + Integer.toString(i) + ".zettmp");
mov... | true |
553 | 6,245,929 | 18,878,916 | public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
URL url = new URL("http://pubsubhubbub.appspot.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
OutputStre... | public String getContents(String fileUri) throws IOException {
StringBuffer contents = new StringBuffer();
if (fileUri != null && !fileUri.equals("")) {
BufferedReader input = null;
try {
LOG.info("Reading:" + fileUri);
URL url = getClass().get... | false |
554 | 8,024,082 | 5,596,825 | 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());
... | public ZIPSignatureService(InputStream documentInputStream, SignatureFacet signatureFacet, OutputStream documentOutputStream, RevocationDataService revocationDataService, TimeStampService timeStampService, String role, IdentityDTO identity, byte[] photo, DigestAlgo signatureDigestAlgo) throws IOException {
... | true |
555 | 12,138,255 | 6,853,666 | public static void loadPoFile(URL url) {
states state = states.IDLE;
String msgCtxt = "";
String msgId = "";
String msgStr = "";
try {
if (url == null) return;
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new In... | public static void sendPostRequest() {
String data = "text=Eschirichia coli";
try {
URL url = new URL("http://taxonfinder.ubio.org/analyze?");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStre... | true |
556 | 8,372,919 | 10,893,111 | private String MD5(String s) {
Log.d("MD5", "Hashing '" + s + "'");
String hash = "";
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
hash = new BigInteger(1, m.digest()).toString(16);
Log.d("MD5... | public static void copyFile(File in, File out) throws IOException {
try {
FileReader inf = new FileReader(in);
OutputStreamWriter outf = new OutputStreamWriter(new FileOutputStream(out), "UTF-8");
int c;
while ((c = inf.read()) != -1) outf.write(c);
... | false |
557 | 6,788,258 | 16,891,145 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | public static byte[] expandPasswordToKeySSHCom(String password, int keyLen) {
try {
if (password == null) {
password = "";
}
MessageDigest md5 = MessageDigest.getInstance("MD5");
int digLen = md5.getDigestLength();
byte[] buf = new ... | true |
558 | 8,612,648 | 2,575,374 | 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 static void copy(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChanne... | true |
559 | 3,054,600 | 2,433,175 | 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();
... | private void copyFile(File orig, File dest) {
byte[] buffer = new byte[1024];
try {
FileInputStream fis = new FileInputStream(orig);
FileOutputStream fos = new FileOutputStream(dest, true);
int readBytes = 0;
do {
readBytes = fis.read(b... | true |
560 | 23,179,136 | 18,510,279 | private void doLogin(String password) throws LoginFailedException, IncorrectPasswordException {
final long mgr = Constants.MANAGER;
Data data, response;
try {
response = sendAndWait(new Request(mgr)).get(0);
MessageDigest md;
try {
md = Mes... | public void login() {
loginsuccessful = false;
try {
cookies = new StringBuilder();
HttpParams params = new BasicHttpParams();
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
... | false |
561 | 9,510,815 | 3,726,610 | public static void copy(File source, File target) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(target).getChannel();
ByteBuffer buffer = ByteBuffer.allocateDirect(BUFFER);
... | private static void processFile(StreamDriver driver, String sourceName) throws Exception {
String destName = sourceName + ".xml";
File dest = new File(destName);
if (dest.exists()) {
throw new IllegalArgumentException("File '" + destName + "' already exists!");
}
... | true |
562 | 20,052,285 | 5,375,381 | private void copyFile(String path) {
try {
File srcfile = new File(srcdir, path);
File destfile = new File(destdir, path);
File parent = destfile.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
FileInputStrea... | public TempFileBinaryBody(InputStream is) throws IOException {
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
tempFile = tempPath.createTempFile("attachment", ".bin");
OutputStream out = tempFile.getOutputStream();
IOUtils.copy(is, out);
out.close();
}
| true |
563 | 5,004,897 | 3,352,341 | private boolean passwordMatches(String user, String plainPassword, String scrambledPassword) {
MessageDigest md;
byte[] temp_digest, pass_digest;
byte[] hex_digest = new byte[35];
byte[] scrambled = scrambledPassword.getBytes();
try {
md = MessageDigest.getInstanc... | public void processSaveCompany(Company companyBean, AuthSession authSession) {
if (authSession == null) {
return;
}
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
String sql = "UPDATE... | false |
564 | 12,979,701 | 20,849,254 | @Override
public List<SheetFullName> importSheets(INetxiliaSystem workbookProcessor, WorkbookId workbookName, URL url, IProcessingConsole console) throws ImportException {
try {
return importSheets(workbookProcessor, workbookName, url.openStream(), console);
} catch (Exception e) {
... | public static AudioInputStream getWavFromURL(String urlstr) {
URL url;
AudioInputStream ais = null;
try {
url = new URL(urlstr);
URLConnection c = url.openConnection();
c.connect();
InputStream stream = c.getInputStream();
ais = new... | false |
565 | 13,234,957 | 14,782,656 | protected String readFileUsingHttp(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProper... | private static Long statusSWGCraftTime() {
long current = System.currentTimeMillis() / 1000L;
if (current < (previousStatusCheck + SWGCraft.STATUS_CHECK_DELAY)) return previousStatusTime;
URL url = null;
try {
synchronized (previousStatusTime) {
if (curren... | false |
566 | 15,088,608 | 23,429,413 | public synchronized String encrypt(String plaintext) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {
noSuchAlgorithmException.printStackTrace();
}
try {
... | public static String plainToMD(LoggerCollection loggerCol, String input) {
byte[] byteHash = null;
MessageDigest md = null;
StringBuilder md4result = new StringBuilder();
try {
md = MessageDigest.getInstance("MD4", new BouncyCastleProvider());
md.reset();
... | true |
567 | 16,549,992 | 20,325,581 | public static String hash(String string, String algorithm, String encoding) throws UnsupportedEncodingException {
try {
MessageDigest digest = MessageDigest.getInstance(algorithm);
digest.update(string.getBytes(encoding));
byte[] encodedPassword = digest.digest();
... | public static byte[] generateHash(String strPassword, byte[] salt) {
try {
MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM);
md.update(strPassword.getBytes(CHAR_ENCODING));
md.update(salt);
return md.digest();
} catch (Exception e) {
... | true |
568 | 3,673,682 | 4,048,013 | private void DrawModel(Graphics offg, int obj_num, boolean object, float h, float s, int vt_num, int fc_num) {
int px[] = new int[3];
int py[] = new int[3];
int count = 0;
int tmp[] = new int[fc_num];
double tmp_depth[] = new double[fc_num];
rotate(vt_num);
of... | public InputStream getParameterAsInputStream(String key) throws UndefinedParameterError, IOException {
String urlString = getParameter(key);
if (urlString == null) return null;
try {
URL url = new URL(urlString);
InputStream stream = url.openStream();
retu... | false |
569 | 8,071,138 | 14,555,517 | public void sendContent(OutputStream out, Range range, Map map, String string) throws IOException, NotAuthorizedException, BadRequestException {
System.out.println("sendContent " + file);
RFileInputStream in = new RFileInputStream(file);
try {
IOUtils.copyLarge(in, out);
... | @Override
@RemoteMethod
public boolean encrypt(int idAnexo) {
try {
Anexo anexo = anexoService.selectById(idAnexo);
aes.init(Cipher.ENCRYPT_MODE, aeskeySpec);
FileInputStream fis = new FileInputStream(config.baseDir + "/arquivos_upload_direto/" + anexo.getAnexoCam... | true |
570 | 16,568,044 | 7,713,594 | public void setContentAsStream(final InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
IOUtils.copy(input, output);
} finally {
output.close();
}
this.content = output.toByteArray();
}
| private static void copyFile(File source, File dest, boolean visibleFilesOnly) throws IOException {
if (visibleFilesOnly && isHiddenOrDotFile(source)) {
return;
}
if (dest.exists()) {
System.err.println("Destination File Already Exists: " + dest);
}
Fi... | true |
571 | 7,321,949 | 16,958,918 | private boolean saveLOBDataToFileSystem() {
if ("".equals(m_attachmentPathRoot)) {
log.severe("no attachmentPath defined");
return false;
}
if (m_items == null || m_items.size() == 0) {
setBinaryData(null);
return true;
}
final ... | public static boolean copyFile(final String src, final String dest) {
if (fileExists(src)) {
try {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transfer... | true |
572 | 8,693,826 | 16,388,707 | private String readJsonString() {
StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(SERVER_URL);
try {
HttpResponse response = client.execute(httpGet);
StatusLine statusLine = response.getSt... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | false |
573 | 16,123,665 | 2,092,752 | public static void bubbleSort(Drawable[] list) {
boolean swapped;
do {
swapped = false;
for (int i = 0; i < list.length - 1; ++i) {
if (list[i].getSortValue() > list[i + 1].getSortValue()) {
Drawable temp = list[i];
list... | public void save() {
final JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileFilter() {
public String getDescription() {
return "PDF File";
}
public boolean accept(File f) {
return f.isDirectory() || f.getName().toLow... | false |
574 | 253,661 | 15,507,613 | 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
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
int i;
String dicomURL = request.getParameter("datasetURL");
String c... | false |
575 | 4,114,529 | 10,432,257 | @Override
public void save(File folder) {
actInstance = instance;
this.setProperty(EsomMapper.PROPERTY_INSTANCE, String.valueOf(actInstance));
log.debug("instance: " + this.getProperty(EsomMapper.PROPERTY_INSTANCE));
if (this.getProperty(EsomMapper.PROPERTY_LRN_RADIO_SELECTED) ==... | private void createImageArchive() throws Exception {
imageArchive = new File(resoutFolder, "images.CrAr");
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(imageArchive)));
out.writeInt(toNativeEndian(imageFiles.size()));
for (int i = 0; i < i... | true |
576 | 20,239,268 | 8,883,153 | 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(""... | protected int getResponseCode(String address) throws Exception {
URL url = new URL(address);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setUseCaches(false);
try {
con.connect();
return con.getResponseCode();
} finally {
... | false |
577 | 2,711,585 | 649,639 | public static void _save(PortletRequest req, PortletResponse res, PortletConfig config, ActionForm form) throws Exception {
try {
String filePath = getUserManagerConfigPath() + "user_manager_config.properties";
String tmpFilePath = UtilMethods.getTemporaryDirPath() + "user_manager_co... | 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 |
578 | 14,244,843 | 20,926,398 | private void encryptChkFile(ProjectMember member, File chkFile) throws Exception {
final java.io.FileReader reader = new java.io.FileReader(chkFile);
final File encryptedChkFile = new File(member.createOutputFileName(outputPath, "chk"));
FileOutputStream outfile = null;
ObjectOutputS... | public static Cursor load(URL url, String descriptor) {
if (url == null) {
log.log(Level.WARNING, "Trying to load a cursor with a null url.");
return null;
}
String cursorFile = url.getFile();
BufferedReader reader = null;
int lineNumber = 0;
t... | false |
579 | 519,787 | 20,684,330 | public InputStream unZip(URL url) throws Exception {
ZipInputStream zipped = new ZipInputStream(url.openStream());
System.out.println("unzipping: " + url.getFile());
ZipEntry zip = zipped.getNextEntry();
byte[] b = new byte[4096];
ByteArrayOutputStream bOut = new ByteArrayOut... | 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... | false |
580 | 5,942,289 | 15,599,609 | private byte[] digestPassword(byte[] salt, String password) throws AuthenticationException {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(salt);
md.update(password.getBytes("UTF8"));
return md.digest();
} catch (Exception e) {
... | private void addAuditDatastream() throws ObjectIntegrityException, StreamIOException {
if (m_obj.getAuditRecords().size() == 0) {
return;
}
String dsId = m_pid.toURI() + "/AUDIT";
String dsvId = dsId + "/" + DateUtility.convertDateToString(m_obj.getCreateDate());
... | false |
581 | 13,680,335 | 21,947,196 | private String fetchCompareContent() throws IOException {
URL url = new URL(compareTo);
StringWriter sw = new StringWriter();
IOUtils.copy(url.openStream(), sw);
return sw.getBuffer().toString();
}
| public synchronized String encrypt(final String pPassword) throws NoSuchAlgorithmException, UnsupportedEncodingException {
final MessageDigest md = MessageDigest.getInstance("SHA");
md.update(pPassword.getBytes("UTF-8"));
final byte raw[] = md.digest();
return BASE64Encoder.encodeBuf... | false |
582 | 691,247 | 15,940,692 | 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... | @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String fileName = request.getParameter("tegsoftFileName");
if (fileName.startsWith("Tegsoft_BACKUP_")) {
fileName = fileName.sub... | true |
583 | 3,229,361 | 21,273,055 | public void copyFile(String source_name, String dest_name) throws IOException {
File source_file = new File(source_name);
File destination_file = new File(dest_name);
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
... | public RobotList<Resource> sort_incr_Resource(RobotList<Resource> list, String field) {
int length = list.size();
Index_value[] resource_dist = new Index_value[length];
if (field.equals("") || field.equals("location")) {
Location cur_loc = this.getLocation();
for (int... | false |
584 | 17,456,737 | 21,907,869 | 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);
}
... | public static void copy(String source, String destination) {
FileReader in = null;
FileWriter out = null;
try {
File inputFile = new File(source);
File outputFile = new File(destination);
in = new FileReader(inputFile);
out = new FileWriter(out... | true |
585 | 12,863,885 | 21,515,430 | private static String md5(String input) {
String res = "";
try {
MessageDigest cript = MessageDigest.getInstance("MD5");
cript.reset();
cript.update(input.getBytes());
byte[] md5 = cript.digest();
String tmp = "";
for (int i = 0... | protected synchronized void doLogin(long timeout, String eventMask) throws IOException, AuthenticationFailedException, TimeoutException {
ChallengeAction challengeAction;
ManagerResponse challengeResponse;
String challenge;
String key;
LoginAction loginAction;
Manager... | true |
586 | 1,811,750 | 15,971,793 | public void testHttpPostsWithExpectContinue() 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.next... | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1.setEnabled(false);
for (int i = 0; i < max; i++) {
Card crd = WLP.getSelectedCard(WLP.jTable1.getSelectedRows()[i]);
String s, s2;
s = "";
s2 = "";
try {
... | false |
587 | 5,162,892 | 10,093,209 | public void testRelativeRedirect2() throws Exception {
int port = this.localServer.getServicePort();
String host = this.localServer.getServiceHostName();
this.localServer.register("*", new RelativeRedirectService2());
DefaultHttpClient client = new DefaultHttpClient();
HttpCo... | @Override
public InitResult init(String name) {
this.urlString = name;
URL url;
URLConnection con;
try {
url = new URL(urlString);
con = url.openConnection();
int size = con.getContentLength();
char[] characters = new char[size];
... | false |
588 | 11,818,436 | 6,535,232 | public void zip_compressFiles() throws Exception {
FileInputStream in = null;
File f1 = new File("C:\\WINDOWS\\regedit.exe");
File f2 = new File("C:\\WINDOWS\\win.ini");
File file = new File("C:\\" + NTUtil.class.getName() + ".zip");
ZipOutputStream out = new ZipOutputStream(... | public String encodePassword(String password, byte[] salt) throws Exception {
if (salt == null) {
salt = new byte[12];
secureRandom.nextBytes(salt);
}
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(salt);
md.update(password.getBytes("UT... | false |
589 | 19,748,972 | 18,840,586 | public String sendSMS(String host, String port, String username, String password, String from, String to, String text, String uhd, String charset, String coding, String validity, String deferred, String dlrmask, String dlrurl, String pid, String mclass, String mwi) throws SMSPushRequestException, Exception {
... | public static String encodeString(String encodeType, String str) {
if (encodeType.equals("md5of16")) {
MD5 m = new MD5();
return m.getMD5ofStr16(str);
} else if (encodeType.equals("md5of32")) {
MD5 m = new MD5();
return m.getMD5ofStr(str);
} el... | false |
590 | 2,210,894 | 332,635 | protected int doExecuteInsert(PreparedStatement statement, Table data) throws SQLException {
ResultSet rs = null;
int result = -1;
try {
lastError = null;
result = statement.executeUpdate();
if (!isAutoCommit()) connection.commit();
rs = statem... | 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... | false |
591 | 2,964,000 | 13,422,847 | private void addConfigurationResource(final String fileName, final boolean ensureLoaded) {
try {
final ClassLoader cl = this.getClass().getClassLoader();
final Properties p = new Properties();
final URL url = cl.getResource(fileName);
if (url == null) {
... | private void createTree(DefaultMutableTreeNode top) throws MalformedURLException, ParserConfigurationException, SAXException, IOException {
InputStream stream;
URL url = new URL(SHIPS_URL + view.getBaseurl());
try {
stream = url.openStream();
} catch (Exception e) {
... | false |
592 | 6,622,146 | 14,636,645 | public Object[] bubblesort(Object[] tosort) {
Boolean sorting;
int upperlimit = tosort.length - 1;
do {
sorting = false;
for (int s0 = 0; s0 < upperlimit; s0++) {
if (tosort[s0].toString().compareTo(tosort[s0 + 1].toString()) < 0) {
} e... | private static void loadQueryProcessorFactories() {
qpFactoryMap = new HashMap<String, QueryProcessorFactoryIF>();
Enumeration<URL> resources = null;
try {
resources = QueryUtils.class.getClassLoader().getResources(RESOURCE_STRING);
} catch (IOException e) {
l... | false |
593 | 23,677,114 | 17,891,162 | public static void copyFile1(File srcFile, File destFile) throws IOException {
if(!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream fis = new FileInputStream(srcFile);
FileOutputStream fos = new FileOutputStream(destFile);
FileChannel source = fis.getChannel();
FileChannel destinat... | public void testAllowClosingInputStreamTwice() throws IOException {
OutputStream outputStream = fileSystem.createOutputStream(_("hello"), OutputMode.OVERWRITE);
outputStream.write(new byte[] { 1, 2, 3 });
outputStream.close();
InputStream inputStream = fileSystem.createInputStream(_(... | true |
594 | 3,452,556 | 17,097,179 | public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
Git git = Git.getCurrent(req.getSession());
GitComponentReader gitReader = git.getComponentReader("warpinjector");
String id = req.getParameter("id");
GitElement element = gitR... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
595 | 14,377,058 | 8,597,004 | public String process(URL url) throws IOException {
String line, results = "";
InputStream is = url.openStream();
BufferedReader dis = new BufferedReader(new InputStreamReader(is));
while ((line = dis.readLine()) != null) {
results += line + "\n";
}
System... | public String getHtmlSource(String url) {
StringBuffer codeBuffer = null;
BufferedReader in = null;
URLConnection uc = null;
try {
uc = new URL(url).openConnection();
uc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows XP; DigExt)")... | true |
596 | 1,042,184 | 1,429,497 | public static String scramble(String text) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(text.getBytes("UTF-8"));
StringBuffer sb = new StringBuffer();
for (byte b : md.digest()) sb.append(Integer.toString(b & 0xFF, 16));
... | private Scanner getUrlScanner(String strUrl) {
URL urlParticipants = null;
Scanner scannerParticipants;
try {
urlParticipants = new URL(strUrl);
URLConnection connParticipants;
if (StringUtils.isBlank(this.configProxyIp)) {
connParticipants... | false |
597 | 21,868,018 | 17,857,284 | public void process() throws Exception {
String searchXML = FileUtils.readFileToString(new File(getSearchRequestRelativeFilePath()));
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put("searchXML", searchXML);
String proxyHost = null;
int pro... | public static void copyFile(File source, File destination) throws IOException {
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(destination).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcCh... | true |
598 | 20,499,484 | 346,058 | private static byte[] getLoginHashSHA(final char[] password, final int seed) throws GGException {
try {
final MessageDigest hash = MessageDigest.getInstance("SHA1");
hash.update(new String(password).getBytes());
hash.update(GGUtils.intToByte(seed));
return has... | 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... | false |
599 | 12,115,248 | 1,109,960 | public void actionPerformed(ActionEvent evt) {
try {
File tempFile = new File("/tmp/controler.xml");
File f = new File("/tmp/controler-temp.xml");
BufferedInputStream copySource = new BufferedInputStream(new FileInputStream(tempFile));
... | public void run() {
logger.info("downloading '" + url.toString() + "' to: " + dstFile.getAbsolutePath());
Preferences prefs = Preferences.userRoot().node("gvsig.downloader");
int timeout = prefs.getInt("timeout", 60000);
DataOutputStream dos;
try {
DataInputStream... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.