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 |
|---|---|---|---|---|---|
3,800 | 14,190,765 | 9,737,790 | private void _PostParser(Document document, AnnotationManager annoMan, Document htmldoc, String baseurl) {
xformer = annoMan.getTransformer();
builder = annoMan.getBuilder();
String annohash = "";
if (document == null) return;
NodeList ndlist = document.getElementsByTagNameNS... | 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... | true |
3,801 | 778,641 | 18,096,549 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public static void 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 |
3,802 | 93,208 | 19,100,902 | 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 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);
}
}
| false |
3,803 | 19,191,608 | 16,537,089 | public static String getDigestResponse(String user, String password, String method, String requri, String authstr) {
String realm = "";
String nonce = "";
String opaque = "";
String algorithm = "";
String qop = "";
StringBuffer digest = new StringBuffer();
Str... | static String getMD5Hash(String str) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] b = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
int v = (int) ... | true |
3,804 | 19,392,665 | 10,922,718 | @Override
protected AuthenticationHandlerResponse authenticateInternal(final Connection c, final AuthenticationCriteria criteria) throws LdapException {
byte[] hash = new byte[DIGEST_SIZE];
try {
final MessageDigest md = MessageDigest.getInstance(passwordScheme);
md.updat... | public static boolean downloadRegPage() {
String filename = "register.php?csz=" + checkEmptyString(jDtr) + "&&mac=" + MAC + "&&uname=" + checkEmptyString(InstallName) + "&&cname=" + checkEmptyString(InstallCompany) + "&&winuname=" + checkEmptyString(WinName) + "&&wincname=" + checkEmptyString(WinCompany) + ... | false |
3,805 | 137,780 | 22,628,847 | 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 main(String[] args) throws Exception {
System.out.println("Opening destination cbrout.jizz");
OutputStream out = new BufferedOutputStream(new FileOutputStream("cbrout.jizz"));
System.out.println("Opening source output.jizz");
InputStream in = new CbrLiveStream(new ... | true |
3,806 | 4,642,794 | 16,576,182 | public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {
Writer out = null;
PreparedStatement ps = null;
DatabaseAdapter dbDyn = null;
try {
out = renderResponse.getWriter();
if (log.isDebugEnabled()) log.debug("... | public alto.io.Output openOutput() throws java.io.IOException {
URL url = this.url;
if (null != url) {
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
if (connection instanceof alto.net.Connection) {
((alto.net.Connec... | false |
3,807 | 21,803,552 | 10,778,361 | public void doRender() throws IOException {
File file = new File(fileName);
if (!file.exists()) {
logger.error("Static resource not found: " + fileName);
isNotFound = true;
return;
}
if (fileName.endsWith("xml") || fileName.endsWith("asp")) servlet... | public void writeData(String name, int items, int mznum, int mzscale, long tstart, long tdelta, int[] peaks) {
PrintWriter file = getWriter(name + ".txt");
file.println("999 9999");
file.println("Doe, John");
file.println("TEST Lab");
if (mzscale == 1) file.println("PALMS Pos... | true |
3,808 | 17,156,131 | 21,575,638 | private static void readAndWriteFile(File source, File target) {
try {
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(target);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
... | protected void writeGZippedBytes(byte array[], TupleOutput out) {
if (array == null || array.length == 0) {
out.writeBoolean(false);
writeBytes(array, out);
return;
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(array.length);
... | true |
3,809 | 8,688,357 | 13,792,092 | public void runDynusT() {
final String[] exeFiles = new String[] { "DynusT.exe", "DLL_ramp.dll", "Ramp_Meter_Fixed_CDLL.dll", "Ramp_Meter_Feedback_CDLL.dll", "Ramp_Meter_Feedback_FDLL.dll", "libifcoremd.dll", "libmmd.dll", "Ramp_Meter_Fixed_FDLL.dll", "libiomp5md.dll" };
final String[] modelFiles = ... | public NodeId generateTopicId(String topicName) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
System.err.println("No SHA support!");
}
md.update(topicName.getBytes());
byte[] dige... | false |
3,810 | 8,966,080 | 19,194,277 | public void testManageSources() throws Exception {
this.getTestTool().manageSources(this.getTestSourcesDirectory());
this.getTestTool().manageSources(this.getTestTool().getModules().getModule("Module"), this.getTestSourcesDirectory());
final File implementationDirectory = this.getTestSources... | public void create() throws IOException {
FileChannel fc = new FileInputStream(sourceFile).getChannel();
for (RangeArrayElement element : array) {
FileChannel fc_ = fc.position(element.starting());
File part = new File(destinationDirectory, "_0x" + Long.toHexString(element.st... | true |
3,811 | 14,652,853 | 9,339,937 | public static void main(String args[]) {
String midletClass = null;
;
File appletInputFile = null;
File deviceInputFile = null;
File midletInputFile = null;
File htmlOutputFile = null;
File appletOutputFile = null;
File deviceOutputFile = null;
... | public FileReader(String filePath, Configuration aConfiguration) throws IOException {
file = new File(URLDecoder.decode(filePath, "UTF-8")).getCanonicalFile();
readerConf = aConfiguration;
if (file.isDirectory()) {
File indexFile = new File(file, "index.php");
File in... | true |
3,812 | 1,663,419 | 20,343,439 | private 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 (IOExce... | public void run() {
URLConnection con = null;
try {
con = url.openConnection();
if ("HTTPS".equalsIgnoreCase(url.getProtocol())) {
HttpsURLConnection scon = (HttpsURLConnection) con;
try {
sco... | false |
3,813 | 18,471,152 | 4,761,833 | 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();
... | private void copyFileToDir(MyFile file, MyFile to, wlPanel panel) throws IOException {
Utilities.print("started copying " + file.getAbsolutePath() + "\n");
FileOutputStream fos = new FileOutputStream(new File(to.getAbsolutePath()));
FileChannel foc = fos.getChannel();
FileInputStream... | false |
3,814 | 20,103,134 | 7,301,201 | public static String base64HashedString(String v) {
String base64HashedPassword = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(v.getBytes());
String hashedPassword = new String(md.digest());
sun.misc.BASE64Encoder enc = ne... | private void openConnection() throws IOException {
connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml");
}
| false |
3,815 | 16,762,677 | 17,371,628 | public static void copyFile(File src, File dest) throws IOException {
FileInputStream fIn;
FileOutputStream fOut;
FileChannel fIChan, fOChan;
long fSize;
MappedByteBuffer mBuf;
fIn = new FileInputStream(src);
fOut = new FileOutputStream(dest);
fIChan =... | public static void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | true |
3,816 | 2,481,505 | 10,174,628 | @Override
public void run() {
try {
File[] inputFiles = new File[this.previousFiles != null ? this.previousFiles.length + 1 : 1];
File copiedInput = new File(this.randomFolder, this.inputFile.getName());
IOUtils.copyFile(this.inputFile, copiedInput);
input... | @Override
public T[] sort(T[] values) {
super.compareTimes = 0;
for (int i = 0; i < values.length; i++) {
for (int j = 0; j < values.length - i - 1; j++) {
super.compareTimes++;
if (values[j].compareTo(values[j + 1]) > 0) {
T temp =... | false |
3,817 | 22,117,571 | 18,880,060 | public void copyFileFromLocalMachineToRemoteMachine(InputStream source, File destination) throws Exception {
String fileName = destination.getPath();
File f = new File(getFtpServerHome(), "" + System.currentTimeMillis());
f.deleteOnExit();
org.apache.commons.io.IOUtils.copy(source, n... | public static boolean copy(File source, File target) {
try {
if (!source.exists()) return false;
target.getParentFile().mkdirs();
InputStream input = new FileInputStream(source);
OutputStream output = new FileOutputStream(target);
byte[] buf = new ... | true |
3,818 | 13,669,409 | 23,677,151 | protected void runTest(URL pBaseURL, String pName, String pHref) throws Exception {
URL url = new URL(pBaseURL, pHref);
XSParser parser = new XSParser();
parser.setValidating(false);
InputSource isource = new InputSource(url.openStream());
isource.setSystemId(url.toString());... | public static IProject CreateJavaProject(String name, IPath classpath) throws CoreException {
// Create and Open New Project in Workspace
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject(name);
project.create(null);
project... | false |
3,819 | 7,718,801 | 10,310,530 | protected static StringBuffer doRESTOp(String urlString) throws Exception {
StringBuffer result = new StringBuffer();
String restUrl = urlString;
int p = restUrl.indexOf("://");
if (p < 0) restUrl = System.getProperty("fedoragsearch.protocol") + "://" + System.getProperty("fedoragsea... | protected UnicodeList(URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(url.openStream())));
String line;
line = br.readLine();
chars = new ArrayList();
while ((line = br.readLine()) != null) {
... | true |
3,820 | 16,157,869 | 665,978 | 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... | 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 |
3,821 | 7,990,229 | 786,782 | public static InputStream gunzip(final InputStream inputStream) throws IOException {
Assert.notNull(inputStream, "inputStream");
GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
InputOutputStream inputOutputStream = new InputOutputStream();
IOUtils.copy(gzipInputSt... | public void _getPlotTypes() {
boolean gotPlots = false;
while (!gotPlots) {
try {
_myPlotTypes = new Vector[2];
_myPlotTypes[0] = new Vector();
_myPlotTypes[1] = new Vector();
URL dataurl = new URL(getDocumentBase(), plotTyp... | false |
3,822 | 14,658,498 | 17,119,760 | private Properties loadPropertiesFromURL(String propertiesURL, Properties defaultProperties) {
Properties properties = new Properties(defaultProperties);
URL url;
try {
url = new URL(propertiesURL);
URLConnection urlConnection = url.openConnection();
prope... | public void testReaderWriterF2() throws Exception {
String inFile = "test_data/mri.png";
String outFile = "test_output/mri__smooth_testReaderWriter.mhd";
itkImageFileReaderF2_Pointer reader = itkImageFileReaderF2.itkImageFileReaderF2_New();
itkImageFileWriterF2_Pointer writer = itkIm... | false |
3,823 | 16,050,015 | 20,559,734 | public static void downloadFile(String htmlUrl, String dirUrl) {
try {
URL url = new URL(htmlUrl);
System.out.println("Opening connection to " + htmlUrl + "...");
URLConnection urlC = url.openConnection();
InputStream is = url.openStream();
Date da... | public void updatePortletName(PortletNameBean portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
String sql = "update WM_PORTAL_PORTLET_NAME " + "set TYPE=? " + "where ID_SITE_CTX_TYPE=?";
... | false |
3,824 | 4,020,497 | 23,071,780 | public static void copyFile(File sourceFile, File targetFile) throws FileCopyingException {
try {
FileInputStream inputStream = new FileInputStream(sourceFile);
FileOutputStream outputStream = new FileOutputStream(targetFile);
FileChannel readableChannel = inputStream.get... | public boolean copyFile(File source, File dest) {
try {
FileReader in = new FileReader(source);
FileWriter out = new FileWriter(dest);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
return true;
... | true |
3,825 | 16,341,630 | 9,860,858 | public String contentType() {
if (_contentType != null) {
return (String) _contentType;
}
String uti = null;
URL url = url();
LOG.info("OKIOSIDManagedObject.contentType(): url = " + url + "\n");
if (url != null) {
String contentType = null;
... | @Override
public boolean register(String username, String password) {
this.getLogger().info(DbUserServiceImpl.class, ">>>rigister " + username + "<<<");
try {
if (this.getDbServ().queryFeelerUser(username) != null) {
return false;
}
MessageDige... | false |
3,826 | 9,704,751 | 7,645,348 | public OOXMLSignatureService(InputStream documentInputStream, OutputStream documentOutputStream, SignatureFacet signatureFacet, String role, IdentityDTO identity, byte[] photo, RevocationDataService revocationDataService, TimeStampService timeStampService, DigestAlgo signatureDigestAlgo) throws IOException {
... | @BeforeClass
public static void setUpOnce() throws OWLOntologyCreationException {
dbManager = (OWLDBOntologyManager) OWLDBManager.createOWLOntologyManager(OWLDataFactoryImpl.getInstance());
dbIRI = IRI.create(ontoUri);
System.out.println("copying ontology to work folder...");
try... | true |
3,827 | 5,189,131 | 20,037,335 | public void service(Request req, Response resp) {
PrintStream out = null;
try {
out = resp.getPrintStream(8192);
String env = req.getParameter("env");
String regex = req.getParameter("regex");
String deep = req.getParameter("deep");
String ... | public static void copyFromHDFSMerge(String hdfsDir, String local) throws IOException {
rmr(local);
File f = new File(local);
f.getAbsoluteFile().getParentFile().mkdirs();
HDFSDirInputStream inp = new HDFSDirInputStream(hdfsDir);
FileOutputStream oup = new FileOutputStream(lo... | true |
3,828 | 13,747,998 | 4,598,940 | public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, fina... | public static void retrieveAttachments(RemoteAttachment[] attachments, String id, String projectName, String key, SimpleDateFormat formatter, java.sql.Connection connect) {
if (attachments.length != 0) {
for (RemoteAttachment attachment : attachments) {
attachmentAuthor = attachm... | false |
3,829 | 78,966 | 3,616,301 | 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 final String getHash(int iterationNb, String password, String salt) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(salt.getBytes("UTF-8"));
byte[] input = digest.digest(password.getBytes("UTF-8"))... | false |
3,830 | 10,634,007 | 3,867,253 | public static EXISchema getEXISchema(String fileName, Class<?> cls, EXISchemaFactoryErrorHandler compilerErrorHandler) throws IOException, ClassNotFoundException, EXISchemaFactoryException {
EXISchemaFactory schemaCompiler = new EXISchemaFactory();
schemaCompiler.setCompilerErrorHandler(compilerErro... | @Override
public void start() {
System.err.println("start AutoplotApplet " + VERSION + " @ " + (System.currentTimeMillis() - t0) + " msec");
super.start();
model = new ApplicationModel();
model.setExceptionHandler(new ExceptionHandler() {
public void handle(Throwable... | false |
3,831 | 21,570,957 | 22,704,165 | private static long saveAndClosePDFDocument(PDDocument document, OutputStreamProvider outProvider) throws IOException, COSVisitorException {
File tempFile = null;
InputStream in = null;
OutputStream out = null;
try {
tempFile = File.createTempFile("temp", "pdf");
... | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel.size(), destinationChanne... | true |
3,832 | 10,628,604 | 81,287 | public File extractID3v2TagDataIntoFile(File outputFile) throws TagNotFoundException, IOException {
int startByte = (int) ((MP3AudioHeader) audioHeader).getMp3StartByte();
if (startByte >= 0) {
FileInputStream fis = new FileInputStream(file);
FileChannel fc = fis.getChannel()... | 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 |
3,833 | 4,988,270 | 6,319,887 | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | true |
3,834 | 4,673,959 | 489,386 | public static String createRecoveryContent(String password) {
try {
password = encryptGeneral1(password);
String data = URLEncoder.encode("key", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
URL url = new URL("https://mypasswords-server.appspot.com/recovery_file"... | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | false |
3,835 | 7,464,993 | 18,315,736 | @Override
public void alterar(QuestaoDiscursiva q) throws Exception {
System.out.println("ALTERAR " + q.getIdQuestao());
PreparedStatement stmt = null;
String sql = "UPDATE questao SET id_disciplina=?, enunciado=?, grau_dificuldade=? WHERE id_questao=?";
try {
stmt = ... | private List<String> getTaxaList() {
List<String> taxa = new Vector<String>();
String domain = m_domain.getStringValue();
String id = "";
if (domain.equalsIgnoreCase("Eukaryota")) id = "eukaryota";
try {
URL url = new URL("http://www.ebi.ac.uk/genomes/" + id + ".d... | false |
3,836 | 13,254,235 | 5,636,800 | 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 + " ... | 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);
... | true |
3,837 | 1,699,613 | 1,477,578 | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | public static void copy(FileInputStream source, FileOutputStream dest) throws IOException {
FileChannel in = null, out = null;
try {
in = source.getChannel();
out = dest.getChannel();
long size = in.size();
MappedByteBuffer buf = in.map(FileChannel.Map... | true |
3,838 | 18,142,979 | 21,348,949 | private String copyTutorial() throws IOException {
File inputFile = new File(getFilenameForOriginalTutorial());
File outputFile = new File(getFilenameForCopiedTutorial());
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
w... | protected void onSubmit() {
super.onSubmit();
if (!this.hasError()) {
final FileUpload upload = fileUploadField.getFileUpload();
if (upload != null) {
try {
StringWriter xmlSourceWriter = new StringWriter();
... | true |
3,839 | 4,396,970 | 10,384,704 | public HttpURLConnection proxiedURLConnection(URL url, String serverName) throws IOException, PussycatException {
if (this.httpProxy == null || this.httpProxy.equals("") || PussycatUtils.isLocalURL(url.toString()) || url.toString().contains(serverName)) {
System.getProperties().put("proxySet", "... | public void reset(String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.setInt(1, currentPilot);
psta.setString(2, componentName);
... | false |
3,840 | 10,177,034 | 411,631 | public static synchronized BaseFont getL2BaseFont() {
if (l2baseFont == null) {
final ConfigProvider conf = ConfigProvider.getInstance();
try {
final ByteArrayOutputStream tmpBaos = new ByteArrayOutputStream();
String fontPath = conf.getNotEmptyPropert... | 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 |
3,841 | 14,956,753 | 8,859,873 | public void execute(HttpResponse response) throws HttpException, IOException {
StringBuffer content = new StringBuffer();
NodeSet allNodes = membershipRegistry.listAllMembers();
for (Node node : allNodes) {
content.append(node.getId().toString());
content.append(Syste... | private void mergeOne(String level, char strand, String filename, Path outPath, FileSystem srcFS, FileSystem dstFS, Timer to) throws IOException {
to.start();
final OutputStream outs = dstFS.create(new Path(outPath, filename));
final FileStatus[] parts = srcFS.globStatus(new Path(sorted ? ge... | false |
3,842 | 11,044,947 | 7,645,348 | public static void copyFile(File in, File out, boolean append) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out, append).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | @BeforeClass
public static void setUpOnce() throws OWLOntologyCreationException {
dbManager = (OWLDBOntologyManager) OWLDBManager.createOWLOntologyManager(OWLDataFactoryImpl.getInstance());
dbIRI = IRI.create(ontoUri);
System.out.println("copying ontology to work folder...");
try... | true |
3,843 | 18,367,536 | 18,862,611 | public static void main(String[] args) throws HttpException, IOException {
String headerName = null;
String t = "http://localhost:8080/access/content/group/81c8542d-3f58-48cf-ac72-9f482df47ebe/sss/QuestionarioSocioEc.pdf";
URL url = new URL(t);
HttpURLConnection srvletConnection = (H... | public TestReport runImpl() throws Exception {
DocumentFactory df = new SAXDocumentFactory(GenericDOMImplementation.getDOMImplementation(), parserClassName);
File f = (new File(testFileName));
URL url = f.toURL();
Document doc = df.createDocument(null, rootTag, url.toString(), url.op... | false |
3,844 | 606,859 | 22,880,847 | 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 doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
long time = System.currentTimeMillis(... | true |
3,845 | 18,598,975 | 6,635,999 | private Face(String font) throws IOException {
characterWidths = new double[256];
StringBuffer sb = new StringBuffer();
sb.append('/');
sb.append(Constants.FONTS_DIR);
sb.append('/');
sb.append(font);
sb.append(Constants.CHAR_WIDTHS_SUFFIX);
String pat... | public String grabId(String itemName) throws Exception {
StringBuffer modified = new StringBuffer(itemName);
for (int i = 0; i <= modified.length() - 1; i++) {
char ichar = modified.charAt(i);
if (ichar == ' ') modified = modified.replace(i, i + 1, "+");
}
ite... | true |
3,846 | 12,214,889 | 10,540,679 | public static boolean copyFile(String source, String destination, boolean replace) {
File sourceFile = new File(source);
File destinationFile = new File(destination);
if (sourceFile.isDirectory() || destinationFile.isDirectory()) return false;
if (destinationFile.isFile() && !replace... | private static void downloadFile(String downloadFileName) throws Exception {
URL getFileUrl = new URL("http://www.tegsoft.com/Tobe/getFile" + "?tegsoftFileName=" + downloadFileName);
URLConnection getFileUrlConnection = getFileUrl.openConnection();
InputStream is = getFileUrlConnection.getIn... | true |
3,847 | 23,295,333 | 18,371,114 | @SuppressWarnings("unchecked")
protected void initializeGraphicalViewer() {
GraphicalViewer viewer = getGraphicalViewer();
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
viewer.setEditPartFactory(new DBEditPartFactory());
viewer.setRootEditPart(rootEditPart);
... | public static void copy(final File source, final File dest) throws IOException {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
... | false |
3,848 | 17,143,411 | 16,765,716 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws WsException {
String callback = para(req, JsonWriter.CALLBACK, null);
String input = para(req, INPUT, null);
String type = para(req, TYPE, "url");
String format = para(req, FORMAT, null);
... | public static void uploadFile(String localPath, String hostname, String username, String password, String remotePath) {
FTPClient ftpClient = new FTPClient();
try {
ftpClient.connect(hostname);
int reply = ftpClient.getReplyCode();
boolean success = false;
... | false |
3,849 | 18,489,831 | 7,005,223 | private static URL downloadFile(URL url, File destFile) throws Exception {
try {
URLConnection urlConnection = url.openConnection();
File tmpFile = null;
try {
tmpFile = File.createTempFile("remoteLib_", null);
InputStream in = null;
... | public void checkFilesAndCopyValid(String filename) {
downloadResults();
loadResults();
File tmpFolderF = new File(tmpFolder);
deleteFileFromTMPFolder(tmpFolderF);
ZipReader zr = new ZipReader();
zr.UnzipFile(filename);
try {
LogManager.getInstance... | true |
3,850 | 9,261,908 | 7,460,370 | public NamedList<Object> request(final SolrRequest request, ResponseParser processor) throws SolrServerException, IOException {
HttpMethod method = null;
InputStream is = null;
SolrParams params = request.getParams();
Collection<ContentStream> streams = requestWriter.getContentStream... | 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 |
3,851 | 13,356,869 | 8,856,524 | 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... | @Action(value = "ajaxFileUploads", results = { })
public void ajaxFileUploads() throws IOException {
String extName = "";
String newFilename = "";
String nowTimeStr = "";
String realpath = "";
if (Validate.StrNotNull(this.getImgdirpath())) {
realpath = "Uploa... | true |
3,852 | 912,653 | 13,902,981 | public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: GUnzip source");
return;
}
String zipname, source;
if (args[0].endsWith(".gz")) {
zipname = args[0];
source = args[0].substring(0, args[0].lengt... | 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 |
3,853 | 15,225,386 | 8,677,887 | public ActionForward sendTrackback(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws RollerException {
ActionForward forward = mapping.findForward("weblogEdit.page");
ActionErrors errors = new ActionErrors();
WeblogEntryData entry ... | public Document getWsdlDomResource(String aResourceName) throws SdlException {
logger.debug("getWsdlDomResource() " + aResourceName);
InputStream in = null;
try {
URL url = getDeploymentContext().getResourceURL(aResourceName);
if (url == null) {
logger... | false |
3,854 | 17,408,417 | 3,160,590 | public MsgRecvInfo[] recvMsg(MsgRecvReq msgRecvReq) throws SQLException {
String updateSQL = " update dyhikemomessages set receive_id = ?, receive_Time = ? where mo_to =? and receive_id =0 limit 20";
String selectSQL = " select MOMSG_ID,mo_from,mo_to,create_time,mo_content from dyhikemomessages wh... | @Override
public final byte[] getDigest() {
try {
final MessageDigest hashing = MessageDigest.getInstance("SHA-256");
final Charset utf16 = Charset.forName("UTF-16");
for (final CollationKey wordKey : this.words) {
hashing.update(wordKey.toByteArray())... | false |
3,855 | 2,090,332 | 2,056,082 | private void doProcess(HttpServletRequest request, HttpServletResponse resp) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
Analyzer analyzer = new Analyzer();
ServletContext context = getServletContext();
String xml = context.getRe... | protected void setTestContent(IDfDocument document, String testFileName) throws Exception {
InputStream testFileIs = new BufferedInputStream(FileHelper.getFileAsStreamFromClassPath(testFileName));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(testFileIs, baos);
... | true |
3,856 | 17,831,556 | 10,654,982 | public static String generateHash(String msg) throws NoSuchAlgorithmException {
if (msg == null) {
throw new IllegalArgumentException("Input string can not be null");
}
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(msg.getBytes());
... | public static String getEncryptedPassword(String password) throws PasswordException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
} catch (Exception e) {
throw new PasswordException(e);
... | true |
3,857 | 8,766,831 | 18,761,618 | public static byte[] loadFile(File file) throws IOException {
BufferedInputStream in = null;
ByteArrayOutputStream sink = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
sink = new ByteArrayOutputStream();
IOUtils.copy(in, sink);
... | private FileInputStream getPackageStream(String archivePath) throws IOException, PackageManagerException {
final int lastSlashInName = filename.lastIndexOf("/");
final String newFileName = filename.substring(lastSlashInName);
File packageFile = new File((new StringBuilder()).append(archivePa... | true |
3,858 | 3,386,551 | 1,629,748 | 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... | public static void main(String[] args) throws Exception {
DES des = new DES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\test1.txt"));
SingleKey key = new SingleKey... | false |
3,859 | 7,872,663 | 4,923,514 | private static boolean prepareQualifyingFile(String completePath, String outputFile) {
try {
File inFile = new File(completePath + fSep + "qualifying.txt");
FileChannel inC = new FileInputStream(inFile).getChannel();
BufferedReader br = new BufferedReader(new FileReader(i... | public static void main(String[] args) {
if (args.length != 3) {
System.out.println("Usage: HexStrToBin enc/dec <infileName> <outfilename>");
System.exit(1);
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream in = new F... | true |
3,860 | 19,660,598 | 4,267,635 | private static void replaceEntityMappings(File signserverearpath, File entityMappingXML) throws ZipException, IOException {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(signserverearpath));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream tempZip =... | public static boolean copyFile(final File src, final File dst) throws FileNotFoundException {
if (src == null || dst == null || src.equals(dst)) {
return false;
}
boolean result = false;
if (src.exists()) {
if (dst.exists() && !dst.canWrite()) {
... | true |
3,861 | 21,321,506 | 2,325,202 | public static int convertImage(InputStream is, OutputStream os, String command) throws IOException, InterruptedException {
if (logger.isInfoEnabled()) {
logger.info(command);
}
Process p = Runtime.getRuntime().exec(command);
ByteArrayOutputStream errOut = new ByteArrayOut... | protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionMessages errors = new ActionMessages();
try {
boolean isMultipart = FileUpload.isMultipartContent(request);
Store store... | true |
3,862 | 16,809,623 | 427,727 | public boolean parseResults(URL url, String analysis_type, CurationI curation, Date analysis_date, String regexp) throws OutputMalFormatException {
boolean parsed = false;
try {
InputStream data_stream = url.openStream();
parsed = parseResults(data_stream, analysis_type, cura... | 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));
... | false |
3,863 | 16,001,374 | 23,658,098 | static void copyFile(File file, File destDir) {
File destFile = new File(destDir, file.getName());
if (destFile.exists() && (!destFile.canWrite())) {
throw new SyncException("Cannot overwrite " + destFile + " because " + "it is read-only");
}
try {
FileInputSt... | public void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.c... | true |
3,864 | 4,798,352 | 7,553,634 | public static void readProperties() throws IOException {
URL url1 = cl.getResource("conf/soapuddi.config");
Properties props = new Properties();
if (url1 == null) throw new IOException("soapuddi.config not found");
props.load(url1.openStream());
className = props.getProperty(... | 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 |
3,865 | 386,013 | 13,247,161 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | private void findFile() throws SchedulerException {
java.io.InputStream f = null;
String furl = null;
File file = new File(getFileName());
if (!file.exists()) {
URL url = classLoadHelper.getResource(getFileName());
if (url != null) {
try {
... | false |
3,866 | 4,340,712 | 1,953,925 | public static Map<VariableLengthInteger, ElementDescriptor> readDescriptors(URL url) throws IOException, XMLStreamException {
if (url == null) {
throw new IllegalArgumentException("url is null");
}
InputStream stream = new BufferedInputStream(url.openStream());
try {
... | public boolean deploy(MMedia[] media) {
if (this.getIP_Address().equals("127.0.0.1") || this.getName().equals("localhost")) {
log.warning("You have not defined your own server, we will not really deploy to localhost!");
return true;
}
FTPClient ftp = new FTPClient();
... | false |
3,867 | 22,222,259 | 7,529,744 | void extractEnsemblCoords(String geneviewLink) {
try {
URL connectURL = new URL(geneviewLink);
InputStream urlStream = connectURL.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream));
String line;
while ((line ... | public Document retrieveDefinition(String uri) throws IOException, UnvalidResponseException {
if (!isADbPediaURI(uri)) throw new IllegalArgumentException("Not a DbPedia Resource URI");
String rawDataUri = fromResourceToRawDataUri(uri);
URL url = new URL(rawDataUri);
URLConnection con... | true |
3,868 | 18,129,915 | 2,069,219 | private void album(String albumTitle, String albumNbSong, URL url) {
try {
if (color == SWT.COLOR_WHITE) {
color = SWT.COLOR_GRAY;
} else {
color = SWT.COLOR_WHITE;
}
url.openConnection();
InputStream is = url.openSt... | public static void copieFichier(File fichier1, File fichier2) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(fichier1).getChannel();
out = new FileOutputStream(fichier2).getChannel();
in.transferTo(0, in.size(), out);
... | false |
3,869 | 3,767,765 | 14,533,184 | @Override
public int updateStatement(String sql) {
Statement statement = null;
try {
statement = getConnection().createStatement();
return statement.executeUpdate(sql);
} catch (SQLException e) {
try {
getConnection().rollback();
... | public boolean delete(int id) {
boolean deletionOk = false;
Connection conn = null;
try {
conn = db.getConnection();
conn.setAutoCommit(false);
String sql = "DELETE FROM keyphrases WHERE website_id=?";
PreparedStatement ps = conn.prepareStateme... | true |
3,870 | 361,255 | 4,579,205 | 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... | public static void copyFile(String source, String destination) throws IOException {
File srcDir = new File(source);
File[] files = srcDir.listFiles();
FileChannel in = null;
FileChannel out = null;
for (File file : files) {
try {
in = new FileInput... | true |
3,871 | 9,261,775 | 2,903,590 | public static void unzipAndRemove(final String file) {
String destination = file.substring(0, file.length() - 3);
InputStream is = null;
OutputStream os = null;
try {
is = new GZIPInputStream(new FileInputStream(file));
os = new FileOutputStream(destination);
... | public static void notify(String msg) throws Exception {
String url = "http://api.clickatell.com/http/sendmsg?";
url = add(url, "user", user);
url = add(url, "password", password);
url = add(url, "api_id", apiId);
url = add(url, "to", to);
url = add(url, "text", msg);... | true |
3,872 | 739,728 | 10,685,269 | private static String saveCookie(String username, String password) {
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTru... | public static void copy(FileInputStream source, FileOutputStream target) throws IOException {
FileChannel sourceChannel = source.getChannel();
FileChannel targetChannel = target.getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChannel);
sourceChannel.close();
... | false |
3,873 | 691,247 | 22,717,352 | 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... | public void add(AddInterceptorChain chain, Entry entry, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + "LDAPBaseServer");
if (con == null) {
throw new LDAPException("Operations Error", LDAPException.OPERAT... | false |
3,874 | 20,929,406 | 5,956,360 | public static synchronized String encrypt(String plaintext) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
return (new BASE64Encoder()).encode(raw);
}
| public static String encrypt(String algorithm, String[] input) {
try {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.reset();
for (int i = 0; i < input.length; i++) {
if (input[i] != null) md.update(input[i].getBytes("UTF-8"));
}
... | true |
3,875 | 19,344,016 | 9,176,030 | public static synchronized String encrypt(String plaintext) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BAS... | public TestHttpSSLClient(final HttpParams params) throws Exception {
super();
this.params = params;
this.ioReactor = new DefaultConnectingIOReactor(2, this.params);
ClassLoader cl = getClass().getClassLoader();
URL url = cl.getResource("test.keystore");
KeyStore keyst... | false |
3,876 | 8,624,822 | 5,132,884 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
HttpSession session = request.getSession();
String session_id = session.getId();
F... | public byte[] encryptMsg(String encryptString) {
byte[] encryptByte = null;
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(encryptString.getBytes());
encryptByte = messageDigest.digest();
} catch (NoSuchAlgorithm... | false |
3,877 | 12,626,918 | 14,058,408 | public void xtestURL2() throws Exception {
URL url = new URL(IOTest.URL);
InputStream inputStream = url.openStream();
OutputStream outputStream = new FileOutputStream("C:/Temp/testURL2.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.c... | private static void zipFolder(File folder, ZipOutputStream zipOutputStream, String relativePath) throws IOException {
File[] children = folder.listFiles();
for (int i = 0; i < children.length; i++) {
File child = children[i];
if (child.isFile()) {
String zipEn... | true |
3,878 | 14,510,383 | 8,990,219 | @Override
public void copyFile2File(final File src, final File dest, final boolean force) throws C4JException {
if (dest.exists()) if (force && !dest.delete()) throw new C4JException(format("Copying ‘%s’ to ‘%s’ failed; cannot overwrite existing file.", src.getPath(), dest.getPath()));
FileChann... | 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... | true |
3,879 | 22,742,292 | 20,383,360 | private static void initMagicRules() {
InputStream in = null;
try {
String fname = System.getProperty("magic-mime");
if (fname != null && fname.length() != 0) {
in = new FileInputStream(fname);
if (in != null) {
parse("-Dmag... | public static byte[] decrypt(byte[] ciphertext, byte[] key) throws IOException {
CryptInputStream in = new CryptInputStream(new ByteArrayInputStream(ciphertext), new SerpentEngine(), key);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
IOUtils.copy(in, bout);
return bout.t... | false |
3,880 | 3,229,363 | 10,176,882 | public void copyFile2(String src, String dest) throws IOException {
String newLine = System.getProperty("line.separator");
FileWriter fw = null;
FileReader fr = null;
BufferedReader br = null;
BufferedWriter bw = null;
File source = null;
try {
fr ... | @SuppressWarnings("unchecked")
protected void processDownloadAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
File transformationFile = new File(xslBase, "file-info.xsl");
HashMap<String, Object> params = new HashMap<String, Object>();
params.putAll(req... | true |
3,881 | 1,951,103 | 8,384,813 | private List<File> ungzipFile(File directory, File compressedFile) throws IOException {
List<File> files = new ArrayList<File>();
TarArchiveInputStream in = new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(compressedFile)));
try {
TarArchiveEntry entry = in.getNe... | public void testExplicitHeaders() throws Exception {
String headerString = "X-Foo=bar&X-Bar=baz%20foo";
HttpRequest expected = new HttpRequest(REQUEST_URL).addHeader("X-Foo", "bar").addHeader("X-Bar", "baz foo");
expect(pipeline.execute(expected)).andReturn(new HttpResponse(RESPONSE_BODY));
... | false |
3,882 | 10,445,018 | 4,780,347 | public String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
retu... | public FlatFileFrame() {
super("Specify Your Flat File Data");
try {
Class transferAgentClass = this.getStorageTransferAgentClass();
if (transferAgentClass == null) {
throw new RuntimeException("Transfer agent class can not be null.");
}
... | false |
3,883 | 10,271,558 | 2,955,074 | private void processBasicContent() {
String[] packageNames = sourceCollector.getPackageNames();
for (int i = 0; i < packageNames.length; i++) {
XdcSource[] sources = sourceCollector.getXdcSources(packageNames[i]);
File dir = new File(outputDir, packageNames[i]);
d... | public static void copyFile(File source, File destination) throws IOException {
if (source == null) {
String message = Logging.getMessage("nullValue.SourceIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (destin... | true |
3,884 | 2,188,303 | 18,144,642 | @SuppressWarnings(value = "RetentionPolicy.SOURCE")
public static byte[] getHashMD5(String chave) {
byte[] hashMd5 = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(chave.getBytes());
hashMd5 = md.digest();
} catch (NoSuchAlg... | public static String crypt(String senha) {
String md5 = null;
MessageDigest md;
try {
md = MessageDigest.getInstance(CRYPT_ALGORITHM);
md.update(senha.getBytes());
Hex hex = new Hex();
md5 = new String(hex.encode(md.digest()));
} catch ... | true |
3,885 | 18,972,686 | 792,644 | public void jsFunction_addFile(ScriptableFile infile) throws IOException {
if (!infile.jsFunction_exists()) throw new IllegalArgumentException("Cannot add a file that doesn't exists to an archive");
ZipArchiveEntry entry = new ZipArchiveEntry(infile.getName());
entry.setSize(infile.jsFunctio... | 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 |
3,886 | 3,153,908 | 14,617,443 | public boolean connentServer() {
boolean result = false;
try {
ftpClient = new FTPClient();
ftpClient.setDefaultPort(port);
ftpClient.setControlEncoding("GBK");
strOut = strOut + "Connecting to host " + host + "\r\n";
ftpClient.connect(host... | public void reademi(Vector<String> descriptions, Vector<String> links, String linkaddress, String idmap) {
InputStream is = null;
URL url;
ArrayList<String> keys = new ArrayList<String>();
ArrayList<String> names = new ArrayList<String>();
try {
url = new URL(idma... | false |
3,887 | 13,255,487 | 23,439,557 | private synchronized boolean createOrganization(String organizationName, HttpServletRequest req) {
if ((organizationName == null) || (organizationName.equals(""))) {
message = "invalid new_organization_name.";
return false;
}
String tmpxml = TextUtil.xmlEscape(organiz... | 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 |
3,888 | 489,386 | 12,757,148 | 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 doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.addHeader("Cache-Control", "max-age=" + Constants.HTTP_CACHE_SECONDS);
String uuid = req.getRequestURI().substring(req.getRequestURI().indexOf(Constants.SERVLET_THUMBNAIL_... | true |
3,889 | 9,979,752 | 1,526,593 | public static MMissing load(URL url) throws IOException {
MMissing ret = new MMissing();
InputStream is = url.openStream();
try {
Reader r = new InputStreamReader(is);
BufferedReader br = new BufferedReader(r);
String line;
while ((line = br.re... | protected Control createContents(Composite parent) {
this.getShell().setText("Chisio");
this.getShell().setSize(800, 600);
this.getShell().setImage(ImageDescriptor.createFromFile(ChisioMain.class, "icon/chisio-icon.png").createImage());
Composite composite = new Composite(parent, SWT... | false |
3,890 | 19,752,875 | 4,441,118 | public void resumereceive(HttpServletRequest req, HttpServletResponse resp, SessionCommand command) {
setHeader(resp);
try {
logger.debug("ResRec: Resume a 'receive' session with session id " + command.getSession() + " this client already received " + command.getLen() + " bytes");
... | private void chopFileDisk() throws IOException {
File tempFile = new File("" + logFile + ".tmp");
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
long startCopyPos;
byte readBuffer[] = new byte[2048];
int readCount;
long totalBytesRead = 0;
... | true |
3,891 | 7,052,397 | 18,347,503 | public ReqJsonContent(String useragent, String urlstr, String domain, String pathinfo, String alarmMessage) throws IOException {
URL url = new URL(urlstr);
URLConnection conn = url.openConnection();
conn.setRequestProperty("user-agent", useragent);
conn.setRequestProperty("pathinfo",... | public void setPage(String url) {
System.out.println("SetPage(" + url + ")");
if (url != null) {
if (!url.startsWith("http://")) {
url = "http://" + url;
}
boolean exists = false;
for (int i = 0; i < urlComboBox.getItemCount(); i++) {
... | true |
3,892 | 22,427,840 | 11,993,046 | 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 = i... | 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 ... | true |
3,893 | 23,162,862 | 16,556,715 | public static NSImage getImage(URL url) {
InputStream in = null;
try {
in = url.openStream();
} catch (IOException e) {
Log.error(e.getMessage(), e);
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buff = new byte[10 * 1024];
... | public boolean checkPassword(String password, String digest) {
boolean passwordMatch = false;
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA-1");
if (digest.regionMatches(true, 0, "{SHA}", 0, 5)) {
digest = digest.substring(5);
... | false |
3,894 | 18,536,907 | 16,012,363 | 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();
... | public static void main(String[] args) throws IOException {
String uri = "hdfs://localhost:8020/user/leeing/maxtemp/sample.txt";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.o... | true |
3,895 | 18,731,109 | 11,701,818 | 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.... | 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... | true |
3,896 | 11,048,470 | 2,614,788 | public static String download(String urlStr, String folder, String title) {
String result = "";
try {
long startTime = System.currentTimeMillis();
URL url = new URL(urlStr);
url.openConnection();
InputStream reader = url.openStream();
FileO... | public String parse() {
try {
URL url = new URL(mUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.connect();
BufferedReader reade... | false |
3,897 | 5,523,389 | 3,436,001 | public static void copy(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();
... | public static void copyFile(File in, File out) {
if (!in.exists() || !in.canRead()) {
LOGGER.warn("Can't copy file : " + in);
return;
}
if (!out.getParentFile().exists()) {
if (!out.getParentFile().mkdirs()) {
LOGGER.info("Didn't create par... | true |
3,898 | 8,143,637 | 330,896 | public void setPassword(UserType user, String clearPassword) {
try {
Random r = new Random();
String newSalt = Long.toString(Math.abs(r.nextLong()));
MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM);
md.reset();
md.update(newSalt.getByt... | public static void main(String[] argv) {
if (1 < argv.length) {
File[] sources = Source(argv[0]);
if (null != sources) {
for (File src : sources) {
File[] targets = Target(src, argv);
if (null != targets) {
... | false |
3,899 | 5,977,094 | 15,287,811 | public int deleteFile(Integer[] fileID) throws SQLException {
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
int nbrow = 0;
try {
DataSource ds = getDataSource(DEFAULT_DATASOURCE);
conn = ds.getConnection();
co... | public static int[] sort(int[] v) {
int i;
int l = v.length;
int[] index = new int[l];
for (i = 0; i < l; i++) index[i] = i;
int tmp;
boolean change = true;
while (change) {
change = false;
for (i = 0; i < l - 1; i++) {
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.