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 |
|---|---|---|---|---|---|
2,200 | 6,686,537 | 3,064,787 | private static Map<String, File> loadServiceCache() {
ArrayList<String> preferredOrder = new ArrayList<String>();
HashMap<String, File> serviceFileMapping = new HashMap<String, File>();
File file = new File(IsqlToolkit.getBaseDirectory(), CACHE_FILE);
if (!file.exists()) {
... | public CacheServiceFactoryImpl() {
@SuppressWarnings("static-access") URL url = this.getClass().getClassLoader().getResource("mwt/xml/xdbforms/configuration/ehcache.xml");
InputStream is;
try {
is = url.openStream();
cacheManager = CacheManager.create(is);
} c... | false |
2,201 | 9,054,825 | 19,191,608 | public List<BadassEntry> parse() {
mBadassEntries = new ArrayList<BadassEntry>();
try {
URL url = new URL(mUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
... | public static String getDigestResponse(String user, String password, String method, String requri, String authstr) {
String realm = "";
String nonce = "";
String opaque = "";
String algorithm = "";
String qop = "";
StringBuffer digest = new StringBuffer();
Str... | false |
2,202 | 1,833,576 | 13,651,921 | public FTPClient getFTP(final Credentials credentials, final String remoteFile) throws NumberFormatException, SocketException, IOException, AccessDeniedException {
String fileName = extractFilename(remoteFile);
String fileDirectory = getPathName(remoteFile).substring(0, getPathName(remoteFile).index... | public static void main(String[] arg) throws IOException {
XmlPullParserFactory PULL_PARSER_FACTORY;
try {
PULL_PARSER_FACTORY = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
PULL_PARSER_FACTORY.setNamespaceAware(true);
... | false |
2,203 | 5,166,269 | 4,364,579 | public void render(ParagraphElement cnt, double x, double y, Graphics2D g, LayoutingContext layoutingContext, FlowContext flowContext) {
InlineImageContent ic = (InlineImageContent) cnt;
try {
URLConnection urlConn = ic.getUrl().openConnection();
urlConn.setConnectTimeout(150... | public static String calcCRC(String phrase) {
StringBuffer crcCalc = new StringBuffer();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(phrase.getBytes());
byte[] tabDigest = md.digest();
for (int i = 0; i < tabDigest.length; i++)... | false |
2,204 | 184,741 | 11,032,545 | 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... | @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... | true |
2,205 | 3,229,363 | 19,217,522 | public void copyFile2(String src, String dest) throws IOException {
String newLine = System.getProperty("line.separator");
FileWriter fw = null;
FileReader fr = null;
BufferedReader br = null;
BufferedWriter bw = null;
File source = null;
try {
fr ... | boolean copyFileStructure(File oldFile, File newFile) {
if (oldFile == null || newFile == null) return false;
File searchFile = newFile;
do {
if (oldFile.equals(searchFile)) return false;
searchFile = searchFile.getParentFile();
} while (searchFile != null);
... | true |
2,206 | 13,233,448 | 5,956,360 | private static String GetSHA1(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... | public static String encrypt(String algorithm, String[] input) {
try {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.reset();
for (int i = 0; i < input.length; i++) {
if (input[i] != null) md.update(input[i].getBytes("UTF-8"));
}
... | true |
2,207 | 15,689,768 | 15,194,834 | protected void channelConnected() throws IOException {
MessageDigest md = null;
String digest = "";
try {
String userid = nateon.getUserId();
if (userid.endsWith("@nate.com")) userid = userid.substring(0, userid.lastIndexOf('@'));
md = MessageDigest.getIns... | @Override
public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
if (TDebug.TraceAudioFileReader) {
TDebug.out("getAudioFileFormat(URL url)");
}
InputStream inputStream = url.openStream();
try {
return getAud... | false |
2,208 | 4,798,331 | 8,848,809 | public static String SHA256(String source) {
logger.info(source);
String result = null;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.update(source.getBytes());
byte[] bytes = digest.digest();
result = EncodeUtils.he... | public static String crypt(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("String to encript cannot be null or zero length");
}
StringBuffer hexString = new StringBuffer();
try {
MessageDigest md = MessageDigest.getIns... | true |
2,209 | 9,793,280 | 357,303 | public SqlScript(URL url, IDbDialect platform, boolean failOnError, String delimiter, Map<String, String> replacementTokens) {
try {
fileName = url.getFile();
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
log.log(LogLevel.INFO, "Loading sql from script %s"... | public static String post(String strUrl, String strPostString) {
try {
URL url = new URL(strUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
... | false |
2,210 | 1,655,162 | 12,214,439 | public boolean updatenum(int num, String pid) {
boolean flag = false;
Connection conn = null;
PreparedStatement pm = null;
try {
conn = Pool.getConnection();
conn.setAutoCommit(false);
pm = conn.prepareStatement("update addwuliao set innum=? where ... | 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 |
2,211 | 4,505,945 | 21,649,305 | private BinaryDocument documentFor(String code, String type, int diagramIndex) {
code = code.replaceAll("\n", "").replaceAll("\t", "").trim().replaceAll(" ", "%20");
StringBuilder builder = new StringBuilder("http://yuml.me/diagram/");
builder.append(type).append("/");
builder.append... | private String choosePivotVertex() throws ProcessorExecutionException {
String result = null;
Graph src;
Graph dest;
Path tmpDir;
System.out.println("##########>" + _dirMgr.getSeqNum() + " Choose the pivot vertex");
src = new Graph(Graph.defaultGraph());
src.s... | true |
2,212 | 15,506,300 | 4,591,684 | @SuppressWarnings("static-access")
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter(... | public static void copyDirs(File sourceDir, File destDir) throws IOException {
if (!destDir.exists()) destDir.mkdirs();
for (File file : sourceDir.listFiles()) {
if (file.isDirectory()) {
copyDirs(file, new File(destDir, file.getName()));
} else {
... | true |
2,213 | 9,838,495 | 14,717,089 | public void go() throws FBConnectionException, FBErrorException, IOException {
clearError();
results = new LoginResults();
URL url = new URL(getHost() + getPath());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-FB-User", getUser... | public static boolean copyFileCover(String srcFileName, String descFileName, boolean coverlay) {
File srcFile = new File(srcFileName);
if (!srcFile.exists()) {
System.out.println("�����ļ�ʧ�ܣ�Դ�ļ�" + srcFileName + "������!");
return false;
} else if (!srcFile.isFile())... | false |
2,214 | 11,552,288 | 5,269,348 | public void run() {
Thread.currentThread().setName("zhongwen.com watcher");
String url = getURL();
try {
while (m_shouldBeRunning) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "ISO8859_1"))... | public void generateHtmlPage(String real_filename, String url_filename) {
String str_content = "";
URL m_url = null;
URLConnection m_urlcon = null;
try {
m_url = new URL(url_filename);
m_urlcon = m_url.openConnection();
InputStream in_stream = m_ur... | false |
2,215 | 19,392,395 | 16,022,035 | private void updateIngredients(Recipe recipe, int id) throws Exception {
PreparedStatement pst1 = null;
PreparedStatement pst2 = null;
try {
conn = getConnection();
pst1 = conn.prepareStatement("DELETE FROM ingredients WHERE recipe_id = ?");
pst1.setInt(1,... | public boolean save(Object obj) {
boolean bool = false;
this.result = null;
if (obj == null) return bool;
Connection conn = null;
try {
conn = ConnectUtil.getConnect();
conn.setAutoCommit(false);
String sql = SqlUtil.getInsertSql(this.getCl... | true |
2,216 | 2,494,612 | 859,105 | private void update() throws IOException {
FileOutputStream out = new FileOutputStream(combined);
try {
File[] _files = listJavascript();
List<File> files = new ArrayList<File>(Arrays.asList(_files));
files.add(0, new File(jsdir.getAbsolute... | 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 |
2,217 | 21,234,511 | 13,591,322 | public static void unzip(String destDir, String zipPath) {
PrintWriter stdout = new PrintWriter(System.out, true);
int read = 0;
byte[] data = new byte[1024];
ZipEntry entry;
try {
ZipInputStream in = new ZipInputStream(new FileInputStream(zipPath));
s... | private void downloadDirectory() throws SocketException, IOException {
FTPClient client = new FTPClient();
client.connect(source.getHost());
client.login(username, password);
FTPFile[] files = client.listFiles(source.getPath());
for (FTPFile file : files) {
if (!f... | false |
2,218 | 5,246,170 | 12,539,808 | 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) {
... | public void jsFunction_extract(ScriptableFile outputFile) throws IOException, FileSystemException, ArchiveException {
InputStream is = file.jsFunction_createInputStream();
OutputStream output = outputFile.jsFunction_createOutputStream();
BufferedInputStream buf = new BufferedInputStream(is);... | true |
2,219 | 19,299,263 | 11,145,818 | 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 ==... | private void copy(File sourceFile, File destinationFile) {
try {
FileChannel in = new FileInputStream(sourceFile).getChannel();
FileChannel out = new FileOutputStream(destinationFile).getChannel();
try {
in.transferTo(0, in.size(), out);
in... | true |
2,220 | 12,542,686 | 8,651,990 | public static Object deployNewService(String scNodeRmiName, String userName, String password, String name, String jarName, String serviceClass, String serviceInterface, Logger log) throws RemoteException, MalformedURLException, StartServiceException, NotBoundException, IllegalArgumentException, SecurityException, I... | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException, BadRequestException, NotFoundException {
try {
resolveFileAttachment();
} catch (NoFileByTheIdException e) {
throw ... | true |
2,221 | 16,532,304 | 20,753,922 | private void putAlgosFromJar(File jarfile, AlgoDir dir, Model model) throws FileNotFoundException, IOException {
URLClassLoader urlLoader = new URLClassLoader(new URL[] { jarfile.toURI().toURL() });
JarInputStream jis = new JarInputStream(new FileInputStream(jarfile));
JarEntry entry = jis.g... | public void doImport(File f, boolean checkHosp) throws Exception {
connector.getConnection().setAutoCommit(false);
File base = f.getParentFile();
ZipInputStream in = new ZipInputStream(new FileInputStream(f));
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
... | true |
2,222 | 17,456,565 | 13,111,022 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | private static void copy(File source, File target) throws IOException {
InputStream is = null;
OutputStream os = null;
try {
is = new BufferedInputStream(new FileInputStream(source));
os = new BufferedOutputStream(new FileOutputStream(target));
int b;
... | true |
2,223 | 9,446,836 | 2,193,301 | private static void ftpTest() {
FTPClient f = new FTPClient();
try {
f.connect("oscomak.net");
System.out.print(f.getReplyString());
f.setFileType(FTPClient.BINARY_FILE_TYPE);
} catch (SocketException e) {
e.printStackTrace();
} catch (... | public HttpURLHandler(URL url, String requestMethod, Map<String, String> parameters, String outputEncoding) throws IOException {
logger.debug("Creating http url handler for: " + url + "; using method: " + requestMethod + "; with parameters: " + parameters);
if (url == null) throw new IllegalArgument... | false |
2,224 | 8,317,691 | 18,142,979 | protected void copyFile(File src, File dest) throws Exception {
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel destChannel = new FileOutputStream(dest).getChannel();
long transferred = destChannel.transferFrom(srcChannel, 0, srcChannel.size());
... | private String copyTutorial() throws IOException {
File inputFile = new File(getFilenameForOriginalTutorial());
File outputFile = new File(getFilenameForCopiedTutorial());
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
w... | true |
2,225 | 19,565,152 | 793,635 | private void appendArchive(File instClass) throws IOException {
FileOutputStream out = new FileOutputStream(instClass.getName(), true);
FileInputStream zipStream = new FileInputStream("install.jar");
byte[] buf = new byte[2048];
int read = zipStream.read(buf);
while (read > 0... | 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 |
2,226 | 11,980,724 | 22,281,203 | protected IRunnableWithProgress getProjectCreationRunnable() {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
int remainingWorkUnits = 10;
monitor.beginTask("New Modulo Proje... | public static final synchronized String md5(final String data) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
md.update(data.getBytes());
final byte[] b = md.digest();
return toHexString(b);
} catch (final Exception e) {
}
... | false |
2,227 | 11,322,573 | 21,057,438 | 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 void run() {
try {
Socket socket = getSocket();
System.out.println("opening socket to " + address + " on " + port);
InputStream in = socket.getInputStream();
for (; ; ) {
FileTransferHeader header = FileTransferHeader.readHeader(in);
... | true |
2,228 | 6,886,408 | 6,936,843 | public static final String md5(final String s) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int... | private static String getVisitorId(String guid, String account, String userAgent, Cookie cookie) throws NoSuchAlgorithmException, UnsupportedEncodingException {
if (cookie != null && cookie.getValue() != null) {
return cookie.getValue();
}
String message;
if (!isEmpty(gui... | true |
2,229 | 10,467,996 | 11,896,430 | public void copyFile(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPath);
FileOutputStream fs =... | protected InputStream createIconType(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
JavaliController.debug(JavaliController.LG_VERBOSE, "Creating iconType");
String cHash = PRM_TYPE + "=" + TP_ICON;
String iconName = req.getParameter("iconName");
... | true |
2,230 | 12,798,072 | 6,319,887 | public static String encrypt(String txt) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(txt.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
| public static 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 |
2,231 | 13,361,852 | 17,761,371 | public static File copyFile(File from, File to) throws IOException {
FileOutputStream fos = new FileOutputStream(to);
FileInputStream fis = new FileInputStream(from);
FileChannel foc = fos.getChannel();
FileChannel fic = fis.getChannel();
foc.transferFrom(fic, 0, fic.size());... | private void sendActionPerformed(java.awt.event.ActionEvent evt) {
if (name.getText().length() < 3) {
JOptionPane.showMessageDialog(comment, "Too short name (at least 3)");
return;
}
if (comment.getText().length() < 10) {
JOptionPane.showMessageDialog(comm... | false |
2,232 | 10,851 | 15,385,605 | 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 void logout(String cookieString) throws NetworkException {
HttpClient client = HttpConfig.newInstance();
HttpGet get = new HttpGet(HttpConfig.bbsURL() + HttpConfig.BBS_LOGOUT);
if (cookieString != null && cookieString.length() != 0) get.setHeader("Cookie", cookieString);
try {... | false |
2,233 | 9,689,181 | 6,322,468 | public static String EncryptString(String method, String input) {
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
if (method.equals("SHA1") || method.equals("MD5")) {
try {
md = MessageDigest.getInstance(met... | public static String md5(String text) {
MessageDigest msgDigest = null;
try {
msgDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("System doesn't support MD5 algorithm.");
}
try {
... | true |
2,234 | 16,351,776 | 1,516,551 | 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 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 |
2,235 | 15,612,870 | 19,753,981 | public static void main(String[] args) {
FileInputStream fr = null;
FileOutputStream fw = null;
BufferedInputStream br = null;
BufferedOutputStream bw = null;
try {
fr = new FileInputStream("D:/5.xls");
fw = new FileOutputStream("c:/Dxw.java");
... | private void download(String address, String localFileName, String host, int porta) {
InputStream in = null;
URLConnection conn = null;
OutputStream out = null;
System.out.println("Update.download() BAIXANDO " + address);
try {
URL url = new URL(address);
... | false |
2,236 | 3,435,856 | 23,618,963 | public static byte[] encrypt(String string) {
java.security.MessageDigest messageDigest = null;
try {
messageDigest = java.security.MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException exc) {
logger.fatal(exc);
throw new RuntimeException();
... | public static void copyFile(File src, File dst) {
try {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dst);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = fis.read(buf... | false |
2,237 | 21,601,084 | 1,490,117 | public static void main(String[] args) throws Exception {
HttpClient httpclient = new DefaultHttpClient();
InputStream is = CheckAvailability.class.getResourceAsStream("/isbns.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String isbn = null;
HttpGe... | private static void copy(File source, File target) throws IOException {
FileChannel sourceChannel = new FileInputStream(source).getChannel();
FileChannel targetChannel = new FileOutputStream(target).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), targetChannel);
sourc... | false |
2,238 | 15,767,189 | 3,318,214 | private boolean copyFile(BackupItem item) {
try {
FileChannel src = new FileInputStream(item.getDrive() + ":" + item.getPath()).getChannel();
createFolderStructure(this.task.getDestinationPath() + "\\" + item.getDrive() + item.getPath());
FileChannel dest = new FileOutput... | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | true |
2,239 | 19,360,483 | 17,296,395 | private void initLogging() {
File logging = new File(App.getHome(), "logging.properties");
if (!logging.exists()) {
InputStream input = getClass().getResourceAsStream("logging.properties-setup");
OutputStream output = null;
try {
output = new FileO... | public static File copyToLibDirectory(final File file) throws FileNotFoundException, IOException {
if (file == null || !file.exists()) {
throw new FileNotFoundException();
}
File directory = new File("lib/");
File dest = new File(directory, file.getName());
File p... | true |
2,240 | 12,670,642 | 12,524,256 | 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 void actionPerformed(ActionEvent e) {
final File inputFile = KeyboardHero.midiFile();
try {
if (inputFile == null) return;
final File dir = (new File(Util.DATA_FOLDER + MidiSong.MIDI_FILES_DIR));
if (dir.exist... | true |
2,241 | 9,354,771 | 19,869,683 | public void encryptPassword() {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
System.out.print(e);
}
try {
digest.update(passwordIn.getBytes("UTF-8"));
} catch (... | public static String MD5(byte[] data) throws NoSuchAlgorithmException, UnsupportedEncodingException {
String text = convertToHex(data);
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.lengt... | true |
2,242 | 19,289,085 | 11,758,299 | public void testSendMessage() throws ClientProtocolException, IOException {
String textMessage = "La%20sua%20prenotazione%20e60%20andata%20a%20buon%20fine";
String customerPhoneNumber = "+393345730726";
DefaultHttpClient httpclient = new DefaultHttpClient();
String other = "http://sm... | void readData() {
String[] nextLine;
int line;
double value;
URL url = null;
String FileToRead;
try {
for (int i = 0; i < names.length; i++) {
FileToRead = "data/" + names[i] + ".csv";
url = new URL(ja.getCodeBase(), FileToR... | false |
2,243 | 9,907,405 | 253,661 | @Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
TextView tv = new TextView(this);
try {
URL url = new URL("");
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = ... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | false |
2,244 | 849,586 | 19,035,955 | 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 main(String[] args) throws Exception {
TripleDES tdes = new TripleDES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\testTDESENC.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\testTDESDEC.txt"));
Sin... | true |
2,245 | 2,721,038 | 6,190,167 | public File copyFile(File f) throws IOException {
File t = createNewFile("fm", "cpy");
FileOutputStream fos = new FileOutputStream(t);
FileChannel foc = fos.getChannel();
FileInputStream fis = new FileInputStream(f);
FileChannel fic = fis.getChannel();
foc.transferFro... | public void xtest11() throws Exception {
PDFManager manager = new ITextManager();
InputStream pdf = new FileInputStream("/tmp/UML2.pdf");
InputStream page1 = manager.cut(pdf, 1, 1);
OutputStream outputStream = new FileOutputStream("/tmp/page.pdf");
IOUtils.copy(page1, outputS... | true |
2,246 | 19,063,414 | 14,708,603 | public void readData() throws IOException {
i = 0;
j = 0;
URL url = getClass().getResource("resources/Chrom_623_620.dat");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
s = br... | 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 |
2,247 | 9,965,674 | 4,681,906 | public String ask(String s) {
System.out.println("asking ---> " + s);
try {
String result = null;
URL url = new URL("http://www.google.com/search?hl=en&rls=GGLR,GGLR:2005-50,GGLR:en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=" + URLEncoder.encode(s, "UTF-8"));
URLCon... | public void launch(String xmlControl, String xmlDoc, long docId) {
AgentLauncher l;
Environment env;
Properties prop;
Resource res;
String token;
String deflt;
String answ;
String key;
String entry;
ShipService service;
de.fhg.i... | false |
2,248 | 5,439,181 | 22,430,601 | private String hash(String text) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);
}
| public Service findServiceFor(final int serviceID) throws JAXBException, IOException, BadResponseException {
final String USER_AGENT = "SBSIVisual (CSBE, University of Edinburgh)";
String urlToConnectTo = "http://www.biocatalogue.org/services/" + serviceID;
URL url = new URL(urlToConnectTo);... | false |
2,249 | 23,390,255 | 9,880,330 | 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... | protected static String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
URL url = new URL(addr);
URLConnection c = url.openConnection();
c.setConnectTimeout(2000);
IOUtils.copy(c.getInputStream(), output);
retu... | true |
2,250 | 6,867,571 | 16,707,050 | public void run() {
synchronized (stateLock) {
if (started) {
return;
} else {
started = true;
running = true;
}
}
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
BufferedRead... | public RandomAccessFileOrArray(URL url) throws IOException {
InputStream is = url.openStream();
try {
this.arrayIn = InputStreamToArray(is);
} finally {
try {
is.close();
} catch (IOException ioe) {
}
}
}
| false |
2,251 | 15,364,153 | 2,530,139 | private void storeConfigurationPropertiesFile(java.net.URL url, String comp) {
java.util.Properties p;
try {
p = new java.util.Properties();
p.load(url.openStream());
} catch (java.io.IOException ie) {
System.err.println("error opening: " + url.getPath() +... | 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 |
2,252 | 8,831,301 | 4,683,894 | public void run() {
String s;
s = "";
try {
URL url = new URL("http://www.m-w.com/dictionary/" + word);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while (((str = in.readLine()) != null) && (!sto... | public void run() {
if (currentNode == null || currentNode.equals("")) {
JOptionPane.showMessageDialog(null, "Please select a genome to download first", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
String localFile = parameter.getTemporaryFil... | false |
2,253 | 12,595,519 | 16,294,877 | @SuppressWarnings("unchecked")
public static void main(String[] args) {
System.out.println("Starting encoding test....");
Properties p = new Properties();
try {
InputStream pStream = ClassLoader.getSystemResourceAsStream("sample_weather.properties");
p.load(pStrea... | public static void copierFichier(URL url, File destination) throws CopieException, IOException {
if (destination.exists()) {
throw new CopieException("ERREUR : Copie du fichier '" + url.getPath() + "' vers '" + destination.getPath() + "' impossible!\n" + "CAUSE : Le fichier destination existe d... | false |
2,254 | 1,293,659 | 22,456,976 | public void delete(int id) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
... | 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 = ... | false |
2,255 | 10,251,387 | 1,953,115 | @Override
public void close() throws IOException {
super.close();
byte[] signatureData = toByteArray();
ZipOutputStream zipOutputStream = new ZipOutputStream(this.targetOutputStream);
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(this.originalZipFile));
... | protected int doWork() {
SAMFileReader reader = new SAMFileReader(IoUtil.openFileForReading(INPUT));
reader.getFileHeader().setSortOrder(SORT_ORDER);
SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), false, OUTPUT);
Iterator<SAMRecord> itera... | true |
2,256 | 13,848,422 | 12,909,291 | public static byte[] generatePasswordHash(String s) {
byte[] password = { 00 };
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(s.getBytes());
password = md5.digest();
return password;
} catch (NoSuchAlgorithmException e)... | public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType(s_contentType);
response.setHeader("Cache-control", "no-cache");
InputStream graphStream = getGraphStream(request);
OutputStream out = getOutputStream(re... | false |
2,257 | 11,730,227 | 2,721,037 | private void copy(File source, File target) throws IOException {
FileChannel in = (new FileInputStream(source)).getChannel();
FileChannel out = (new FileOutputStream(target)).getChannel();
in.transferTo(0, source.length(), out);
in.close();
out.close();
}
| public void SplitFile(File in, File out0, File out1, long pos) throws IOException {
FileInputStream fis = new FileInputStream(in);
FileOutputStream fos = new FileOutputStream(out0);
FileChannel fic = fis.getChannel();
FileChannel foc = fos.getChannel();
foc.transferFrom(fic, ... | true |
2,258 | 8,251,281 | 15,741,989 | protected InputStream openInputStream(String filename) throws FileNotFoundException {
InputStream in = null;
try {
URL url = new URL(filename);
in = url.openConnection().getInputStream();
logger.info("Opening file " + filename);
} catch (FileNotFoundExcept... | public String encrypt(String password) {
if (password.length() == 40) {
return password;
}
if (salt != null) {
password = password + salt;
}
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("SHA1")... | false |
2,259 | 23,677,145 | 14,783,945 | public static <T extends Comparable<T>> void BubbleSortComparable1(T[] num) {
int j;
boolean flag = true; // set flag to true to begin first pass
T temp; // holding variable
while (flag) {
flag = false; // set flag to false awaiting a possible swap
for (j = 0; j < num.length - 1; j++) {
if (num[j].c... | public static String compressFile(String fileName) throws IOException {
String newFileName = fileName + ".gz";
FileInputStream fis = new FileInputStream(fileName);
FileOutputStream fos = new FileOutputStream(newFileName);
GZIPOutputStream gzos = new GZIPOutputStream(fos);
byt... | false |
2,260 | 15,376,881 | 130,757 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream inStream = null;
FileOutputStream outStream = null;
FileChannel source = null;
FileChannel de... | 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 |
2,261 | 13,583,203 | 13,969,472 | public void sendMail() throws Exception {
try {
if (param.length > 0) {
System.setProperty("mail.host", param[0].trim());
URL url = new URL("mailto:" + param[1].trim());
URLConnection conn = url.openConnection();
PrintWriter out = n... | protected void readLockssConfigFile(URL url, List<String> peers) {
PrintWriter out = null;
try {
out = new PrintWriter(new OutputStreamWriter(System.out, "utf8"), true);
out.println("unicode-output-ready");
} catch (UnsupportedEncodingException ex) {
Syste... | false |
2,262 | 17,534,703 | 15,854,368 | 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(... | public static void copyURLToFile(URL source, File destination) throws IOException {
InputStream input = source.openStream();
try {
FileOutputStream output = openOutputStream(destination);
try {
IOUtils.copy(input, output);
} finally {
... | true |
2,263 | 8,113,080 | 5,444,168 | @Override
public void parse() throws DocumentException, IOException {
URL url = new URL(getDataUrl());
URLConnection con = url.openConnection();
BufferedReader bStream = new BufferedReader(new InputStreamReader(con.getInputStream()));
String s = bStream.readLine();
bStrea... | public static void writeFullImageToStream(Image scaledImage, String javaFormat, OutputStream os) throws IOException {
BufferedImage bufImage = new BufferedImage(scaledImage.getWidth(null), scaledImage.getHeight(null), BufferedImage.TYPE_BYTE_BINARY);
Graphics gr = bufImage.getGraphics();
gr.... | false |
2,264 | 3,533,515 | 22,626,443 | public boolean saveVideoXMLOnWebserver(String text) {
boolean error = false;
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(this.getWebserver().getUrl());
System.out.println("Connected to " + this.getWebserver().getUrl() + ".");
... | public static File jar(File in, String outArc, File tempDir, PatchConfigXML conf) {
FileOutputStream arcFile = null;
JarOutputStream jout = null;
DirectoryScanner ds = null;
ds = new DirectoryScanner();
ds.setCaseSensitive(true);
ds.setBasedir(in);
ds.scan();
... | false |
2,265 | 6,008,880 | 8,452,564 | protected void updateJava2ScriptProject(String prjFolder, String binRelative) {
try {
File cpFile = new File(prjFolder, ".classpath");
FileInputStream fis = new FileInputStream(cpFile);
String classpath = J2SLaunchingUtil.readAFile(fis);
if (classpath != null)... | public void run() {
try {
HttpPost httpPostRequest = new HttpPost(Feesh.device_URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValueP... | false |
2,266 | 20,571,852 | 17,575,096 | public synchronized long nextValue(final Session session) {
if (sequence < seqLimit) {
return ++sequence;
} else {
final MetaDatabase db = MetaTable.DATABASE.of(table);
Connection connection = null;
ResultSet res = null;
String sql = null;
... | public boolean compile(URL url, String name) {
try {
final InputStream stream = url.openStream();
final InputSource input = new InputSource(stream);
input.setSystemId(url.toString());
return compile(input, name);
} catch (IOException e) {
_... | false |
2,267 | 7,263,928 | 4,441,118 | private void copyFile(File src_file, File dest_file) {
InputStream src_stream = null;
OutputStream dest_stream = null;
try {
int b;
src_stream = new BufferedInputStream(new FileInputStream(src_file));
dest_stream = new BufferedOutputStream(new FileOutputSt... | private void chopFileDisk() throws IOException {
File tempFile = new File("" + logFile + ".tmp");
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
long startCopyPos;
byte readBuffer[] = new byte[2048];
int readCount;
long totalBytesRead = 0;
... | true |
2,268 | 7,599,899 | 9,792,904 | public static void parse(URL url, ContentHandler handler) {
InputStream input = null;
try {
input = url.openStream();
SAXParser parser = createSaxParser();
XMLReader reader = parser.getXMLReader();
reader.setContentHandler(handler);
reader.... | 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 |
2,269 | 15,603,013 | 19,944,445 | public static URLConnection createConnection(URL url) throws java.io.IOException {
URLConnection urlConn = url.openConnection();
if (urlConn instanceof HttpURLConnection) {
HttpURLConnection httpConn = (HttpURLConnection) urlConn;
httpConn.setRequestMethod("POST");
}
... | protected boolean hasOsmTileETag(String eTag) throws IOException {
URL url;
url = new URL(tile.getUrl());
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
prepareHttpUrlConnection(urlConn);
urlConn.setRequestMethod("HEAD");
... | false |
2,270 | 19,538,929 | 14,783,945 | public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) {
File inputFile = new File(getInputFile());
File outputFile = new File(getOutputFile());
if (!getFileExtension(getInputFile()).equalsIgnoreCase(getFileExtension(getOutputFile())) || !getFileExtension(getInputFile())... | public static String compressFile(String fileName) throws IOException {
String newFileName = fileName + ".gz";
FileInputStream fis = new FileInputStream(fileName);
FileOutputStream fos = new FileOutputStream(newFileName);
GZIPOutputStream gzos = new GZIPOutputStream(fos);
byt... | true |
2,271 | 20,640,293 | 8,559,637 | private static void findDictionary() {
java.net.URL url = Translator.class.getResource("Translator.class");
String location = url.getFile();
String dictionaryName = (String) Settings.getDefault().getSetting("dictionary");
InputStream inputStream;
try {
if (locatio... | protected String updateTwitter() {
if (updatingTwitter) return null;
updatingTwitter = true;
String highestId = null;
final Cursor cursor = query(TWITTER_TABLE, new String[] { KEY_TWEET_ID }, null, null, null);
if (cursor.getCount() > 0) {
cursor.moveToFirst();
... | false |
2,272 | 11,452,667 | 5,195,056 | private void processData(InputStream raw) {
String fileName = remoteName;
if (localName != null) {
fileName = localName;
}
try {
FileOutputStream fos = new FileOutputStream(new File(fileName), true);
IOUtils.copy(raw, fos);
LOG.info("ok... | public String getData() throws ValueFormatException, RepositoryException, IOException {
InputStream is = getStream();
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, "UTF-8");
IOUtils.closeQuietly(is);
return sw.toString();
}
| true |
2,273 | 14,047,630 | 10,531,054 | @Override
public void run() {
try {
IOUtils.copy(getSource(), processStdIn);
System.err.println("Copy done.");
close();
} catch (IOException e) {
e.printStackTrace();
... | public boolean open(String mode) {
if (source instanceof String) return false; else if (mode == null) mode = ""; else mode = mode.toLowerCase();
boolean toread = false, towrite = false;
if (mode.indexOf("r") >= 0) toread = true;
if (mode.indexOf("w") >= 0) towrite = true;
if ... | true |
2,274 | 8,624,822 | 15,311,521 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
HttpSession session = request.getSession();
String session_id = session.getId();
F... | public String buscaCDA() {
Properties prop = new CargaProperties().Carga();
URL url;
BufferedReader in;
String inputLine;
String miLinea = null;
try {
url = new URL(prop.getProperty("CDA"));
in = new BufferedReader(new InputStreamReader(url.ope... | false |
2,275 | 19,147,301 | 17,117,841 | public boolean actualizarIdPartida(int idJugadorDiv, int idRonda, int idPartida) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET idPartida = " + idPartida + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRonda;
try {
... | public SearchHandler(String criteria, int langId) {
try {
URL url = new URL("http://eiffel.itba.edu.ar/hci/service/Catalog.groovy?method=GetProductListByName&criteria=" + criteria + "&language_id=" + langId);
URLConnection urlc = url.openConnection();
urlc.setDoOutput(fal... | false |
2,276 | 14,711,051 | 19,915,605 | public static void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | public static String Execute(HttpRequestBase httprequest) throws IOException, ClientProtocolException {
httprequest.setHeader("Accept", "application/json");
httprequest.setHeader("Content-type", "application/json");
String result = "";
HttpClient httpclient = new DefaultHttpClient();... | false |
2,277 | 17,068,622 | 1,944,560 | public static void main(String args[]) throws Exception {
File file = new File("D:/work/love.txt");
@SuppressWarnings("unused") ZipFile zipFile = new ZipFile("D:/work/test1.zip");
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream("D:/work/test1.zip"));
zos.setEncoding("G... | private static boolean copyFile(File src, File dest) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
for (int c = fis.read(); c != -1; c = fis.read()) fos.write(c);
... | true |
2,278 | 12,238,227 | 4,440,887 | public void doActionxxx() {
try {
System.out.println("app: ggc");
String server_name = "http://192.168.4.3:8080/";
server_name = server_name.trim();
if (server_name.length() == 0) {
server_name = "http://www.atech-software.com/";
} ... | public void play(File file) {
try {
URL url = new URL("http://127.0.0.1:8081/play.html?type=4&file=" + file.getAbsolutePath() + "&name=toto");
URLConnection connection = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInput... | false |
2,279 | 20,523,308 | 8,056,910 | public String getPassword(URI uri) {
if (_getPassword(uri) != null) return _getPassword(uri);
String result = null;
try {
String sUri = scrubURI(uri);
URL url = new URL(TEMP_PASSWORD_SERVICE_URL + "?SID=" + sessionId + "&ruri=" + URLEncoder.encode(sUri, "UTF-8"));
... | @Override
protected String doIt() throws Exception {
PreparedStatement insertStmt = null;
try {
insertStmt = DB.prepareStatement("INSERT INTO AD_Sequence_No(AD_SEQUENCE_ID, CALENDARYEAR, " + "AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, " + "UPDATED, UPDATEDBY, CURRENTNEXT)... | false |
2,280 | 3,058,818 | 15,804,547 | public static void encryptFile(String input, String output, String pwd) throws Exception {
CipherOutputStream out;
InputStream in;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(pwd.getBytes(), "DES... | protected static void copyOrMove(File sourceLocation, File targetLocation, boolean move) throws IOException {
String[] children;
int i;
InputStream in;
OutputStream out;
byte[] buf;
int len;
if (sourceLocation.isDirectory()) {
if (!targetLocation.e... | true |
2,281 | 55,568 | 217,484 | public static void httpOnLoad(String fileName, String urlpath) throws Exception {
URL url = new URL(urlpath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
int responseCode = conn.getResponseCode();
Sy... | 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 |
2,282 | 12,955,229 | 1,975,347 | public static void copyFile(File sourceFile, File destFile, boolean overwrite) throws IOException, DirNotFoundException, FileNotFoundException, FileExistsAlreadyException {
File destDir = new File(destFile.getParent());
if (!destDir.exists()) {
throw new DirNotFoundException(destDir.getA... | protected Properties loadFile(String fileName) {
Properties prop = new Properties();
try {
String packageName = getClass().getName();
packageName = packageName.substring(0, packageName.lastIndexOf("."));
String src = "src";
if (mavenBuild) {
... | false |
2,283 | 3,608,828 | 4,617,221 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
String req1xml = jTextArea1.getText();
java.net.URL url = new java.net.URL("http://217.34.8.235:8080/newgenlibctxt/PatronServlet");
java.net.URLConnection urlconn = (java.net.URLConnection) url.o... | public String postDownloadRequest(String localFile) throws Exception {
String responseString = "";
String requestString = "";
if (localFile == null) {
error = true;
errorStr = errorStr.concat("No local target for: " + currentFile.getRelativePat... | false |
2,284 | 3,260,787 | 9,528,049 | public CopyAllDataToOtherFolderResponse CopyAllDataToOtherFolder(DPWSContext context, CopyAllDataToOtherFolder CopyAllDataInps) throws DPWSException {
CopyAllDataToOtherFolderResponse cpyRp = new CopyAllDataToOtherFolderResponseImpl();
int hany = 0;
String errorMsg = null;
try {
... | private void copyFile(File file, File targetFile) {
try {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(targetFile));
byte[] tmp = new byte[8192];
int read... | true |
2,285 | 9,938,081 | 22,448,399 | public void load(String fileName) {
BufferedReader bufReader;
loaded = false;
vector.removeAllElements();
try {
if (fileName.startsWith("http:")) {
URL url = new URL(fileName);
bufReader = new BufferedReader(new InputStreamReader(url.openSt... | private HttpURLConnection getHttpURLConnection(String bizDocToExecute) {
StringBuffer servletURL = new StringBuffer();
servletURL.append(getBaseServletURL());
servletURL.append("?_BIZVIEW=").append(bizDocToExecute);
Map<String, Object> inputParms = getInputParams();
if (input... | false |
2,286 | 16,466,520 | 12,523,607 | 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 void render(ServiceContext serviceContext) throws Exception {
if (serviceContext.getTemplateName() == null) throw new Exception("no Template defined for service: " + serviceContext.getServiceInfo().getRefName());
File f = new File(serviceContext.getTemplateName());
serviceContext.getR... | true |
2,287 | 14,318,467 | 5,856,886 | public static byte[] hashFile(File file) {
long size = file.length();
long jump = (long) (size / (float) CHUNK_SIZE);
MessageDigest digest;
FileInputStream stream;
try {
stream = new FileInputStream(file);
digest = MessageDigest.getInstance("SHA-256");... | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | false |
2,288 | 6,492,265 | 9,106,740 | private File downloadPDB(String pdbId) {
File tempFile = new File(path + "/" + pdbId + ".pdb.gz");
File pdbHome = new File(path);
if (!pdbHome.canWrite()) {
System.err.println("can not write to " + pdbHome);
return null;
}
String ftp = String.format("f... | public String sendXml(URL url, String xmlMessage, boolean isResponseExpected) throws IOException {
if (url == null) {
throw new IllegalArgumentException("url == null");
}
if (xmlMessage == null) {
throw new IllegalArgumentException("xmlMessage == null");
}
... | true |
2,289 | 3,167,465 | 113,681 | public void excluirCliente(String cpf) {
PreparedStatement pstmt = null;
String sql = "delete from cliente where cpf = ?";
try {
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, cpf);
pstmt.executeUpdate();
connection.commit();
... | public void elimina(Pedido pe) throws errorSQL, errorConexionBD {
System.out.println("GestorPedido.elimina()");
int id = pe.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM pedido WHERE id=" + id;
System.out.... | true |
2,290 | 282,874 | 4,397,068 | public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | protected synchronized Long putModel(String table, String linkTable, String type, TupleBinding binding, LocatableModel model) {
try {
if (model.getId() != null && !"".equals(model.getId())) {
ps7.setInt(1, Integer.parseInt(model.getId()));
ps7.execute();
... | true |
2,291 | 11,322,573 | 6,037,299 | 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 void copyAffix(MailAffix affix, long mailId1, long mailId2) throws Exception {
File file = new File(this.getResDir(mailId1) + affix.getAttachAlias());
if (file.exists()) {
File file2 = new File(this.getResDir(mailId2) + affix.getAttachAlias());
if (!file2.exists()) {
... | true |
2,292 | 552,314 | 22,456,976 | public void refreshFileItem(YahooInfo legroup) throws Exception {
String lapage = new String("");
String ledir = new String("");
Pattern pat;
Matcher mat;
Pattern pat2;
Matcher mat2;
int data;
URL myurl = new URL("http://groups.yahoo.com/mygroups");
... | 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 = ... | false |
2,293 | 22,654,851 | 6,436,400 | public static String getHashedPassword(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(password.getBytes());
BigInteger hashedInt = new BigInteger(1, digest.digest());
return String.format("%1$032X", hashedInt);
... | @Override
protected HttpResponse<HttpURLConnection> execute(HttpRequest<HttpURLConnection> con) throws HttpRequestException {
HttpURLConnection unwrap = con.unwrap();
try {
unwrap.connect();
} catch (IOException e) {
throw new HttpRequestException(e);
}
... | false |
2,294 | 6,304,371 | 6,886,408 | public static String getImportFileBody(String fileName, HttpSession session) {
FTPClient ftp = new FTPClient();
CofaxToolsUser user = (CofaxToolsUser) session.getAttribute("user");
String fileTransferFolder = CofaxToolsServlet.fileTransferFolder;
String importFTPServer = (String) use... | public static final String md5(final String s) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int... | false |
2,295 | 19,922,657 | 12,306,296 | protected static boolean copyFile(File src, File dest) {
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
byte[] temp = new byte[1... | public static void copyFile(File source, File destination, long copyLength) throws IOException {
if (!source.exists()) {
String message = "File " + source + " does not exist";
throw new FileNotFoundException(message);
}
if (destination.getParentFile() != null && !dest... | true |
2,296 | 16,063,556 | 8,249,985 | public static String md(String passwd) {
MessageDigest md5 = null;
String digest = passwd;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(passwd.getBytes());
byte[] digestData = md5.digest();
digest = byteArrayToHex(digestData);
... | public void initGet() throws Exception {
URL url = new URL(getURL());
con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Accept", "*/*");
con.setRequestProperty("Range", "bytes=" + getPosition() + "-" + getRangeEnd());
con.setUseCaches(false);
con... | false |
2,297 | 10,482,004 | 130,757 | public static void main(String[] args) throws IOException {
System.out.println("Start filtering zgps...");
final Config config = ConfigUtils.loadConfig(args[0]);
final String CONFIG_MODULE = "GPSFilterZGPS";
File sourceFileSelectedStages = new File(config.findParam(CONFIG_MODULE, "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 |
2,298 | 21,481,555 | 13,490,977 | 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 void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
OutputStream output = getOutputStream();
if (cachedContent != null) {
output.write(cachedContent);
} else {
FileInputStream input = new FileInput... | false |
2,299 | 249,612 | 19,910,630 | protected static boolean checkVersion(String address) {
Scanner scanner = null;
try {
URL url = new URL(address);
InputStream iS = url.openStream();
scanner = new Scanner(iS);
if (scanner == null && DEBUG) System.out.println("SCANNER NULL");
... | public String postData(String result, DefaultHttpClient httpclient) {
try {
HttpPost post = new HttpPost("http://3dforandroid.appspot.com/api/v1/note/create");
StringEntity se = new StringEntity(result);
se.setContentEncoding(HTTP.UTF_8);
se.setContentType("ap... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.