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 |
|---|---|---|---|---|---|
5,200 | 2,721,034 | 16,083,957 | 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... | protected void createValueListAnnotation(IProgressMonitor monitor, IPackageFragment pack, Map model) throws CoreException {
IProject pj = pack.getJavaProject().getProject();
QualifiedName qn = new QualifiedName(JstActivator.PLUGIN_ID, JstActivator.PACKAGE_INFO_LOCATION);
String location = pj... | true |
5,201 | 21,807,526 | 7,109,222 | public static String calculateHA2(String uri) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(getBytes("GET", ISO_8859_1));
md.update((byte) ':');
md.update(getBytes(uri, ISO_8859_1));
return toHexString(md.digest());
... | public static void zipMapBos(DitaBoundedObjectSet mapBos, File outputZipFile, MapBosProcessorOptions options) throws Exception {
log.debug("Determining zip file organization...");
BosVisitor visitor = new DxpFileOrganizingBosVisitor();
visitor.visit(mapBos);
if (!options.isQuiet()) l... | false |
5,202 | 5,505,848 | 41,672 | public void testResponseTimeout() throws Exception {
server.enqueue(new MockResponse().setBody("ABC").clearHeaders().addHeader("Content-Length: 4"));
server.enqueue(new MockResponse().setBody("DEF"));
server.play();
URLConnection urlConnection = server.getUrl("/").openConnection();
... | public Configuration(URL url) {
InputStream in = null;
try {
load(in = url.openStream());
} catch (Exception e) {
throw new RuntimeException("Could not load configuration from " + url, e);
} finally {
if (in != null) {
try {
... | false |
5,203 | 1,931,703 | 9,593,394 | public GPSTrace loadGPSTrace(long reportID) {
try {
URL url = new URL(SERVER_URL + XML_PATH + "gps.xml");
System.out.println(url);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
... | private RatingServiceSelectionResponseType contactService(String xmlInputString) throws Exception {
OutputStream outputStream = null;
RatingServiceSelectionResponseType rType = null;
try {
URL url = new URL(ENDPOINT_URL);
HttpURLConnection connection = (HttpURLConnect... | false |
5,204 | 18,998,637 | 14,960,335 | public boolean loadResource(String resourcePath) {
try {
URL url = Thread.currentThread().getContextClassLoader().getResource(resourcePath);
if (url == null) {
logger.error("Cannot find the resource named: '" + resourcePath + "'. Failed to load the keyword list.");
... | private String readData(URL url) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer responseBuffer = new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
responseBuffer.app... | true |
5,205 | 7,366,470 | 12,739,583 | public RFC1345List(URL url) {
if (url == null) return;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(url.openStream())));
final String linePattern = " XX??????? HHHH X";
String line;
mnemos = new HashMap... | public void testPreparedStatement0009() throws Exception {
Connection cx = getConnection();
dropTable("#t0009");
Statement stmt = cx.createStatement();
stmt.executeUpdate("create table #t0009 " + " (i integer not null, " + " s char(10) not null) ");
cx.setAuto... | false |
5,206 | 3,076,854 | 3,993,124 | public static byte[] 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 File getTempFile(DigitalObject object, String pid) throws Exception {
File directory = new File(tmpDir, object.getId());
File target = new File(directory, pid);
if (!target.exists()) {
target.getParentFile().mkdirs();
target.createNewFile();
}
... | false |
5,207 | 21,277,519 | 5,312,720 | public static String getMD5(String s) throws Exception {
MessageDigest complete = MessageDigest.getInstance("MD5");
complete.update(s.getBytes());
byte[] b = complete.digest();
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[... | public void putMedia(Media m) {
if (m == null) {
return;
}
if (_conn == null) {
log.error("DatabaseDatastore not connected!");
return;
}
if (log.isTraceEnabled()) {
log.trace("Writing Media " + m.toString() + " to database");
... | false |
5,208 | 14,196,272 | 15,948,682 | private synchronized File gzipTempFile(File tempFile) throws BlogunityException {
try {
File gzippedFile = new File(BlogunityManager.getSystemConfiguration().getTempDir(), tempFile.getName() + ".gz");
GZIPOutputStream zos = new GZIPOutputStream(new FileOutputStream(gzippedFile));
... | private byte[] odszyfrujKlucz(byte[] kluczSesyjny, int rozmiarKlucza) {
byte[] odszyfrowanyKlucz = null;
byte[] kluczTymczasowy = null;
try {
MessageDigest skrot = MessageDigest.getInstance("SHA-1");
skrot.update(haslo.getBytes());
byte[] skrotHasla = skro... | false |
5,209 | 3,096,692 | 10,062,078 | public static void perform(ChangeSet changes, ArchiveInputStream in, ArchiveOutputStream out) throws IOException {
ArchiveEntry entry = null;
while ((entry = in.getNextEntry()) != null) {
System.out.println(entry.getName());
boolean copy = true;
for (Iterator it =... | private void copy(File fin, File fout) throws IOException {
FileOutputStream out = null;
FileInputStream in = null;
try {
out = new FileOutputStream(fout);
in = new FileInputStream(fin);
byte[] buf = new byte[2048];
int read = in.read(buf);
... | true |
5,210 | 379,581 | 564,199 | public void login(String UID, String PWD, int CTY) throws Exception {
sSideURL = sSideURLCollection[CTY];
sUID = UID;
sPWD = PWD;
iCTY = CTY;
sLoginLabel = getLoginLabel(sSideURL);
String sParams = getLoginParams();
CookieHandler.setDefault(new ListCookieHandl... | private boolean doStudentCreditUpdate(Double dblCAmnt, String stuID) throws Exception {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Boolean blOk = false;
String strMessage = "";
try {
conn = dbMan.getPOSConnection();
con... | false |
5,211 | 12,021,779 | 8,701,067 | private void insert() throws SQLException, NamingException {
Logger logger = getLogger();
if (logger.isDebugEnabled()) {
logger.debug("enter - " + getClass().getName() + ".insert()");
}
try {
if (logger.isInfoEnabled()) {
logger.info("insert():... | public void markAsCachedHelper(Item item, Date from, Date to, Map<String, Boolean> properties) {
if (properties.size() == 0) {
return;
}
Connection conn = null;
Iterable<Integer> props = representer.getInternalReps(properties.keySet());
Integer hostIndex = represe... | true |
5,212 | 21,481,555 | 13,529,502 | private static void loadCommandList() {
final URL url;
try {
url = IOUtils.getResource(null, PYTHON_MENU_FILE);
} catch (final FileNotFoundException ex) {
log.error("File '" + PYTHON_MENU_FILE + "': " + ex.getMessage());
return;
}
final Lis... | private Component createLicensePane(String propertyKey) {
if (licesePane == null) {
String licenseText = "";
BufferedReader in = null;
try {
String filename = "conf/LICENSE.txt";
java.net.URL url = FileUtil.toURL(filename);
... | true |
5,213 | 15,102,903 | 4,684,601 | 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 =... | 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 |
5,214 | 23,370,620 | 20,006,636 | private File prepareFileForUpload(File source, String s3key) throws IOException {
File tmp = File.createTempFile("dirsync", ".tmp");
tmp.deleteOnExit();
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(source);
out = new D... | public void trimAndWriteNewSff(OutputStream out) throws IOException {
TrimParser trimmer = new TrimParser();
SffParser.parseSFF(untrimmedSffFile, trimmer);
tempOut.close();
headerBuilder.withNoIndex().numberOfReads(numberOfTrimmedReads);
SffWriter.writeCommonHeader(headerBuil... | true |
5,215 | 16,809,623 | 17,729,553 | 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 boolean clonarFichero(String rutaFicheroOrigen, String rutaFicheroDestino) {
System.out.println("");
System.out.println("*********** DENTRO DE 'clonarFichero' ***********");
boolean estado = false;
try {
FileInputStream entrada = new FileInputStream(rutaFicheroOrig... | false |
5,216 | 15,597,101 | 8,506,682 | 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... | public static File getFileFromURL(URL url) {
File tempFile;
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
String tempDir = System.getProperty("java.io.tmpdir", ".");
tempFile = File.createTempFile("xxindex", ".tmp", new File(tempDir));
... | false |
5,217 | 13,660,039 | 18,675,737 | public static void main(String[] args) throws Exception {
if (args.length != 2) {
PrintUtil.prt("arguments: sourcefile, destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | private void post(String title, Document content, Set<String> tags) throws HttpException, IOException, TransformerException {
PostMethod method = null;
try {
method = new PostMethod("http://www.blogger.com/feeds/" + this.blogId + "/posts/default");
method.addRequestHeader("GD... | true |
5,218 | 14,799,225 | 16,475,859 | public FTPUtil(final String server) {
log.debug("~ftp.FTPUtil() : Creating object");
ftpClient = new FTPClient();
try {
ftpClient.connect(server);
ftpClient.login("anonymous", "");
ftpClient.setConnectTimeout(120000);
ftpClient.setSoTimeout(120... | public void ftpUpload() {
FTPClient ftpclient = null;
InputStream is = null;
try {
ftpclient = new FTPClient();
ftpclient.connect(host, port);
if (logger.isDebugEnabled()) {
logger.debug("FTP连接远程服务器:" + host);
}
ftpc... | true |
5,219 | 13,816,650 | 13,344,859 | private synchronized void createFTPConnection() throws RemoteClientException {
ftpClient = new FTPClient();
try {
URL url = fileset.getHostURL();
PasswordAuthentication passwordAuthentication = fileset.getPasswordAuthentication();
if (null == passwordAuthenticatio... | public static File copyFile(File fileToCopy, File copiedFile) {
BufferedInputStream in = null;
BufferedOutputStream outWriter = null;
if (!copiedFile.exists()) {
try {
copiedFile.createNewFile();
} catch (IOException e1) {
ExceptionHand... | false |
5,220 | 3,533,700 | 637,320 | public Object next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
this.currentGafFilePath = this.url;
try {
if (this.httpURL != null) {
LOG.info("Reading URL :" + httpURL);
InputStream is = this.httpURL.openStream()... | public void uploadFile(File inputFile, String targetFile) throws IOException {
System.out.println("Uploading " + inputFile.getName() + " to " + targetFile);
File outputFile = new File(targetFile);
if (targetFile.endsWith("/")) {
outputFile = new File(outputFile, inputFile.getName... | true |
5,221 | 11,238,287 | 7,949,001 | public static void main(final String[] args) throws RecognitionException, TokenStreamException, IOException, IllegalOptionValueException, UnknownOptionException {
try {
CmdLineParser cmdLineParser = new CmdLineParser();
Option formatOption = cmdLineParser.addStringOption('f', "format... | protected byte[] getBytesForWebPageUsingHTTPClient(String urlString) throws ClientProtocolException, IOException {
log("Retrieving url: " + urlString);
DefaultHttpClient httpclient = new DefaultHttpClient();
if (this.archiveAccessSpecification.getUserID() != null) {
httpclient.ge... | false |
5,222 | 19,780,094 | 12,879,112 | protected PTask commit_result(Result r, SyrupConnection con) throws Exception {
try {
int logAction = LogEntry.ENDED;
String kk = r.context().task().key();
if (r.in_1_consumed() && r.context().in_1_link() != null) {
sqlImpl().updateFunctions().updateInLink... | protected String getGraphPath(String name) throws ServletException {
String hash;
try {
MessageDigest md = MessageDigest.getInstance(m_messagedigest_algorithm);
md.update(name.getBytes());
hash = bytesToHex(md.digest());
} catch (NoSuchAlgorithmException e... | false |
5,223 | 1,468,131 | 22,050,257 | public void run() {
try {
if (FileDenAccount.loginsuccessful) {
host = FileDenAccount.username + " | FileDen.com";
} else {
host = "FileDen.com";
uploadFailed();
return;
}
if (file.length() > 1073... | private void importSources() {
InputOutput io = IOProvider.getDefault().getIO("Import Sources", false);
io.select();
PrintWriter pw = new PrintWriter(io.getOut());
pw.println("Beginning transaction....");
pw.println("Processing selected files:");
String[][] selectedFi... | false |
5,224 | 20,305,472 | 9,549,237 | @Override
public void run() {
try {
FileChannel out = new FileOutputStream(outputfile).getChannel();
long pos = 0;
status.setText("Slučovač: Proces Slučování spuštěn.. Prosím čekejte..");
for (int i = 1; i <= noofparts; i++) {
FileChannel i... | public void testResolveURL() throws Exception {
System.out.println("resolveURL");
File bigFile = new File("./src/test/java/big.json");
File smallFile = new File("./src/test/java/sample1.json");
Object[] urls = new Object[] { "http://json-schema.org/schema", "http://json-schema.org/hy... | false |
5,225 | 20,267,318 | 4,707,507 | 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... | @Override
public HttpResponse execute() throws IOException {
if (this.method == HttpMethod.GET) {
String url = this.toString();
if (url.length() > this.cutoff) {
if (log.isLoggable(Level.FINER)) log.finer("URL length " + url.length() + " too long, converting GET t... | false |
5,226 | 13,696,846 | 12,082,137 | protected void sort(int a) {
int[] masiv = new int[a];
Random rand = new Random();
for (int i = 0; i <= a; i++) {
masiv[i] = rand.nextInt(200);
}
int d;
for (int j = 0; j < a; j++) {
for (int i = 0; i < a; i++) {
if (masiv[i] < ... | public static Set<Municipality> getMunicipios(String pURL) {
Set<Municipality> result = new HashSet<Municipality>();
String iniCuerr = "<cuerr>";
String finCuerr = "</cuerr>";
String iniDesErr = "<des>";
String finDesErr = "</des>";
String iniMun = "<muni>";
S... | false |
5,227 | 3,762,872 | 1,889,366 | 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 String hash(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
log.info("No sha-256 available");
try {
digest = MessageDigest.getInstance("SHA-... | true |
5,228 | 15,854,397 | 12,614,306 | 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... | 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 |
5,229 | 16,902,397 | 20,836,129 | private void convertClasses(File source, File destination) throws PostProcessingException, CodeCheckException, IOException {
Stack sourceStack = new Stack();
Stack destinationStack = new Stack();
sourceStack.push(source);
destinationStack.push(destination);
while (!sourceStac... | public void addUser(String strUserName, String strPass) {
String datetime = Function.getSysTime().toString();
String time = datetime.substring(0, 4) + datetime.substring(5, 7) + datetime.substring(8, 10) + datetime.substring(11, 13) + datetime.substring(14, 16) + datetime.substring(17, 19) + datetim... | false |
5,230 | 10,536,444 | 21,609,542 | public static void copyFile(File source, File destination) throws IOException {
BufferedInputStream in = new BufferedInputStream(new FileInputStream(source));
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(destination));
byte[] buffer = new byte[4096... | public static long[] getUids(String myUid) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpGet get = new HttpGet(UIDS_URI);
HttpResponse response = client.execute(get);
if (response.getStatusLine().getStatusCode() ==... | false |
5,231 | 11,322,573 | 5,433,055 | private void preprocessObjects(GeoObject[] objects) throws IOException {
System.out.println("objects.length " + objects.length);
for (int i = 0; i < objects.length; i++) {
String fileName = objects[i].getPath();
int dotindex = fileName.lastIndexOf(".");
dotindex =... | public static Coordinate getCoordenadas(String RCoURL) {
Coordinate coord = new Coordinate();
String pURL;
String iniPC1 = "<pc1>";
String iniPC2 = "<pc2>";
String finPC1 = "</pc1>";
String finPC2 = "</pc2>";
String iniX = "<xcen>";
String iniY = "<yce... | false |
5,232 | 16,650,253 | 12,214,439 | public int visitStatement(String statement) throws SQLException {
mySQLLogger.info(statement);
if (getConnection() == null) {
throw new JdbcException("cannot exec: " + statement + ", because 'not connected to database'");
}
Statement stmt = getConnection().createStatement... | public boolean saveNote(NoteData n) {
String query;
try {
conn.setAutoCommit(false);
Statement stmt = null;
ResultSet rset = null;
stmt = conn.createStatement();
query = "select * from notes where noteid = " + n.getID();
rset = ... | true |
5,233 | 21,733,173 | 2,768,538 | private void downloadFtp(File file, URL jurl) throws SocketException, IOException {
System.out.println("downloadFtp(" + file + ", " + jurl + ")");
FTPClient client = new FTPClient();
client.addProtocolCommandListener(new ProtocolCommandListener() {
public void protocolCommandSen... | public static InputStream getInputStream(String filepath) throws Exception {
if (isUrl(filepath)) {
URL url = URI.create(filepath).toURL();
return url.openStream();
} else {
return new FileInputStream(new File(filepath));
}
}
| false |
5,234 | 18,516,388 | 15,480,455 | public void test() throws Exception {
StorageString s = new StorageString("UTF-8");
s.addText("Test");
try {
s.getOutputStream();
fail("Should throw IOException as method not supported.");
} catch (IOException e) {
}
try {
s.getWrit... | public static void TestDBStore() throws PDException, Exception {
StoreDDBB StDB = new StoreDDBB("jdbc:derby://localhost:1527/Prodoc", "Prodoc", "Prodoc", "org.apache.derby.jdbc.ClientDriver;STBLOB");
System.out.println("Driver[" + StDB.getDriver() + "] Tabla [" + StDB.getTable() + "]");
StD... | true |
5,235 | 18,942,525 | 13,766,979 | public void updateUserInfo(AuthSession authSession, AuthUserExtendedInfo infoAuth) {
log.info("Start update auth");
PreparedStatement ps = null;
DatabaseAdapter db = null;
try {
db = DatabaseAdapter.getInstance();
String sql = "update WM_AUTH_USER " + "set " +... | @SuppressWarnings("unused")
private GraphicalViewer createGraphicalViewer(Composite parent) {
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(parent);
viewer.getControl().setBackground(parent.getBackground());
viewer.setRootEditPart(new ScalableFreef... | false |
5,236 | 22,821,011 | 20,519,147 | public static void main(String[] args) {
String command = "java -jar ";
String linkerJarPath = "";
String path = "";
String osName = System.getProperty("os.name");
String temp = Launcher.class.getResource("").toString();
int index = temp.indexOf(".jar");
int ... | public boolean load() {
if (getFilename() != null && getFilename().length() > 0) {
try {
File file = new File(PreferencesManager.loadDirectoryLocation("macros") + File.separator + getFilename());
URL url = file.toURL();
InputStreamReader isr = new ... | false |
5,237 | 20,926,888 | 12,577,739 | public void setUp() {
configureProject("src/etc/testcases/taskdefs/optional/net/ftp.xml");
getProject().executeTarget("setup");
tmpDir = getProject().getProperty("tmp.dir");
ftp = new FTPClient();
ftpFileSep = getProject().getProperty("ftp.filesep");
myFTPTask.setSepa... | public static String digest(String password) {
try {
byte[] digest;
synchronized (__TYPE) {
if (__md == null) {
try {
__md = MessageDigest.getInstance("MD5");
} catch (Exce... | false |
5,238 | 8,274,572 | 23,094,550 | public ODFSignatureService(TimeStampServiceValidator timeStampServiceValidator, RevocationDataService revocationDataService, SignatureFacet signatureFacet, InputStream documentInputStream, OutputStream documentOutputStream, TimeStampService timeStampService, String role, IdentityDTO identity, byte[] photo, DigestAl... | public StringBuffer render(RenderEngine c) {
String logTime = null;
if (c.getWorkerContext() != null) {
logTime = c.getWorkerContext().getWorkerStart();
}
if (c.isBreakState() || !c.canRender("u")) {
return new StringBuffer();
}
StringBuffer bu... | true |
5,239 | 9,980,885 | 6,569,409 | private void verifyAvailability() {
for (int i = 0; i < servers.size(); i++) {
String hostEntry = (String) servers.get(i);
String hostString = hostEntry.substring(0, hostEntry.indexOf(":"));
String portString = hostEntry.substring(hostEntry.indexOf(":") + 1);
... | public String obfuscateString(String string) {
String obfuscatedString = null;
try {
MessageDigest md = MessageDigest.getInstance(ENCRYPTION_ALGORITHM);
md.update(string.getBytes());
byte[] digest = md.digest();
obfuscatedString = new String(Base64.enc... | false |
5,240 | 8,693,707 | 2,396,193 | private void copy(URL url, IFile file, IProgressMonitor monitor) throws CoreException, IOException {
InputStream input = null;
try {
input = url.openStream();
if (file.exists()) {
file.setContents(input, IResource.FORCE, monitor);
... | public static String getTitleFromURLFast(String p_url) throws Exception {
URL x_url = new URL(p_url);
URLConnection x_conn = x_url.openConnection();
InputStreamReader x_is_reader = new InputStreamReader(x_conn.getInputStream());
BufferedReader x_reader = new BufferedReader(x_is_reade... | false |
5,241 | 15,519,967 | 1,613,935 | private void output(HttpServletResponse resp, InputStream is, long length, String fileName) throws Exception {
resp.reset();
String mimeType = "image/jpeg";
resp.setContentType(mimeType);
resp.setContentLength((int) length);
resp.setHeader("Content-Disposition", "inline; file... | public static boolean copyFile(File sourceFile, File destinationFile) {
boolean copySuccessfull = false;
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(... | true |
5,242 | 1,699,613 | 20,586,748 | 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 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... | false |
5,243 | 4,381,118 | 7,998,445 | private void loadFile(File file) throws Exception {
Edl edl = new Edl("file:///" + file.getAbsolutePath());
URL url = ExtractaHelper.retrieveUrl(edl.getUrlRetrievalDescriptor());
String sUrlString = url.toExternalForm();
if (sUrlString.startsWith("file:/") && (sUrlString.charAt(6) !=... | public static BufferedImage readDicom(final URL url, final SourceImage src) {
assert url != null;
assert src != null;
BufferedImage bi = null;
try {
DicomInputStream dis = new DicomInputStream(new BufferedInputStream(url.openStream()));
src.read(dis);
... | false |
5,244 | 5,843,848 | 3,211,242 | private static void loadListFromRecouces(String category, URL url, DataSetArray<DataSetList> list, final StatusLineManager slm) {
i = 0;
try {
if (url == null) return;
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(... | public static String callService(String urlString) throws NoItemException, ServiceException {
if (urlString == null || urlString.length() < 1) return null;
InputStream inputStream = null;
try {
URL url = new URL(urlString);
URLConnection connection = url.openConnectio... | false |
5,245 | 17,164,077 | 12,728,214 | public void readConfig(String urlString) throws Exception {
try {
URL url = new URL(urlString);
InputStream in = url.openStream();
XmlDoc xml = new Parser().parse(new InputSource(in), true, true);
Verifier v = new Verifier(InputOutput.create(SCHEMA), null);
... | protected GraphicalViewer createGraphicalViewer(Composite parent) {
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(parent);
viewer.getControl().setBackground(parent.getBackground());
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
Gr... | false |
5,246 | 5,523,389 | 23,041,340 | 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();
... | private HashSet<String> loadSupportedAnnotationTypes(VannitationType baseVannitationType) {
Enumeration<URL> urls = null;
try {
urls = this.getClass().getClassLoader().getResources("META-INF/" + baseVannitationType);
} catch (IOException e) {
throw new RuntimeExceptio... | false |
5,247 | 2,873,508 | 417,300 | PackageFileImpl(PackageDirectoryImpl dir, String name, InputStream data) throws IOException {
this.dir = dir;
this.name = name;
this.updates = dir.getUpdates();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
IOUtils.copy(data, stream);
updates.setNewData(... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | true |
5,248 | 20,979,580 | 1,516,551 | public void doAction() throws MalformedURLException, IOException, Exception {
URL url = new URL(CheckNewVersionAction.VERSION_FILE);
InputStream is = url.openStream();
byte[] buffer = Utils.loadBytes(is);
is.close();
String version = new String(buffer);
if (version !=... | public static HttpURLConnection getHttpConn(String urlStr, String Method) throws IOException {
URL url = null;
HttpURLConnection connection = null;
url = new URL(urlStr);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.s... | false |
5,249 | 12,524,506 | 621,591 | public static void copyFile(File in, File outDir) throws IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
File out = new File(outDir, in.getName());
destinati... | 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 |
5,250 | 11,627,705 | 20,178,135 | public static void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
... | public MpegPresentation(URL url) throws IOException {
File file = new File(url.getPath());
InputStream input = url.openStream();
DataInputStream ds = new DataInputStream(input);
try {
parseFile(ds);
prepareTracks();
if (audioTrackBox != null && aud... | false |
5,251 | 19,166,563 | 7,384,220 | private String doSearch(String query) {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("http://boss.yahooapis.com/ysearch/web/v1/").append(query).append("?appid=wGsFV_DV34EwXnC.2Bt_Ql8Kcir_HmrxMzWUF2fv64CA8ha7e4zgudqXFA8K_J4-&format=xml&filter=-porn");
try {
... | public void onItem(FeedParserState state, String title, String link, String description, String permalink) throws FeedParserException {
if (counter >= MAX_FEEDS) {
throw new FeedPollerCancelException("Maximum number of items reached");
}
bo... | false |
5,252 | 17,921,696 | 13,029,548 | private String generateStorageDir(String stringToBeHashed) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(stringToBeHashed.getBytes());
byte[] hashedKey = digest.digest();
return Util.encodeArrayToHexadecimalString(hashedKey);... | public String getUser() {
try {
HttpGet get = new HttpGet("http://twemoi.status.net/api/account/verify_credentials.xml");
consumer.sign(get);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
if (response != ... | false |
5,253 | 13,212,350 | 417,300 | public static void copyFile(File source, File dest) {
try {
FileChannel in = new FileInputStream(source).getChannel();
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
FileChannel out = new FileOutputStream(dest).getChannel();
in.transferTo(0... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | true |
5,254 | 13,490,964 | 18,034,383 | public void write(File file) throws Exception {
if (isInMemory()) {
FileOutputStream fout = null;
try {
fout = new FileOutputStream(file);
fout.write(get());
} finally {
if (fout != null) {
fout.close();
... | public static File copy(String inFileName, String outFileName) throws IOException {
File inputFile = new File(inFileName);
File outputFile = new File(outFileName);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c... | true |
5,255 | 7,396,679 | 40,044 | public static boolean copy(FileSystem srcFS, Path src, FileSystem dstFS, Path dst, boolean deleteSource, boolean overwrite, Configuration conf) throws IOException {
LOG.debug("[sgkim] copy - start");
dst = checkDest(src.getName(), dstFS, dst, overwrite);
if (srcFS.getFileStatus(src).isDir())... | 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 |
5,256 | 5,551,392 | 6,371,582 | public static String getMD5Str(String source) {
String s = null;
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(sou... | public void deleteDomain(final List<Integer> domainIds) {
try {
connection.setAutoCommit(false);
final int defaultDomainId = ((DomainDb) cmDB.getDefaultDomain()).getDomainId();
boolean defaultDomainDeleted = (Boolean) new ProcessEnvelope().executeObject(new ExecuteProcess... | false |
5,257 | 137,780 | 1,096,936 | 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 String readJarURL(URL url) throws IOException {
JarURLConnection juc = (JarURLConnection) url.openConnection();
InputStream in = juc.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
int i = in.read();
while (i != -1) {
out.... | false |
5,258 | 22,328,849 | 22,328,845 | protected void doRestoreOrganize() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strDelQuery = "DELETE FROM " + Common.ORGANIZE_TABLE;
String strSelQuery = "SELECT organize_id,organize_type_id,organize_name,organize_man... | protected void doBackupOrganizeRelation() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strSelQuery = "SELECT organize_id,organize_type_id,child_id,child_type_id,remark " + "FROM " + Common.ORGANIZE_RELATION_TABLE;
Stri... | true |
5,259 | 6,716,087 | 699,719 | public static String getMD5(String input) {
String res = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes("ISO8859_1"));
byte[] md5 = algorithm.digest();
String tmp = "... | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnClear) {
passwordField.setText("");
}
for (int i = 0; i < 10; i++) {
if (e.getSource() == btnNumber[i]) {
String password = new String((p... | true |
5,260 | 20,517,803 | 21,679,395 | public String execute(HttpServletRequest request, HttpServletResponse response, User user, String parameter) throws Exception {
long resourceId = ServletRequestUtils.getLongParameter(request, "resourceId", 0L);
BinaryAttribute binaryAttribute = resourceManager.readAttribute(resourceId, parameter, us... | 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.isDynamicSEL()) {
... | true |
5,261 | 5,498,222 | 8,452,131 | public static void copyFile(String inputFile, String outputFile) throws IOException {
FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
for (int b = fis.read(); b != -1; b = fis.read()) fos.write(b);
fos.close();
fi... | public void put(String path, File fileToPut) throws IOException {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(this.endpointURL, this.endpointPort);
log.debug("Ftp put reply: " + ftp.getReplyString());
reply = ftp.getReplyCode();
... | false |
5,262 | 11,986,407 | 9,398,847 | public static String md5(String input) {
String res = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] md5 = algorithm.digest();
String tmp = "";
... | public void close() throws IOException {
output.flush();
output.close();
FTPClient client = new FTPClient();
if (server == null) {
throw new IOException("FTP_SERVER property is missing");
} else {
if (port != null) {
... | false |
5,263 | 2,603,514 | 11,511,985 | private static String computeSHA(String input) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(input.getBytes("UTF-8"));
byte[] code = md.digest();
return convertToHex(code);
} catch (NoSuchAlgorithmException e) {
l... | public static void test() {
try {
Pattern pattern = Pattern.compile("[0-9]{3}\\. <a href='(.*)\\.html'>(.*)</a><br />");
URL url = new URL("http://farmfive.com/");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
... | false |
5,264 | 17,999,563 | 5,090,669 | public static void compressFile(File f) throws IOException {
File target = new File(f.toString() + ".gz");
System.out.print("Compressing: " + f.getName() + ".. ");
long initialSize = f.length();
FileInputStream fis = new FileInputStream(f);
GZIPOutputStream out = new GZIPOutp... | private static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel... | true |
5,265 | 1,158,841 | 1,502,582 | public static int gzipFile(File file_input, String file_output) {
File gzip_output = new File(file_output);
GZIPOutputStream gzip_out_stream;
try {
FileOutputStream out = new FileOutputStream(gzip_output);
gzip_out_stream = new GZIPOutputStream(new BufferedOutputStrea... | public void get(final String remoteFilePath, final String remoteFileName, final String localName) {
final FTPClient ftp = new FTPClient();
final FTPMessageCollector listener = new FTPMessageCollector();
try {
final String localDirName = localName.substring(0, localName.lastIndexO... | false |
5,266 | 7,682,331 | 2,247,987 | @org.junit.Test
public void testReadWrite() throws Exception {
final String reference = "testString";
final Reader reader = new StringReader(reference);
final StringWriter osString = new StringWriter();
final Reader teeStream = new TeeReaderWriter(reader, osString);
IOUti... | public static void main(String argv[]) {
Matrix A, B, C, Z, O, I, R, S, X, SUB, M, T, SQ, DEF, SOL;
int errorCount = 0;
int warningCount = 0;
double tmp, s;
double[] columnwise = { 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12. };
double[] rowwise = { 1., 4., 7., 1... | true |
5,267 | 21,996,772 | 22,950,123 | public static void copy(final File src, File dst, final boolean overwrite) throws IOException, IllegalArgumentException {
if (!src.isFile() || !src.exists()) {
throw new IllegalArgumentException("Source file '" + src.getAbsolutePath() + "' not found!");
}
if (dst.exists()) {
... | private boolean exportPKC(String keystoreLocation, String pw) {
boolean created = false;
KeyStore ks = null;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new BufferedInputStream(new FileInputStream(keystoreLocation)), pw.toCharArray());
... | true |
5,268 | 5,246,170 | 9,717,674 | public static void fileCopy(String src, String dst) {
try {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dst);
int read = -1;
byte[] buf = new byte[8192];
while ((read = fis.read(buf)) != -1) {
... | private void extractSourceFiles(String jar) {
JarInputStream in = null;
BufferedOutputStream out = null;
try {
in = new JarInputStream(new FileInputStream(getProjectFile(jar)));
JarEntry item;
byte buffer[] = new byte[4096];
int buflength;
... | true |
5,269 | 12,445,282 | 481,375 | static boolean writeProperties(Map<String, String> customProps, File destination) throws IOException {
synchronized (PropertiesIO.class) {
L.info(Msg.msg("PropertiesIO.writeProperties.start"));
File tempFile = null;
BufferedInputStream existingCfgInStream = null;
... | public void bubbleSort(int[] arr) {
boolean swapped = true;
int j = 0;
int tmp;
while (swapped) {
swapped = false;
j++;
for (int i = 0; i < arr.length - j; i++) {
if (arr[i] > arr[i + 1]) {
tmp = arr[i];
... | false |
5,270 | 9,913,454 | 16,360,226 | private void createScript(File scriptsLocation, String relativePath, String scriptContent) {
Writer fileWriter = null;
try {
File scriptFile = new File(scriptsLocation.getAbsolutePath() + "/" + relativePath);
scriptFile.getParentFile().mkdirs();
fileWriter = new F... | public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Parameters: method arg1 arg2 arg3 etc");
System.out.println("");
System.out.println("Methods:");
System.out.println(" reloadpolicies");
System.out.println(" ... | true |
5,271 | 23,069,799 | 15,593,678 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | private static void copyFile(File in, File out) throws Exception {
final FileInputStream input = new FileInputStream(in);
try {
final FileOutputStream output = new FileOutputStream(out);
try {
final byte[] buf = new byte[4096];
int readBytes = ... | true |
5,272 | 21,277,519 | 21,130,111 | public static String getMD5(String s) throws Exception {
MessageDigest complete = MessageDigest.getInstance("MD5");
complete.update(s.getBytes());
byte[] b = complete.digest();
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[... | public static String SHA1(String string) throws XLWrapException {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
throw new XLWrapException("SHA-1 message digest is not available.");
}
byte[] data... | true |
5,273 | 7,237,618 | 588,571 | 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... | public static void main(String[] args) throws Exception {
String uri = args[0];
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.open(new Path(uri));
IOUtils.copyBytes... | true |
5,274 | 17,954,700 | 9,725,104 | public static String getPasswordHash(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes());
byte[] byteData = md.digest();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < byteDa... | public String calcMD5(String sequence) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md5.update(sequence.toString().toUpperCase().getBytes());
BigInteger ... | true |
5,275 | 21,110,104 | 373,447 | public static SimpleDataTable loadDataFromFile(URL urlMetadata, URL urlData) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(urlMetadata.openStream()));
List<String> columnNamesList = new ArrayList<String>();
String[] lineParts = null;
String line;
... | private static String getDocumentAt(String urlString) {
StringBuffer html_text = new StringBuffer();
try {
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream... | true |
5,276 | 20,485,072 | 14,284,458 | private String generateServiceId(ObjectName mbeanName) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(mbeanName.toString().getBytes());
StringBuffer hexString = new StringBuffer();
byte[] digest = md5.digest();
for (int i ... | private String md5(String txt) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(txt.getBytes(), 0, txt.length());
return new BigInteger(1, m.digest()).toString(16);
} catch (Exception e) {
return "BAD MD5";
}
}
| true |
5,277 | 16,721,518 | 20,836,129 | void openTextFile(String urlString, boolean install) {
StringBuffer sb = null;
try {
URL url = new URL(urlString);
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
sb = new StringBuffer();
... | public void addUser(String strUserName, String strPass) {
String datetime = Function.getSysTime().toString();
String time = datetime.substring(0, 4) + datetime.substring(5, 7) + datetime.substring(8, 10) + datetime.substring(11, 13) + datetime.substring(14, 16) + datetime.substring(17, 19) + datetim... | false |
5,278 | 12,670,642 | 4,224,228 | public boolean backupLastAuditSchema(File lastAuditSchema) {
boolean isBkupFileOK = false;
String writeTimestamp = DateFormatUtils.format(new java.util.Date(), configFile.getTimestampPattern());
File target = new File(configFile.getAuditSchemaFileDir() + File.separator + configFile.getAuditS... | 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();
... | false |
5,279 | 13,028,546 | 16,930,288 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | public TempFileTextBody(InputStream is, String mimeCharset) throws IOException {
this.mimeCharset = mimeCharset;
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
tempFile = tempPath.createTempFile("attachment", ".txt");
OutputStream out = tempFile.getOutputStream();
... | true |
5,280 | 12,816,795 | 10,176,882 | 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) {
... | @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 |
5,281 | 15,178,715 | 16,351,776 | public static void main(String[] args) throws IOException, DataFormatException {
byte in_buf[] = new byte[20000];
if (args.length < 2) {
System.out.println("too few arguments");
System.exit(0);
}
String inputName = args[0];
InputStream in = new FileInp... | 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 |
5,282 | 447,509 | 5,373,841 | 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 static String encryptPassword(String password) throws PasswordException {
String hash = null;
if (password != null && !password.equals("")) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
... | false |
5,283 | 5,656,506 | 12,879,112 | 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();
... | protected String getGraphPath(String name) throws ServletException {
String hash;
try {
MessageDigest md = MessageDigest.getInstance(m_messagedigest_algorithm);
md.update(name.getBytes());
hash = bytesToHex(md.digest());
} catch (NoSuchAlgorithmException e... | false |
5,284 | 4,530,695 | 18,377,055 | private String doExecute(AbortableHttpRequest method) throws Throwable {
HttpClient client = CLIENT.newInstance();
HttpResponse rsp = client.execute((HttpUriRequest) method);
HttpEntity entity = rsp.getEntity();
if (entity == null) throw new RequestError("No entity in method");
... | private void prepareJobFile(ZipEntryRef zer, String nodeDir, String reportDir, Set<ZipEntryRef> statusZers) throws Exception {
String jobDir = nodeDir + File.separator + "job_" + zer.getUri();
if (!isWorkingDirectoryValid(jobDir)) {
throw new Exception("Cannot acces to " + jobDir);
... | false |
5,285 | 383,297 | 11,228,956 | private String readAboutText(String urlStr) {
String text = null;
try {
URL url = this.getClass().getResource(urlStr);
InputStreamReader reader = new InputStreamReader(url.openStream());
StringWriter writer = new StringWriter();
int character = reader.... | protected Model loadModel(URL url, String filenameBase, SourceModelType modelType, URL baseURL, String skin, float scale, int flags, AppearanceFactory appFactory, GeometryFactory geomFactory, NodeFactory nodeFactory, AnimationFactory animFactory, SpecialItemsHandler siHandler, Model model) throws IOException, Incor... | false |
5,286 | 18,371,114 | 8,568,973 | 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();
... | public BasePolicy(String flaskPath) throws Exception {
SWIGTYPE_p_p_policy p_p_pol = apol.new_policy_t_p_p();
if (!flaskPath.endsWith("/")) flaskPath += "/";
File tmpPolConf = File.createTempFile("tmpBasePolicy", ".conf");
BufferedWriter tmpPolFile = new BufferedWriter(new FileWriter... | true |
5,287 | 23,641,084 | 1,008,329 | @Override
public void run() {
EventType type = event.getEventType();
IBaseObject field = event.getField();
log.info("select----->" + field.getAttribute(IDatafield.URL));
try {
IParent parent = field.getParent();
String name = field.getName();
i... | public long copyFile(String baseDirStr, String fileName, String file2FullPath) throws Exception {
long plussQuotaSize = 0;
if (!baseDirStr.endsWith(sep)) {
baseDirStr += sep;
}
BufferedInputStream in = null;
BufferedOutputStream out = null;
byte dataBuff[]... | true |
5,288 | 18,464,490 | 10,348,730 | @Override
public void actionPerformed(ActionEvent e) {
if (copiedFiles_ != null) {
File[] tmpFiles = new File[copiedFiles_.length];
File tmpDir = new File(Settings.getPropertyString(ConstantKeys.project_dir), "tmp/");
tmpDir.mkdirs();
... | private void installBinaryFile(File source, File destination) {
byte[] buffer = new byte[8192];
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
int read;
... | true |
5,289 | 22,239,198 | 16,832,679 | public boolean loadURL(URL url) {
try {
propertyBundle.load(url.openStream());
LOG.info("Configuration loaded from " + url + "\n");
return true;
} catch (Exception e) {
if (canComplain) {
LOG.warn("Unable to load configuration " + url +... | public byte[] getXQueryForWorkflow(String workflowURI, Log4JLogger log) throws MalformedURLException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
if (workflowURI == null) {
throw new XQGeneratorException("Null workflow URI");
}
URL url = ... | false |
5,290 | 8,708,611 | 13,420,786 | private String extractFileFromZip(ZipFile zip, String fileName) throws IOException {
String contents = null;
ZipEntry entry = zip.getEntry(fileName);
if (entry != null) {
InputStream input = zip.getInputStream(entry);
ByteArrayOutputStream buffer = new ByteArrayOutput... | public static void unzip(File zipInFile, File outputDir) throws Exception {
Enumeration<? extends ZipEntry> entries;
ZipFile zipFile = new ZipFile(zipInFile);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipInFile));
ZipEntry entry = (ZipEntry) zipInputStrea... | true |
5,291 | 161,844 | 2,530,139 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public static String md5(String input) {
String res = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] md5 = algorithm.digest();
String tmp = "";
... | false |
5,292 | 14,380,467 | 2,362,445 | public String readTemplateToString(String fileName) {
URL url = null;
url = classLoader.getResource(fileName);
StringBuffer content = new StringBuffer();
if (url == null) {
String error = "Template file could not be found: " + fileName;
throw new RuntimeExcept... | 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... | false |
5,293 | 6,396,264 | 11,121,668 | private static void addFromResource(String resource, OutputStream out) {
URL url = OpenOfficeDocumentCreator.class.getResource(resource);
try {
InputStream in = url.openStream();
byte[] buffer = new byte[256];
synchronized (in) {
synchronized (out)... | public String computeMD5(String string) throws ServiceException {
try {
MessageDigest digest = MessageDigest.getInstance("md5");
digest.reset();
digest.update(string.getBytes(Invoker.ENCODING));
return convertToHex(digest.digest());
} catch (NoSuchAlgo... | false |
5,294 | 11,656,036 | 11,646,823 | @SuppressWarnings("unchecked")
public static void createInstance(ExternProtoDeclare externProtoDeclare) {
ExternProtoDeclareImport epdi = new ExternProtoDeclareImport();
HashMap<String, ProtoDeclareImport> protoMap = X3DImport.getTheImport().getCurrentParser().getProtoMap();
boolean load... | public String getContentAsString(String url) {
StringBuffer sb = new StringBuffer("");
try {
URL urlmy = new URL(url);
HttpURLConnection con = (HttpURLConnection) urlmy.openConnection();
HttpURLConnection.setFollowRedirects(true);
con.setInstanceFollow... | false |
5,295 | 10,264,652 | 13,351,233 | 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 static boolean copyFile(File src, File target) throws IOException {
if (src == null || target == null || !src.exists()) return false;
if (!target.exists()) if (!createNewFile(target)) return false;
InputStream ins = new BufferedInputStream(new FileInputStream(src));
OutputStre... | true |
5,296 | 6,608,439 | 1,811,748 | public static void main(String[] args) {
FTPClient client = new FTPClient();
try {
File l_file = new File("C:/temp/testLoribel.html");
String l_url = "http://www.loribel.com/index.html";
GB_HttpTools.loadUrlToFile(l_url, l_file, ENCODING.ISO_8859_1);
S... | public void testSimpleHttpPostsHTTP10() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
rnd.nextBytes(... | false |
5,297 | 19,295,736 | 2,238,218 | public void setTableBraille(String tableBraille, boolean sys) {
fiConf.setProperty(OptNames.fi_braille_table, tableBraille);
fiConf.setProperty(OptNames.fi_is_sys_braille_table, Boolean.toString(sys));
FileChannel in = null;
FileChannel out = null;
try {
String fi... | public void includeCss(Group group, Writer out, PageContext pageContext) throws IOException {
ByteArrayOutputStream outtmp = new ByteArrayOutputStream();
if (AbstractGroupBuilder.getInstance().buildGroupJsIfNeeded(group, outtmp, pageContext.getServletContext())) {
FileOutputStream fileSt... | true |
5,298 | 11,265,073 | 23,241,194 | public static void zip(File srcDir, File destFile, FileFilter filter) throws IOException {
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new FileOutputStream(destFile));
Collection<File> files = FileUtils.listFiles(srcDir, TrueFileFilter.TRUE, TrueFileFilter.TRU... | private void publishZip(LWMap map) {
try {
if (map.getFile() == null) {
VueUtil.alert(VueResources.getString("dialog.mapsave.message"), VueResources.getString("dialog.mapsave.title"));
return;
}
File savedCMap = PublishUtil.createZip(map, P... | true |
5,299 | 4,048,013 | 20,474,021 | public InputStream getParameterAsInputStream(String key) throws UndefinedParameterError, IOException {
String urlString = getParameter(key);
if (urlString == null) return null;
try {
URL url = new URL(urlString);
InputStream stream = url.openStream();
retu... | public static byte[] createAuthenticator(ByteBuffer data, String secret) {
assert data.isDirect() == false : "must not a direct ByteBuffer";
int pos = data.position();
if (pos < RadiusPacket.MIN_PACKET_LENGTH) {
System.err.println("packet too small");
return null;
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.