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,200 | 2,963,526 | 5,705,521 | public static void write(File file, InputStream source) throws IOException {
OutputStream outputStream = null;
assert file != null : "file must not be null.";
assert file.isFile() : "file must be a file.";
assert file.canWrite() : "file must be writable.";
assert source != nu... | protected static URL[] createUrls(URL jarUrls[]) {
ArrayList<URL> additionalUrls = new ArrayList<URL>(Arrays.asList(jarUrls));
for (URL ju : jarUrls) {
try {
JarFile jar = new JarFile(ju.getFile());
Enumeration<JarEntry> entries = jar.entries();
... | true |
3,201 | 20,826,307 | 778,678 | public static void createZipFromDataset(String localResourceId, File dataset, File metadata) {
CommunicationLogger.warning("System entered ZipFactory");
try {
String tmpDir = System.getProperty("java.io.tmpdir");
String outFilename = tmpDir + "/" + localResourceId + ".zip";
... | 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,202 | 6,233,042 | 2,852,141 | public static void copyFile(File src, File dest, boolean force) throws IOException, InterruptedIOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file!");
}
}
... | public static void copyFile(String input, String output) {
try {
File inputFile = new File(input);
File outputFile = new File(output);
FileReader in;
in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
... | true |
3,203 | 10,192,341 | 17,431,783 | @SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
PositionParser pp;
Database.init("XIDResult");
pp = new PositionParser("01:33:50.904+30:39:35.79");
String url = "http://simbad.u-strasbg.fr/simbad/sim-script?submit=submit+script&script=";
... | protected void registerClasses() throws PrintException {
if (!init) {
try {
Enumeration<URL> somethingToRegister = this.getClass().getClassLoader().getResources("META-INF/" + getClass().getSimpleName() + ".properties");
while (somethingToRegister.hasMoreElements()... | true |
3,204 | 14,050,303 | 19,582,152 | public int subclass(int objectId, String description) throws FidoDatabaseException, ObjectNotFoundException {
try {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
String sql = "insert into Objects (Description) " + "v... | private void copyFile(File source, File target) throws IOException {
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(target).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
... | false |
3,205 | 14,471,599 | 12,049,266 | private void copy(String url, File toDir) throws IOException {
System.err.println("url=" + url + " dir=" + toDir);
if (url.endsWith("/")) {
String basename = url.substring(url.lastIndexOf("/", url.length() - 2) + 1);
File directory = new File(toDir, basename);
dir... | private FTPClient getFTPConnection(String strUser, String strPassword, String strServer, boolean binaryTransfer, String connectionNote, boolean passiveMode) {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(strServer);
ResourcePool.LogMessage(this, R... | false |
3,206 | 18,488,106 | 13,438,576 | public static Document validateXml(File messageFile, URL inputUrl, String[] catalogs) throws IOException, ParserConfigurationException, Exception, SAXException, FileNotFoundException {
InputSource source = new InputSource(inputUrl.openStream());
Document logDoc = DomUtil.getNewDom();
XMLRead... | public void onMessage(Message message) {
try {
ExchangeImpl ex = new ExchangeImpl();
ex.setInMessage(message);
Conduit backChannel = message.getDestination().getBackChannel(message, null, null);
MessageImpl res =... | true |
3,207 | 18,315,736 | 323,161 | 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... | 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;
... | true |
3,208 | 20,596,006 | 23,574,721 | public APIResponse update(Item item) throws Exception {
APIResponse response = new APIResponse();
connection = (HttpURLConnection) new URL(url + "/api/item/update").openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setRequestProper... | public void updateProfile() throws ClassNotFoundException, SQLException {
Connection connection = null;
PreparedStatement ps1 = null;
PreparedStatement ps2 = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(this.url)... | false |
3,209 | 15,299,682 | 22,631,236 | protected File getFile(NameCategory category) throws IOException {
File home = new File(System.getProperty("user.dir"));
String fileName = String.format("%s.txt", category);
File file = new File(home, fileName);
if (file.exists()) {
return file;
} else {
... | public static Document getDocument(URL url, boolean validate) throws QTIParseException {
try {
return getDocument(new InputSource(url.openStream()), validate, null);
} catch (IOException ex) {
throw new QTIParseException(ex);
}
}
| false |
3,210 | 9,455,563 | 3,021,780 | private String[] getPamFiles() throws IOException {
URL url = WorkflowStructure.class.getResource("/de/ibis/permoto/loganalyzer/pam");
Set<String> result = new LinkedHashSet<String>(8);
if (url.getProtocol().equals("jar")) {
URLConnection con = url.openConnection();
J... | private Integer getInt(String sequence) throws NoSuchSequenceException {
Connection conn = null;
PreparedStatement read = null;
PreparedStatement write = null;
boolean success = false;
try {
conn = ds.getConnection();
conn.setTransactionIsolation(conn.... | false |
3,211 | 15,047,558 | 7,259,526 | protected void ensureProjectExists(String projectName) {
List<IClasspathEntry> classpathEntries = new UniqueEList<IClasspathEntry>();
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
try {
boolean isEmptyProject = true;
IProjectDesc... | public void SetRoles(Connection conn, User user, String[] roles) throws NpsException {
if (!IsSysAdmin() && !IsLocalAdmin()) throw new NpsException(ErrorHelper.ACCESS_NOPRIVILEGE);
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
String sql = "delete from userro... | false |
3,212 | 16,288,225 | 11,527,585 | 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... | @Test
public final void testImportODScontentXml() throws Exception {
URL url = ODSTableImporterTest.class.getResource("/Messages.ods_FILES/content.xml");
String systemId = url.getPath();
InputStream in = url.openStream();
ODSTableImporter b = new ODSTableImporter();
b.imp... | false |
3,213 | 22,363,264 | 14,075,761 | public static String md5Crypt(final byte[] key, final byte[] salt) throws NoSuchAlgorithmException {
if (key == null || key.length == 0) {
throw new IllegalArgumentException("Argument 'key' cannot be null or an empty array.");
}
if (salt == null || salt.length == 0) {
... | private static String md5(String digest, String data) throws IOException {
MessageDigest messagedigest;
try {
messagedigest = MessageDigest.getInstance(digest);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
messagedigest.updat... | true |
3,214 | 15,626,460 | 14,429,171 | private Datastream addManagedDatastreamVersion(Entry entry) throws StreamIOException, ObjectIntegrityException {
Datastream ds = new DatastreamManagedContent();
setDSCommonProperties(ds, entry);
ds.DSLocationType = "INTERNAL_ID";
ds.DSMIME = getDSMimeType(entry);
IRI contentL... | public void salva(UploadedFile imagem, Usuario usuario) {
File destino;
if (usuario.getId() == null) {
destino = new File(pastaImagens, usuario.hashCode() + ".jpg");
} else {
destino = new File(pastaImagens, usuario.getId() + ".jpg");
}
try {
... | true |
3,215 | 11,346,792 | 10,878,119 | public void generate(FileObject outputDirectory, FileObject generatedOutputDirectory, List<Library> libraryModels, String tapdocXml) throws FileSystemException {
if (!generatedOutputDirectory.exists()) {
generatedOutputDirectory.createFolder();
}
if (outputDirectory.exists()) {
... | public void notifyIterationEnds(final IterationEndsEvent event) {
log.info("moving files...");
File source = new File("deqsim.log");
if (source.exists()) {
File destination = new File(Controler.getIterationFilename("deqsim.log"));
if (!IOUtils.renameFile(source, desti... | true |
3,216 | 16,164,037 | 15,429,599 | public void run(Preprocessor pp) throws SijappException {
for (int i = 0; i < this.filenames.length; i++) {
File srcFile = new File(this.srcDir, this.filenames[i]);
BufferedReader reader;
try {
InputStreamReader isr = new InputStreamReader(new FileInputStr... | public static boolean copyFile(File src, File dest) throws IOException {
if (src == null) {
throw new IllegalArgumentException("src == null");
}
if (dest == null) {
throw new IllegalArgumentException("dest == null");
}
if (!src.isFile()) {
... | true |
3,217 | 17,197,906 | 1,953,925 | public void run() {
LogPrinter.log(Level.FINEST, "Started Download at : {0, date, long}", new Date());
if (!PipeConnected) {
throw new IllegalStateException("You should connect the pipe before with getInputStream()");
}
InputStream ins = null;
if (IsAlreadyDownloa... | 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,218 | 6,184,983 | 20,423,573 | @Override
public boolean copyFile(String srcRootPath, String srcDir, String srcFileName, String destRootPath, String destDir, String destFileName) {
File srcPath = new File(srcRootPath + separator() + Database.getDomainName() + separator() + srcDir);
if (!srcPath.exists()) {
try {
... | private static String fetchFile(String urlLocation) {
try {
URL url = new URL(urlLocation);
URLConnection conn = url.openConnection();
File tempFile = File.createTempFile("marla", ".jar");
OutputStream os = new FileOutputStream(tempFile);
IOUtils.c... | true |
3,219 | 21,947,196 | 16,654,272 | 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... | public AudioInputStream getAudioInputStream(URL url, String userAgent) throws UnsupportedAudioFileException, IOException {
if (TDebug.TraceAudioFileReader) {
TDebug.out("MpegAudioFileReaderWorkaround.getAudioInputStream(URL,String): begin");
}
long lFileLengthInBytes = AudioSyste... | false |
3,220 | 16,634,836 | 7,235,121 | @Test
public void mockingURLWorks() throws Exception {
URL url = mock(URL.class);
URLConnection urlConnectionMock = mock(URLConnection.class);
when(url.openConnection()).thenReturn(urlConnectionMock);
URLConnection openConnection = url.openConnection();
assertSame(openCon... | public static final String getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
try {
localHost = InetAddress.getLo... | false |
3,221 | 9,720,547 | 3,298,294 | private void refreshJOGL(final File installDir) {
try {
Class subAppletClass = Class.forName(subAppletClassName);
} catch (ClassNotFoundException cnfe) {
displayError("Start failed : class not found : " + subAppletClassName);
}
if (!installDir.exists()) {
... | public static String upload_file(String sessionid, String localFilePath, String remoteTagPath) {
String jsonstring = "If you see this message, there is some problem inside the function:upload_file()";
String srcPath = localFilePath;
String uploadUrl = "https://s2.cloud.cm/rpc/json/?session_i... | false |
3,222 | 19,147,293 | 638,963 | public boolean limpiarContrincantexRonda(jugadorxDivxRonda unjxdxr) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET idPareoRival = 0 " + " WHERE idJugxDivxRnd = " + unjxdxr.getIdJugxDivxRnd();
try {
connection = conexionBD.getConnection();
connec... | 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 |
3,223 | 1,015,744 | 15,882,289 | public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
try {
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
try {
sourceChannel.transferTo(0, sourceChannel... | public GetMessages(String messageType) {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerGetMessages";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "messages.xml";
try {
String urldata = urlString + "?username=" + URL... | true |
3,224 | 21,320,070 | 13,048,962 | public static void copy(File from_file, File to_file) throws IOException {
if (!from_file.exists()) {
throw new IOException("FileCopy: no such source file: " + from_file.getPath());
}
if (!from_file.isFile()) {
throw new IOException("FileCopy: can't copy directory: " ... | public final void saveAsCopy(String current_image, String destination) {
BufferedInputStream from = null;
BufferedOutputStream to = null;
String source = temp_dir + key + current_image;
try {
from = new BufferedInputStream(new FileInputStream(source));
to = ne... | true |
3,225 | 18,365,562 | 11,213,172 | private void load(Runestone stone) throws RunesExceptionRuneExecution, RunesExceptionNoSuchContent {
final Tokeniser tokeniser = stone.<Tokeniser>getContent("tokeniser").iterator().next();
rules = new HashMap<Node, List<GazRule>>();
System.out.println("Loading Gaz from: " + _url);
if... | public static void copyFile(File src, File dest) throws IOException {
log.debug("Copying file: '" + src + "' to '" + dest + "'");
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dest).getChannel();
dstChannel.transferFrom(... | false |
3,226 | 20,508,693 | 8,344,806 | private void zip(FileHolder fileHolder, int zipCompressionLevel) {
byte[] buffer = new byte[BUFFER_SIZE];
int bytes_read;
if (fileHolder.selectedFileList.size() == 0) {
return;
}
File zipDestFile = new File(fileHolder.destFiles[0]);
try {
ZipOu... | public void unpack(File destDirectory, boolean delete) {
if (delete) delete(destDirectory);
if (destDirectory.exists()) throw new ContentPackageException("Destination directory already exists.");
this.destDirectory = destDirectory;
this.manifestFile = new File(destDirectory, MANIFEST... | true |
3,227 | 11,228,284 | 21,870,537 | public static boolean copy(File src, File dest) {
boolean result = true;
String files[] = null;
if (src.isDirectory()) {
files = src.list();
result = dest.mkdir();
} else {
files = new String[1];
files[0] = "";
}
if (fil... | 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,228 | 13,207,436 | 4,404,642 | public Object sendObjectRequestToSpecifiedServer(java.lang.String serverName, java.lang.String servletName, java.lang.Object request) {
Object reqxml = null;
org.jdom.Document retdoc = null;
String myurl = java.util.prefs.Preferences.systemRoot().get("serverurl", "");
String myport =... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
HttpGet request = new HttpGet(SERVICE_URI + "/json/getproducts");
request.setHeader("Accept", "application/json");
request.setHeader("Content... | false |
3,229 | 3,762,872 | 7,350,139 | public String getHash(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] toChapter1Digest = md.digest();
return Keystore.hexEncode(toChapter1Digest);
} catch (Exception e) {
logger.err... | public static void messageDigestTest() {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update("computer".getBytes());
md.update("networks".getBytes());
System.out.println(new String(md.digest()));
System.out.println(new String(md.di... | true |
3,230 | 7,005,222 | 18,575,609 | private void downloadResults() {
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(System.currentTimeMillis());
String filename = String.format("%s%sresult_%tF.xml", vysledky, File.separator, cal);
String EOL = "" + (char) 0x0D + (char) 0x0A;
try {
... | public void updateCoordinates(Address address) {
String mapURL = "http://maps.google.com/maps/geo?output=csv";
String mapKey = "ABQIAAAAi__aT6y6l86JjbootR-p9xQd1nlEHNeAVGWQhS84yIVN5yGO2RQQPg9QLzy82PFlCzXtMNe6ofKjnA";
String location = address.getStreet() + " " + address.getZip() + " " + addr... | true |
3,231 | 488,614 | 13,683,865 | 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;
... | public URL getResource(String path) throws MalformedURLException {
if (!path.startsWith("/")) throw new MalformedURLException("Path '" + path + "' does not start with '/'");
URL url = new URL(myResourceBaseURL, path.substring(1));
InputStream is = null;
try {
is = url.ope... | false |
3,232 | 20,586,748 | 12,553,787 | public static String getMD5(String text) {
if (text == null) {
return null;
}
String result = null;
try {
MessageDigest md5 = MessageDigest.getInstance(ALG_MD5);
md5.update(text.getBytes(ENCODING));
result = "" + new BigInteger(1, md5.d... | public static String getHash(String plaintext) {
String hash = null;
try {
String text = plaintext;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(text.getBytes("UTF-8"));
byte[] ... | true |
3,233 | 11,986,777 | 5,665,159 | private List<Token> generateTokens(int tokenCount) throws XSServiceException {
final List<Token> tokens = new ArrayList<Token>(tokenCount);
final Random r = new Random();
String t = Long.toString(new Date().getTime()) + Integer.toString(r.nextInt());
final MessageDigest m;
tr... | private String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
System... | true |
3,234 | 8,352,956 | 7,911,395 | void IconmenuItem5_actionPerformed(ActionEvent e) {
JFileChooser jFileChooser1 = new JFileChooser();
String separator = "";
if (getPath() != null && !getPath().equals("")) {
jFileChooser1.setCurrentDirectory(new File(getPath()));
jFileChooser1.setSelectedFile(new File... | public void executaAlteracoes() {
Album album = Album.getAlbum();
Photo[] fotos = album.getFotos();
Photo f;
int ultimoFotoID = -1;
int albumID = album.getAlbumID();
sucesso = true;
PainelWebFotos.setCursorWait(true);
albumID = recordAlbumData(album, a... | true |
3,235 | 17,116,115 | 497,400 | public void assign() throws Exception {
if (proposalIds.equals("") || usrIds.equals("")) throw new Exception("No proposal or peer-viewer selected.");
String[] pids = proposalIds.split(",");
String[] uids = usrIds.split(",");
int pnum = pids.length;
int unum = uids.length;
... | public TVRageShowInfo(String xmlShowName) {
String[] tmp, tmp2;
String line = "";
this.usrShowName = xmlShowName;
try {
URL url = new URL("http://www.tvrage.com/quickinfo.php?show=" + xmlShowName.replaceAll(" ", "%20"));
BufferedReader in = new BufferedReader(... | false |
3,236 | 22,243,603 | 8,786,313 | @Override
protected PermissionCollection getPermissions(CodeSource _codeSource) {
PermissionCollection perms = super.getPermissions(_codeSource);
URL url = _codeSource.getLocation();
Permission perm = null;
URLConnection urlConnection = null;
try {
urlConnecti... | @DeclarePerfMonTimer("SortingTest.bubbleSort")
private void bubbleSort(int values[]) {
int len = values.length - 1;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len - i; j++) {
if (values[j] > values[j + 1]) {
int tmp = values[j];
... | false |
3,237 | 9,223,602 | 960,757 | private File uploadToTmp() {
if (fileFileName == null) {
return null;
}
File tmpFile = dataDir.tmpFile(shortname, fileFileName);
log.debug("Uploading dwc archive file for new resource " + shortname + " to " + tmpFile.getAbsolutePath());
InputStream input = null;
... | public String getMethod(String url) {
logger.info("Facebook: @executing facebookGetMethod():" + url);
String responseStr = null;
try {
HttpGet loginGet = new HttpGet(url);
loginGet.addHeader("Accept-Encoding", "gzip");
HttpResponse response = httpClient.ex... | false |
3,238 | 777,609 | 10,369,570 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | true |
3,239 | 22,137,915 | 2,746,011 | public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException {
FileChannel inputChannel = new FileInputStream(inputFile).getChannel();
FileChannel outputChannel = new FileOutputStream(outputFile).getChannel();
try {
inpu... | @RequestMapping(value = "/privatefiles/{file_name}")
public void getFile(@PathVariable("file_name") String fileName, HttpServletResponse response, Principal principal) {
try {
Boolean validUser = false;
final String currentUser = principal.getName();
Authentication au... | true |
3,240 | 9,141,694 | 281,097 | public static String calcHA1(String algorithm, String username, String realm, String password, String nonce, String cnonce) throws FatalException, MD5DigestException {
MD5Encoder encoder = new MD5Encoder();
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
... | public static void sort(float norm_abst[]) {
float temp;
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
if (norm_abst[j] > norm_abst[j + 1]) {
temp = norm_abst[j];
norm_abst[j] = norm_abst[j + 1];
no... | false |
3,241 | 3,861,343 | 8,677,886 | protected void truncate(File file) {
LogLog.debug("Compression of file: " + file.getAbsolutePath() + " started.");
if (FileUtils.isFileOlder(file, ManagementFactory.getRuntimeMXBean().getStartTime())) {
File backupRoot = new File(getBackupDir());
if (!backupRoot.exists() && !... | public Document getSdlDomResource(String aResourceName) throws SdlException {
InputStream in = null;
try {
URL url = getDeploymentContext().getResourceURL(aResourceName);
if (url == null) {
return null;
} else {
in = url.openStream(... | false |
3,242 | 20,162,871 | 9,543,279 | public static void copyFile(String f_in, String f_out, boolean remove) throws FileNotFoundException, IOException {
if (remove) {
PogoString readcode = new PogoString(PogoUtil.readFile(f_in));
readcode = PogoUtil.removeLogMessages(readcode);
PogoUtil.writeFile(f_out, readc... | @Override
protected void write(InputStream in, OutputStream out, javax.sound.sampled.AudioFormat javaSoundFormat) throws IOException {
if (USE_JAVASOUND) {
super.write(in, out, javaSoundFormat);
} else {
try {
byte[] header = JavaSoundCodec.createWavHeader... | true |
3,243 | 567,313 | 5,021,577 | 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 boolean copyDataToNewTable(EboContext p_eboctx, String srcTableName, String destTableName, String where, boolean log, int mode) throws boRuntimeException {
srcTableName = srcTableName.toUpperCase();
destTableName = destTableName.toUpperCase();
Connection cn = null;
Conn... | false |
3,244 | 308,643 | 6,146,145 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void testSystemPropertyConnector() throws Exception {
final String rootFolderPath = "test/ConnectorTest/fs/".toLowerCase();
final Connector connector = new SystemPropertyConnector();
final ContentResolver contentResolver = new UnionContentResolver();
final FSContentResolver fs... | true |
3,245 | 10,363,910 | 9,245,183 | private String getPayLoadWithCookie(String url) {
StringBuffer sb = new StringBuffer();
if (this.cookie != null) {
try {
Log.debug("Requesting url ==> " + url);
URLConnection con = new URL(url).openConnection();
con.setDoOutput(true);
... | public void read(Model m, String url) throws JenaException {
try {
URLConnection conn = new URL(url).openConnection();
String encoding = conn.getContentEncoding();
if (encoding == null) read(m, conn.getInputStream(), url); else read(m, new InputStreamReader(conn.getInputS... | false |
3,246 | 19,409,756 | 12,614,306 | public static void extract(final File destDir, final Collection<ZipEntryInfo> entryInfos) throws IOException {
if (destDir == null || CollectionUtils.isEmpty(entryInfos)) throw new IllegalArgumentException("One or parameter is null or empty!");
if (!destDir.exists()) destDir.mkdirs();
for (Z... | 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,247 | 1,684,606 | 12,614,305 | private void generateSchema() {
ConsoleOutputWindow console = DefaultXPontusWindowImpl.getInstance().getConsole();
MessagesWindowDockable mconsole = (MessagesWindowDockable) console.getDockableById(MessagesWindowDockable.DOCKABLE_ID);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
... | 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.... | true |
3,248 | 15,535,344 | 3,445,364 | public void testDoubleNaN() {
double value = 0;
boolean wasEqual = false;
String message = "DB operation completed";
String ddl1 = "DROP TABLE t1 IF EXISTS;" + "CREATE TABLE t1 ( d DECIMAL, f DOUBLE, l BIGINT, i INTEGER, s SMALLINT, t TINYINT, " + "dt DATE DEFAULT CURRENT_DATE, ti TI... | public Reader getReader() throws Exception {
if (url_base == null) {
return new FileReader(file);
} else {
URL url = new URL(url_base + file.getName());
return new InputStreamReader(url.openConnection().getInputStream());
}
}
| false |
3,249 | 14,475,614 | 8,827,646 | @SuppressWarnings("unchecked")
public static <T extends Class> Collection<T> listServices(T serviceType, ClassLoader classLoader) throws IOException, ClassNotFoundException {
final Collection<T> result = new LinkedHashSet<T>();
final Enumeration<URL> resouces = classLoader.getResources("META-INF... | @SuppressWarnings("unchecked")
private List getURLList(String request) throws IOException {
List list = null;
try {
URL url = new URL(dbURL + request);
URLConnection conn = url.openConnection();
conn.connect();
JSONParser parser = JSONParser.defaul... | false |
3,250 | 11,032,545 | 11,507,466 | @Test
public void testCopyOverSize() throws IOException {
final InputStream in = new ByteArrayInputStream(TEST_DATA);
final ByteArrayOutputStream out = new ByteArrayOutputStream(TEST_DATA.length);
final int cpySize = ExtraIOUtils.copy(in, out, TEST_DATA.length + Long.SIZE);
asser... | public PollSetMessage(String username, String question, String title, String[] choices) {
this.username = username;
MessageDigest m = null;
try {
m = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
... | false |
3,251 | 8,106,130 | 78,966 | private void copyFile(File source, File dest) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
so... | 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,252 | 14,863,753 | 708,047 | private void generateGuid() throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
StringBuilder stringToDigest = new StringBuilder();
long time = System.currentTimeMillis();
long rand = random.nextLong();
stringToDigest.append(time);
... | public static void main(String args[]) {
try {
URL url = new URL("http://www.hungry.com/");
InputStream stream = url.openStream();
int size = 0;
while (-1 != stream.read()) {
size++;
}
stream.close();
System.... | false |
3,253 | 7,911,674 | 12,935,678 | public static String getStringHash(String fileName) {
try {
MessageDigest digest = MessageDigest.getInstance("md5");
digest.reset();
digest.update(fileName.getBytes());
byte messageDigest[] = digest.digest();
StringBuilder builder = new StringBuild... | private static String makeMD5(String str) {
byte[] bytes = new byte[32];
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes("iso-8859-1"), 0, str.length());
bytes = md.digest();
} catch (Exception e) {
return null... | true |
3,254 | 22,556,550 | 16,850,375 | private void copyFiles(File oldFolder, File newFolder) {
for (File fileToCopy : oldFolder.listFiles()) {
File copiedFile = new File(newFolder.getAbsolutePath() + "\\" + fileToCopy.getName());
try {
FileInputStream source = new FileInputStream(fileToCopy);
... | public static void compress(File srcFile, File destFile) throws IOException {
InputStream input = null;
OutputStream output = null;
try {
input = new BufferedInputStream(new FileInputStream(srcFile));
output = new GZIPOutputStream(new FileOutputStream(destFile));
... | true |
3,255 | 6,374,428 | 9,597,416 | public String getTags(String content) {
StringBuffer xml = new StringBuffer();
OutputStreamWriter osw = null;
BufferedReader br = null;
try {
String reqData = URLEncoder.encode(paramName, "UTF-8") + "=" + URLEncoder.encode(content, "UTF-8");
URL service = new ... | @Override
protected void doPost(final String url, final InputStream data) throws WebServiceException {
final HttpPost method = new HttpPost(url);
method.setEntity(new InputStreamEntity(data, -1));
try {
final HttpResponse response = this.httpClient.execute(method);
... | false |
3,256 | 14,577,922 | 9,901,451 | public TwilioRestResponse request(String path, String method, Map<String, String> vars) throws TwilioRestException {
String encoded = "";
if (vars != null) {
for (String key : vars.keySet()) {
try {
encoded += "&" + key + "=" + URLEncoder.encode(vars.g... | protected String readUrl(String urlString) throws IOException {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String response = "";
String inputLine;
while ((inputLine = in.readLine()) != null) response += input... | false |
3,257 | 16,224,018 | 22,207,815 | 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 Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileIn... | true |
3,258 | 5,147,985 | 18,099,086 | private void writeJar() {
try {
File outJar = new File(currentProjectDir + DEPLOYDIR + fileSeparator + currentProjectName + ".jar");
jarSize = (int) outJar.length();
File tempJar = File.createTempFile("hipergps" + currentProjectName, ".jar");
tempJar.deleteOnE... | @Override
protected void service(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
res.setHeader("X-Generator", "VisualMon");
String path = req.getPathInfo();
if (null == path || "".equals(path)) res.sendRedirect(req.getServletPath() + "/... | true |
3,259 | 8,996,916 | 19,875,962 |
private void recvMessage(String from, String to) throws Exception {
ConnectionFactoryImpl factory = new ConnectionFactoryImpl();
Receiver receiver = null;
ProviderConnection connection = factory.createConnection(from, to);
Connection conn = DBUtil.getConnection();
PreparedS... | @Override
public void create(DisciplinaDTO disciplina) {
try {
this.criaConexao(false);
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PostgresqlDisciplinaDAO.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
... | true |
3,260 | 13,026,685 | 555,865 | public DoSearch(String searchType, String searchString) {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerDoSearch";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "search.xml";
try {
String urldata = urlString + "?user... | public void testServletTesterClient() throws Exception {
String base_url = tester.createSocketConnector(true);
URL url = new URL(base_url + "/context/hello/info");
String result = IO.toString(url.openStream());
assertEquals("<h1>Hello Servlet</h1>", result);
}
| false |
3,261 | 8,162,671 | 417,300 | public static String getMD5Hash(String hashthis) throws NoSuchAlgorithmException {
byte[] key = "PATIENTISAUTHENTICATION".getBytes();
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(hashthis.getBytes());
return new String(HashUtility.base64Encode(md5.digest(key)));
... | 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]... | false |
3,262 | 10,934,628 | 4,382,405 | public static void main(String[] args) {
try {
{
byte[] bytes1 = { (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
byte[] bytes2 = { (byte) 99, (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
System.out.println("Bytes 2,2,3,0,9 as Base64: "... | public static void fileCopy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf ... | true |
3,263 | 19,299,263 | 15,037,805 | String extractTiffFile(String path) throws IOException {
ZipInputStream in = new ZipInputStream(new FileInputStream(path));
OutputStream out = new FileOutputStream(dir + TEMP_NAME);
byte[] buf = new byte[1024];
int len;
ZipEntry entry = in.getNextEntry();
if (entry ==... | public List<String> generate(String geronimoVersion, String geronimoHome, String instanceNumber) {
geronimoRepository = geronimoHome + "/repository";
Debug.logInfo("The WASCE or Geronimo Repository is " + geronimoRepository, module);
Classpath classPath = new Classpath(System.getProperty("ja... | true |
3,264 | 22,554,072 | 3,134,514 | public static Object transmitObject(String servletURL, Object obj) throws IOException {
URL url;
URLConnection conn;
InputStream is;
OutputStream os;
try {
if (servletURL.startsWith("https") || servletURL.startsWith("HTTPS")) {
System.out.println(J... | public static String getEncryptedPwd(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
byte[] pwd = null;
SecureRandom random = new SecureRandom();
byte[] salt = new byte[SALT_LENGTH];
random.nextBytes(salt);
MessageDigest md = null;
md ... | false |
3,265 | 2,807,114 | 12,816,795 | public Controller(String m_hostname, String team, boolean m_shouldexit) throws InternalException {
m_received_messages = new ConcurrentLinkedQueue<ReceivedMessage>();
m_fragmsgs = new ArrayList<String>();
m_customizedtaunts = new HashMap<Integer, String>();
m_nethandler = new Caching... | public static FileChannel getFileChannel(Object o) throws IOException {
Class c = o.getClass();
try {
Method m = c.getMethod("getChannel", null);
return (FileChannel) m.invoke(o, null);
} catch (IllegalAccessException x) {
} catch (NoSuchMethodException x) {
... | true |
3,266 | 4,629,672 | 22,337,078 | public static String hexSHA1(String value) {
try {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
md.update(value.getBytes("utf-8"));
byte[] digest = md.digest();
return byteToHexString(digest);
} catch (Exception ex) {
... | private List getPluginClassList(List pluginFileList) {
ArrayList l = new ArrayList();
for (Iterator i = pluginFileList.iterator(); i.hasNext(); ) {
URL url = (URL) i.next();
log.debug("Trying file " + url.toString());
try {
BufferedReader r = new B... | false |
3,267 | 3,800,349 | 13,279,978 | private boolean _copyPath(String source, String destination, Object handler) {
try {
FileInputStream fis = new FileInputStream(_fullPathForPath(source));
FileOutputStream fos = new FileOutputStream(_fullPathForPath(destination));
byte[] buffer = new byte[fis.available()];... | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("DOWNLOAD - Send content: " + realFile.getAbsolutePath());
LOGGER.debug("Output stream: " + out.toString());
if (ServerConfiguration.isDynami... | true |
3,268 | 15,102,903 | 11,683,526 | public static void translateTableAttributes(String baseDir, String tableName, NameSpaceDefinition nsDefinition) throws Exception {
setVosiNS(baseDir, "table_att", nsDefinition);
String filename = baseDir + "table_att.xsl";
Scanner s = new Scanner(new File(filename));
PrintWriter fw =... | private static boolean moveFiles(String sourceDir, String targetDir) {
boolean isFinished = false;
boolean fileMoved = false;
File stagingDir = new File(sourceDir);
if (!stagingDir.exists()) {
System.out.println(getTimeStamp() + "ERROR - source directory does not exist.")... | true |
3,269 | 10,062,076 | 9,593,609 | private long generateNativeInstallExe(File nativeInstallFile, String instTemplate, File instClassFile) throws IOException {
InputStream reader = getClass().getResourceAsStream("/" + instTemplate);
ByteArrayOutputStream content = new ByteArrayOutputStream();
String installClassVarStr = "00000... | public static void main(String[] args) throws Exception {
File rootDir = new File("C:\\dev\\workspace_fgd\\gouvqc_crggid\\WebContent\\WEB-INF\\upload");
File storeDir = new File(rootDir, "storeDir");
File workDir = new File(rootDir, "workDir");
LoggerFacade loggerFacade = new Commons... | true |
3,270 | 8,912,113 | 2,150,993 | private static void salvarCategoria(Categoria categoria) throws Exception {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = C3P0Pool.getConnection();
String sql = "insert into categoria VALUES (?,?)";
ps = conn.prepareStatement(sql);
... | public static void main(String[] args) {
if (args.length <= 0) {
System.out.println(" *** SQL script generator and executor ***");
System.out.println(" You must specify name of the file with SQL script data");
System.out.println(" Fisrt rows of this file must be:");
... | false |
3,271 | 21,919,199 | 12,097,099 | private Datastream addManagedDatastreamVersion(Entry entry) throws StreamIOException, ObjectIntegrityException {
Datastream ds = new DatastreamManagedContent();
setDSCommonProperties(ds, entry);
ds.DSLocationType = "INTERNAL_ID";
ds.DSMIME = getDSMimeType(entry);
IRI contentL... | public String[] getLine(String prefecture) {
HttpClient httpclient = null;
String[] lines = null;
try {
httpclient = new DefaultHttpClient();
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("method", "getLin... | false |
3,272 | 481,939 | 1,477,578 | 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 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,273 | 14,132,422 | 7,020,500 | public static void bubble_sort(Sortable[] objects) {
for (int i = objects.length; --i >= 0; ) {
boolean flipped = false;
for (int j = 0; j < i; j++) {
if (objects[j].greater_than(objects[j + 1])) {
Sortable tmp = objects[j];
obj... | public static URL[] getURLsForAllJars(URL url, File tmpDir) {
FileInputStream fin = null;
InputStream in = null;
ZipInputStream zin = null;
try {
ArrayList array = new ArrayList();
in = url.openStream();
String fileName = url.getFile();
... | false |
3,274 | 18,115,173 | 1,037,968 | private void copy(File in, File out) {
log.info("Copying yam file from: " + in.getName() + " to: " + out.getName());
try {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), o... | public static void copyFromFileToFileUsingNIO(File inputFile, File outputFile) throws FileNotFoundException, IOException {
FileChannel inputChannel = new FileInputStream(inputFile).getChannel();
FileChannel outputChannel = new FileOutputStream(outputFile).getChannel();
try {
inpu... | true |
3,275 | 2,381,661 | 14,708,603 | @Test(expected = GadgetException.class)
public void badFetchServesCached() throws Exception {
HttpRequest firstRequest = createCacheableRequest();
expect(pipeline.execute(firstRequest)).andReturn(new HttpResponse(LOCAL_SPEC_XML)).once();
HttpRequest secondRequest = createIgnoreCacheReque... | private void gerarComissao() {
int opt = Funcoes.mensagemConfirma(null, "Confirma gerar comiss�es para o vendedor " + txtNomeVend.getVlrString().trim() + "?");
if (opt == JOptionPane.OK_OPTION) {
StringBuilder insert = new StringBuilder();
insert.append("INSERT INTO RPCOMISSA... | false |
3,276 | 14,183,083 | 4,977,583 | 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.... | protected File downloadUpdate(String resource) throws AgentException {
RESTCall call = makeRESTCall(resource);
call.invoke();
File tmpFile;
try {
tmpFile = File.createTempFile("controller-update-", ".war", new File(tmpPath));
} catch (IOException e) {
... | true |
3,277 | 15,597,101 | 12,741,414 | public void actionPerformed(ActionEvent e) {
if (path.compareTo("") != 0) {
imageName = (path.substring(path.lastIndexOf(File.separator) + 1, path.length()));
String name = imageName.substring(0, imageName.lastIndexOf('.'));
String extension = imageName.substring(imageNam... | private void saveMessage(String server, Message message, byte[] bytes) throws Exception {
ConnectionProvider cp = null;
Connection conn = null;
PreparedStatement ps = null;
try {
SessionFactoryImplementor impl = (SessionFactoryImplementor) getPorta... | false |
3,278 | 11,560,551 | 310,580 | private static void extract(ZipFile zipFile) throws Exception {
FileUtils.deleteQuietly(WEBKIT_DIR);
WEBKIT_DIR.mkdirs();
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
i... | 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,279 | 1,460,670 | 1,160,946 | @Override
public void execute(IAlert alert, IReport report, Rule rule, Row row) {
try {
URL url = new URL(getUrl());
URLConnection con = url.openConnection();
con.setConnectTimeout(getTimeout());
con.setDoOutput(true);
OutputStream out = con.ge... | @Override
public KeySelectorResult select(KeyInfo keyInfo, Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException {
try {
return super.select(keyInfo, purpose, method, context);
} catch (KeySelectorException e) {
LOG.debug("no key f... | false |
3,280 | 967,161 | 5,673,928 | private static FacesBean.Type _createType() {
try {
ClassLoader cl = _getClassLoader();
URL url = cl.getResource("META-INF/faces-bean-type.properties");
if (url != null) {
Properties properties = new Properties();
InputStream is = url.openS... | void loadImage(Frame frame, URL url) throws Exception {
URLConnection conn = url.openConnection();
String mimeType = conn.getContentType();
long length = conn.getContentLength();
InputStream is = conn.getInputStream();
loadImage(frame, is, length, mimeType);
}
| false |
3,281 | 662,799 | 854,262 | 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 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,282 | 16,005,062 | 736,738 | 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());
... | 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,283 | 13,167,991 | 7,044,674 | public void connectToUrl(String url_address) {
message = new StringBuffer("");
try {
URL url = new URL(url_address);
try {
HttpsURLConnection httpsConnection = (HttpsURLConnection) url.openConnection();
httpsConnection.setDoOutput(false);
... | public static User authenticate(final String username, final String password) throws LoginException {
Object result = doPriviledgedAction(new PrivilegedAction() {
public Object run() {
List correctUsers = (List) JsonPath.query("select * from ? where name=?", usersTable(), userna... | false |
3,284 | 19,203,250 | 3,307,772 | private void readAnnotations() throws IOException {
final BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
try {
String line = null;
while ((line = in.readLine()) != null) {
lineNumber++;
if (line.startsWith("ANN... | public void deleteScript(Integer id) {
InputStream is = null;
try {
URL url = new URL(strServlet + getSessionIDSuffix() + "?deleteScript=" + id);
System.out.println("requesting: " + url);
is = url.openStream();
while (is.read() != -1) ;
} catch... | false |
3,285 | 17,052,257 | 22,082,121 | public static String encriptar(String string) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
throw new Exception("Algoritmo de Criptografia não encontrado... | public static String digestMd5(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("文字列がNull、または空です。");
}
MessageDigest md5;
byte[] enclyptedHash;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update... | true |
3,286 | 10,010,443 | 2,721,034 | private final Vector<Class<?>> findSubclasses(URL location, String packageName, Class<?> superClass) {
synchronized (results) {
Map<Class<?>, URL> thisResult = new TreeMap<Class<?>, URL>(CLASS_COMPARATOR);
Vector<Class<?>> v = new Vector<Class<?>>();
String fqcn = searchC... | public File takeFile(File f, String prefix, String suffix) throws IOException {
File nf = createNewFile(prefix, suffix);
FileInputStream fis = new FileInputStream(f);
FileChannel fic = fis.getChannel();
FileOutputStream fos = new FileOutputStream(nf);
FileChannel foc = fos.ge... | false |
3,287 | 17,486,397 | 369,572 | public static String getUserToken(String userName) {
if (userName != null && userName.trim().length() > 0) try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update((userName + seed).getBytes("ISO-8859-1"));
return BaseController.bytesToHex(md.digest());
... | 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,288 | 8,062,077 | 9,049,569 | public void deleteUser(User portalUserBean, AuthSession authSession) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (portalUserBean.getUserId() == null) throw new IllegalArgumentException("id of portal user... | public void reset(int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? ");
psta.setInt(1, currentPilot);
psta.executeUpdate();
jdbc.commit();
} catch (SQLException e) {
... | true |
3,289 | 10,445,018 | 16,755,434 | 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 static int getContentLength(URL urlFileLocation) {
HttpURLConnection connFile = null;
int iFileSize = -1;
try {
connFile = (HttpURLConnection) urlFileLocation.openConnection();
connFile.setDoInput(true);
InputStream is = connFile.getInputStream();
... | false |
3,290 | 18,134,394 | 10,104,168 | private String fetch(String urlstring) {
String content = "";
try {
URL url = new URL(urlstring);
InputStream is = url.openStream();
BufferedReader d = new BufferedReader(new InputStreamReader(is));
String s;
while (null != (s = d.readLine(... | public static String calculateHash(String data, String algorithm) {
if (data == null) {
return null;
}
algorithm = (algorithm == null ? INTERNAL : algorithm.toUpperCase());
if (algorithm.equals(PLAIN)) {
return data;
}
if (algorithm.startsWith(... | false |
3,291 | 3,516,106 | 16,556,715 | 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 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);
... | true |
3,292 | 22,415,294 | 15,810,441 | private String getRenderedBody(String spec) throws Exception {
log.entering(Rss2MailTask.class.getName(), "getRenderedBody");
final URL url = new URL(spec);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
final InputStream ... | private static void addIngredient(int recipeId, String name, String amount, int measureId, int shopFlag) throws Exception {
PreparedStatement pst = null;
try {
pst = conn.prepareStatement("INSERT INTO ingredients (recipe_id, name, amount, measure_id, shop_flag) VALUES (?,?,?,?,?)");
... | false |
3,293 | 5,984,968 | 19,478,367 | public static String send(String method, String url, Map<String, String> paramMap, File file, String encoding) throws HttpServerStatusException {
Log.i(TAG, "url:" + url);
boolean bVisitOK = false;
int tryCnt = 0;
String result = "";
while (!bVisitOK && (tryCnt++ < MAXTRYCNT)... | public void init(String[] arguments) {
if (arguments.length < 1) {
printHelp();
return;
}
String[] valid_args = new String[] { "device*", "d*", "help", "h", "speed#", "s#", "file*", "f*", "gpsd*", "nmea", "n", "garmin", "g", "sirf", "i", "rawdata", "downloadtracks", "... | false |
3,294 | 17,907,353 | 15,113,437 | public static void resourceToFile(final String resource, final String filePath) throws IOException {
log.debug("Classloader is " + IOCopyUtils.class.getClassLoader());
InputStream in = IOCopyUtils.class.getResourceAsStream(resource);
if (in == null) {
log.warn("Resource not '" + ... | protected void loadUrl(URL url) throws BuildException {
Properties props = new Properties();
log("Loading " + url, Project.MSG_VERBOSE);
try {
InputStream is = url.openStream();
try {
loadProperties(props, is, url.getFile().endsWith(".xml"));
... | false |
3,295 | 744,368 | 20,169,227 | void run(String[] args) {
InputStream istream = System.in;
System.out.println("TradeMaximizer " + version);
String filename = parseArgs(args, false);
if (filename != null) {
System.out.println("Input from: " + filename);
try {
if (filename.star... | @Override
public String addUser(UserInfoItem user) throws DatabaseException {
if (user == null) throw new NullPointerException("user");
if (user.getSurname() == null || "".equals(user.getSurname())) throw new NullPointerException("user.getSurname()");
try {
getConnection().se... | false |
3,296 | 14,757,689 | 8,156,588 | protected Collection<BibtexEntry> getBibtexEntries(String ticket, String citations) throws IOException {
try {
URL url = new URL(URL_BIBTEX);
URLConnection conn = url.openConnection();
conn.setRequestProperty("Cookie", ticket + "; " + citations);
conn.connect(... | private static final BufferedInputStream createInputStreamFromRemoteUrl(String uri, ClientConnectionManager connectionManager) {
InputStream contentInput = null;
if (connectionManager == null) {
try {
URL url = new URI(uri).toURL();
URLConnection conn = ur... | false |
3,297 | 15,416,859 | 23,677,113 | private boolean checkTimestamp(File timestamp, URL url) {
try {
if (timestamp.exists()) {
FileReader reader = null;
Date dateLocal = null;
try {
reader = new FileReader(timestamp);
StringWriter tmp = new Stri... | public static String downloadWebpage3(String address) throws ClientProtocolException, IOException {
HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(address);
HttpResponse response = client.execute(request);
BufferedReader br = new BufferedReader(new InputStreamReader(respo... | false |
3,298 | 14,650,350 | 90,593 | private boolean adjust(String stationUrl) throws LastFMError {
try {
URL url = new URL("http://" + mBaseURL + "/adjust.php?session=" + mSession + "&url=" + URLEncoder.encode(stationUrl, "UTF-8"));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.con... | 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;
... | false |
3,299 | 21,139,380 | 21,618,564 | @Test
public void GetBingSearchResult() throws UnsupportedEncodingException {
String query = "Scanner Java example";
String request = "http://api.bing.net/xml.aspx?AppId=731DD1E61BE6DE4601A3008DC7A0EB379149EC29" + "&Version=2.2&Market=en-US&Query=" + URLEncoder.encode(query, "UTF-8") + "&Sources... | protected String insertCommand(String command) throws ServletException {
String digest;
try {
MessageDigest md = MessageDigest.getInstance(m_messagedigest_algorithm);
md.update(command.getBytes());
byte bytes[] = new byte[20];
m_random.nextBytes(bytes)... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.