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 |
|---|---|---|---|---|---|
898,100 | 16,280,341 | 19,438,539 | private void mergeInDefaultMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
try {
String surl = AutoplotUtil.getProperty("autoplot.default.bookmarks", "http://www.autoplot.org/data/demos.xml");
URL url = new URL(surl);
Document doc = AutoplotUtil.readDoc(url.open... | public void run() throws Exception {
logger.debug("#run enter");
logger.debug("#run orderId = " + orderId);
ResultSet rs = null;
PreparedStatement ps = null;
try {
connection.setAutoCommit(false);
ps = connection.prepareStatement(SQL_SELECT_ORDER_LINE)... | false |
898,101 | 10,252,056 | 41,672 | public void updatePortletName(PortletName portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
String sql = "update WM_PORTAL_PORTLET_NAME " + "set TYPE=? " + "where ID_SITE_CTX_TYPE=?";
... | 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 |
898,102 | 10,628,604 | 23,484,507 | public File extractID3v2TagDataIntoFile(File outputFile) throws TagNotFoundException, IOException {
int startByte = (int) ((MP3AudioHeader) audioHeader).getMp3StartByte();
if (startByte >= 0) {
FileInputStream fis = new FileInputStream(file);
FileChannel fc = fis.getChannel()... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getName());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getName());
if... | true |
898,103 | 13,111,022 | 14,885,369 | 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;
... | public File copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
copyChannel(inChannel, outChannel);
return out;
}
| true |
898,104 | 16,001,374 | 9,562,033 | static void copyFile(File file, File destDir) {
File destFile = new File(destDir, file.getName());
if (destFile.exists() && (!destFile.canWrite())) {
throw new SyncException("Cannot overwrite " + destFile + " because " + "it is read-only");
}
try {
FileInputSt... | public void run(String srcf, String dst) {
final Path srcPath = new Path("./" + srcf);
final Path desPath = new Path(dst);
try {
Path[] srcs = FileUtil.stat2Paths(hdfs.globStatus(srcPath), srcPath);
OutputStream out = FileSystem.getLocal(conf).create(desPath);
... | true |
898,105 | 18,310,019 | 811,157 | public static String readFromAddress(String address) throws Exception {
StringBuilder sb = new StringBuilder();
URL url = new URL(address);
URLConnection con = url.openConnection();
con.connect();
InputStream is = (InputStream) con.getContent();
BufferedReader br = ne... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
898,106 | 2,633,238 | 11,998,194 | public static String getResourceFromURL(URL url, String acceptHeader) throws java.io.IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setUseCaches(false);
urlConnection.setRequestProperty("Accept", acceptHeader);
urlConnection.se... | private static void executeDBPatchFile() throws Exception {
Connection con = null;
PreparedStatement pre_stmt = null;
ResultSet rs = null;
try {
InputStream is = null;
URL url = new URL("http://www.hdd-player.de/umc/UMC-DB-Update-Script.sql");
is =... | true |
898,107 | 5,545,050 | 16,099,225 | public void sendFile(File file, String filename, String contentType) throws SearchLibException {
response.setContentType(contentType);
response.addHeader("Content-Disposition", "attachment; filename=" + filename);
FileInputStream inputStream = null;
try {
inputStream = ne... | public static String digest(String text, String algorithm, String charsetName) {
try {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(text.getBytes(charsetName), 0, text.length());
return convertToHex(md.digest());
} catch (NoSuchAlgorithmExcep... | false |
898,108 | 18,628,318 | 8,224,584 | public static String generateDigest(String message, String DigestAlgorithm) {
try {
MessageDigest md = MessageDigest.getInstance(DigestAlgorithm);
md.update(message.getBytes(), 0, message.length());
return new BigInteger(1, md.digest()).toString(16);
} catch (NoSu... | @Override
public boolean checkConnection() {
int status = 0;
try {
URL url = new URL(TupeloProxy.endpoint);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
status = conn.getResponseCode();
} catch (Exception e) {
logger.s... | false |
898,109 | 22,625,085 | 555,928 | @Transient
private String md5sum(String text) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(text.getBytes());
byte messageDigest[] = md.digest();
return bufferToHex(messageDigest, 0, messageDigest.length);
... | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | false |
898,110 | 13,292,215 | 5,271,797 | public static void main(String[] args) {
try {
{
byte[] bytes1 = { (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
byte[] bytes2 = { (byte) 99, (byte) 2, (byte) 2, (byte) 3, (byte) 0, (byte) 9 };
System.out.println("Bytes 2,2,3,0,9 as Base64: "... | private void loadMap() {
final String wordList = "vietwordlist.txt";
try {
File dataFile = new File(supportDir, wordList);
if (!dataFile.exists()) {
final ReadableByteChannel input = Channels.newChannel(ClassLoader.getSystemResourceAsStream("dict/" + dataFile.... | true |
898,111 | 18,269,393 | 10,432,257 | public static File getClassLoaderFile(String filename) throws IOException {
Resource resource = new ClassPathResource(filename);
try {
return resource.getFile();
} catch (IOException e) {
}
InputStream is = null;
FileOutputStream os = null;
try {
... | private void createImageArchive() throws Exception {
imageArchive = new File(resoutFolder, "images.CrAr");
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(imageArchive)));
out.writeInt(toNativeEndian(imageFiles.size()));
for (int i = 0; i < i... | true |
898,112 | 19,392,392 | 291,167 | public int addRecipe(Recipe recipe) throws Exception {
PreparedStatement pst1 = null;
PreparedStatement pst2 = null;
ResultSet rs = null;
int retVal = -1;
try {
conn = getConnection();
pst1 = conn.prepareStatement("INSERT INTO recipes (name, instructio... | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | false |
898,113 | 1,913,136 | 12,062,763 | private void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.... | public void loadFromURLPath(String type, URL urlPath, HashMap parentAttributes) throws IOException {
this.urlPath = urlPath;
this.type = type;
JmeBinaryReader jbr = new JmeBinaryReader();
setProperties(jbr, parentAttributes);
InputStream loaderInput = urlPath.openStream();
... | false |
898,114 | 144,769 | 8,546,232 | public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | public void execute(File sourceFile, File destinationFile, Properties htmlCleanerConfig) {
FileReader reader = null;
Writer writer = null;
try {
reader = new FileReader(sourceFile);
logger.info("Using source file: " + trimPath(userDir, sourceFile));
if (!d... | false |
898,115 | 431,295 | 1,605,515 | 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 createZip(String baseDir, String objFileName) throws Exception {
logger.info("createZip: [ " + baseDir + "] [" + objFileName + "]");
baseDir = baseDir + "/" + timesmpt;
File folderObject = new File(baseDir);
if (folderObject.exists()) {
List<?> fileList = ge... | true |
898,116 | 20,267,318 | 13,713,980 | 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... | private String sendMessage(HttpURLConnection connection, String reqMessage) throws IOException, XMLStreamException {
if (msgLog.isTraceEnabled()) msgLog.trace("Outgoing SOAPMessage\n" + reqMessage);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
out.write(... | false |
898,117 | 3,597,316 | 23,370,570 | 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(... | public void xtestGetThread() throws Exception {
GMSearchOptions options = new GMSearchOptions();
options.setFrom(loginInfo.getUsername() + "*");
options.setSubject("message*");
GMSearchResponse mail = client.getMail(options);
for (Iterator it = mail.getThreadSnapshots().itera... | true |
898,118 | 4,414,596 | 21,822,158 | public static int UsePassword(String username, String password, String new_password) {
try {
URL url = new URL("http://eiffel.itba.edu.ar/hci/service/Security.groovy?method=ChangePassword&username=" + username + "&password=" + password + "&new_password=" + new_password);
URLConnectio... | private void loadObject(URL url) throws IOException {
InputStream is = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
int linecounter = 0;
try {
String line;
boolean firstpass = true;
String[] coordstext;
... | true |
898,119 | 13,024,208 | 3,647,667 | public static String CreateHash(String s) {
String str = s.toString();
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("String cannot be null or empty");
}
StringBuffer hexString = new StringBuffer();
try {
MessageDigest md =... | public static String getMdPsw(String passwd) throws Exception {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(passwd.getBytes("iso-8859-1"), 0, passwd.length());
md5hash = md.digest();
return convertToHex(md5hash);
... | true |
898,120 | 13,031,564 | 18,599,251 | public void viewFile(int file_nx) {
FTPClient ftp = new FTPClient();
boolean error = false;
try {
int reply;
ftp.connect("tgftp.nws.noaa.gov");
ftp.login("anonymous", "");
Log.d("WXDroid", "Connected to tgftp.nws... | public static String hash(String plainTextPwd) {
MessageDigest hashAlgo;
try {
hashAlgo = java.security.MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new QwickException(e);
}
hashAlgo.update(plainTextPwd.getBytes());
... | false |
898,121 | 22,319,064 | 779,185 | public void addRegisterInfo(HttpServletRequest request) throws ApplicationException {
String[] pids = request.getParameterValues("pid");
if (pids == null || pids.length <= 0) throw new ApplicationException("��ѡ��Ҫ���IJ�Ʒ");
RegisterDao registerDao = new RegisterDao();
Register registe... | 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 |
898,122 | 5,751,314 | 4,201,902 | 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.... | private String executeHttpPreload(HttpResponse response, String xml) throws Exception {
GadgetSpec spec = new GadgetSpec(GADGET_URL, xml);
RecordingRequestPipeline pipeline = new RecordingRequestPipeline(response);
PipelinedDataPreloader preloader = new PipelinedDataPreloader(pipeline, conta... | false |
898,123 | 17,497,944 | 8,200,307 | public void format(File source, File target) {
if (!source.exists()) {
throw new IllegalArgumentException("Source '" + source + " doesn't exist");
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source '" + source + " is not a file");
}
t... | public static String encryptPassword(String password) {
String hash = null;
try {
MessageDigest md = null;
md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
byte raw[] = md.digest();
hash = Base64.encode(raw, fal... | false |
898,124 | 8,080,019 | 116,038 | public static String getInstanceUserdata() throws IOException {
int retries = 0;
while (true) {
try {
URL url = new URL("http://169.254.169.254/latest/user-data/");
InputStreamReader rdr = new InputStreamReader(url.openStream());
StringWrit... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
898,125 | 8,292,297 | 2,109,483 | public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("GET REQUEST OR RESPONSE - Send content: " + file.getAbsolutePath());
FileInputStream in = null;
try {
in = new FileInputStream(file);
... | @Override
public LispObject execute(LispObject first, LispObject second) throws ConditionThrowable {
Pathname zipfilePathname = coerceToPathname(first);
byte[] buffer = new byte[4096];
try {
String zipfileNamestring = zipfilePathname.getNamestring();
if (zipfileNa... | true |
898,126 | 7,726,949 | 4,505,945 | protected static String readUrl(URL url) throws IOException {
BufferedReader in = null;
StringBuffer buf = new StringBuffer();
try {
in = new BufferedReader(new InputStreamReader(url.openStream()));
final char[] charBuf = new char[1024];
int len = 0;
... | 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... | false |
898,127 | 14,996,759 | 743,717 | public static String hashString(String sPassword) {
if (sPassword == null || sPassword.equals("")) {
return "empty:";
} else {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(sPassword.getBytes("UTF-8"));
... | String fetch_m3u(String m3u) {
InputStream pstream = null;
if (m3u.startsWith("http://")) {
try {
URL url = null;
if (running_as_applet) url = new URL(getCodeBase(), m3u); else url = new URL(m3u);
URLConnection urlc = url.openConnection();
... | false |
898,128 | 16,733,950 | 16,005,066 | 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();
destinati... | private void setManagedContent(Entry entry, Datastream vds) throws StreamIOException {
if (m_transContext == DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE && !m_format.equals(ATOM_ZIP1_1)) {
String mimeType = vds.DSMIME;
if (MimeTypeHelper.isText(mimeType) || MimeTypeHelper.isXml(mim... | true |
898,129 | 12,678,588 | 952,242 | 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 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 |
898,130 | 21,234,511 | 18,741,084 | 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... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
898,131 | 8,003,021 | 11,291,099 | @Override
public void run() {
URL url = null;
FileOutputStream fos = null;
FTPClient ftp = null;
try {
url = new URL(super.getAddress());
String host = url.getHost();
String folder = StringUtils.substringBeforeLast(url.getPath(), "/");
... | public void visit(BosMember member) throws BosException {
String relative = AddressingUtil.getRelativePath(member.getDataSourceUri(), baseUri);
URL resultUrl;
try {
resultUrl = new URL(outputUrl, relative);
File resultFile = new File(resultUrl.toURI());
re... | false |
898,132 | 11,275,834 | 12,881,123 | private void createHomeTab() {
Tabpanel homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, Msg.getMsg(EnvWeb.getCtx(), "Home").replaceAll("&", ""), false);
Portallayout portalLayout = new Portallayout();
portalLayout.setWidth("100%");
portalLayout.setHeight("100%");... | ServerInfo getServerInfo(String key, String protocol) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, IOException, ClassNotFoundException, IllegalBlockSizeException, BadPaddingException {
DESedeKeySpec ks = new DESedeKeySpec(Base64.decode(key));
... | false |
898,133 | 699,719 | 1,142,776 | @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... | public LinkedList<NameValuePair> getScoreboard() {
InputStream is = null;
String result = "";
LinkedList<NameValuePair> scores = new LinkedList<NameValuePair>();
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(domain);
... | false |
898,134 | 13,028,547 | 21,162,921 | 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.... | private static void convertToOnline(final String filePath, final DocuBean docuBean) throws Exception {
File source = new File(filePath + File.separator + docuBean.getFileName());
File dir = new File(filePath + File.separator + docuBean.getId());
if (!dir.exists()) {
dir.mkdir();
... | true |
898,135 | 765,071 | 17,630,907 | public static void testString(String string, String expected) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(string.getBytes(), 0, string.length());
String result = toString(md.digest());
System.out.println(expected);... | public static int[] sortDescending(int input[]) {
int[] order = new int[input.length];
for (int i = 0; i < order.length; i++) order[i] = i;
for (int i = input.length; --i >= 0; ) {
for (int j = 0; j < i; j++) {
if (input[j] < input[j + 1]) {
in... | false |
898,136 | 126,187 | 15,958,994 | 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 String loadURLString(java.net.URL url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer();
String s = "";
while (br.ready() && s != null) {
s = br.readLine();
... | false |
898,137 | 15,700,440 | 126,187 | private void getViolationsReportBySLATIdYearMonth() throws IOException {
String xmlFile10Send = System.getenv("SLASOI_HOME") + System.getProperty("file.separator") + "Integration" + System.getProperty("file.separator") + "soap" + System.getProperty("file.separator") + "getViolationsReportBySLATIdYearMonth.x... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
898,138 | 19,166,563 | 126,187 | 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 {
... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
898,139 | 22,619,332 | 10,959,933 | protected List<Datastream> getDatastreams(final DepositCollection pDeposit) throws IOException, SWORDException {
LOG.debug("copying file");
String tTempFileName = this.getTempDir() + "uploaded-file.tmp";
IOUtils.copy(pDeposit.getFile(), new FileOutputStream(tTempFileName));
Datastrea... | public static void main(String[] args) throws Exception {
FileChannel fc = new FileOutputStream("data.txt").getChannel();
fc.write(ByteBuffer.wrap("some text ".getBytes()));
fc.close();
fc = new RandomAccessFile("data.txt", "rw").getChannel();
fc.position(fc.size());
... | true |
898,140 | 7,760,030 | 18,134,394 | private void loadNumberFormats() {
String fileToLocate = "/" + FILENAME_NUMBER_FMT;
URL url = getClass().getClassLoader().getResource(fileToLocate);
if (url == null) {
return;
}
List<String> lines;
try {
lines = IOUtils.readLines(url.openStream... | private String fetch(String urlstring) {
String content = "";
try {
URL url = new URL(urlstring);
InputStream is = url.openStream();
BufferedReader d = new BufferedReader(new InputStreamReader(is));
String s;
while (null != (s = d.readLine(... | true |
898,141 | 19,366,418 | 17,871,426 | public static Photo createPhoto(String title, String userLogin, String pathToPhoto, String basePathImage) throws NoSuchAlgorithmException, IOException {
String id = CryptSHA1.genPhotoID(userLogin, title);
String extension = pathToPhoto.substring(pathToPhoto.lastIndexOf("."));
String destinat... | public void encryptFile(String originalFile, String encryptedFile, String password) throws Exception {
CipherOutputStream out;
InputStream in;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(password... | true |
898,142 | 16,454,974 | 13,536,693 | @Override
public int write(FileStatus.FileTrackingStatus fileStatus, InputStream input, PostWriteAction postWriteAction) throws WriterException, InterruptedException {
String key = logFileNameExtractor.getFileName(fileStatus);
int wasWritten = 0;
FileOutputStreamPool fileOutputStreamPool... | public static void decompress(File apps,File f) throws IOException{
String filename=f.getName();
filename=filename.substring(0,filename.length()-PACK_FILE_SUFFIX.length());
File dir=new File(apps,filename);
if(!dir.exists()){
dir.mkdirs();
}
if(dir.isDirectory()){
JarFile jar=new JarFile(f);
Enume... | true |
898,143 | 1,874,550 | 1,677,217 | public String doAction(Action commandAction) throws Exception {
Map<String, String> args = commandAction.getArgs();
EnumCommandActionType actionType = commandAction.getType();
String actionResult = "";
switch(actionType) {
case SEND:
String method = getMet... | @Override
protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (beforeServingFile(req, resp)) {
String pathInfo = req.getPathInfo();
Validate.notNull(pathInfo, "the path info is null -> the sevlet should be mapped ... | false |
898,144 | 18,991,846 | 5,933,078 | public static void copyFile(File oldFile, File newFile) throws Exception {
newFile.getParentFile().mkdirs();
newFile.createNewFile();
FileChannel srcChannel = new FileInputStream(oldFile).getChannel();
FileChannel dstChannel = new FileOutputStream(newFile).getChannel();
dstCh... | public boolean authorize(String username, String password, String filename) {
open(filename);
boolean isAuthorized = false;
StringBuffer encPasswd = null;
try {
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(password.getBytes(... | false |
898,145 | 2,687,278 | 8,250,731 | @Override
protected void copy(InputStream inputs, OutputStream outputs) throws IOException {
if (outputs == null) {
throw new NullPointerException();
}
if (inputs == null) {
throw new NullPointerException();
}
ZipOutputStream zipoutputs = null;
... | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String uuid = req.getParameterValues(Constants.PARAM_UUID)[0];
String datastream = null;
if (req.getRequestURI().contains(Constants.SERVLET_DOWNLOAD_FOXML_PREFIX)) {
... | true |
898,146 | 10,315,215 | 6,359,501 | public final void testT4CClientWriter() throws Exception {
InputStream is = ClassLoader.getSystemResourceAsStream(this.testFileName);
T4CClientReader reader = new T4CClientReader(is, rc);
File tmpFile = File.createTempFile("barde", ".log", this.tmpDir);
System.out.println("tmp=" + tm... | public EncodedScript(PackageScript source, DpkgData data) throws IOException {
_source = source;
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
OutputStream output = null;
try {
output = MimeUtility.encode(bytes, BASE64);
} catch (final Messaging... | true |
898,147 | 15,984,793 | 17,887,703 | public InputStream getPage(String page) throws IOException {
URL url = new URL(hattrickServerURL + "/Common/" + page);
HttpURLConnection huc = (HttpURLConnection) url.openConnection();
huc.setRequestProperty("Cookie", sessionCookie);
return huc.getInputStream();
}
| private boolean confirmAndModify(MDPRArchiveAccessor archiveAccessor) {
String candidateBackupName = archiveAccessor.getArchiveFileName() + ".old";
String backupName = createUniqueFileName(candidateBackupName);
MessageFormat format = new MessageFormat(AUTO_MOD_MESSAGE);
String messag... | false |
898,148 | 9,756,057 | 3,156,435 | public void writeToFile(File out) throws IOException, DocumentException {
FileChannel inChannel = new FileInputStream(pdf_file).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} ca... | public static void fileCopy(File src, File dst) throws FileNotFoundException, IOException {
if (src.isDirectory() && (!dst.exists() || dst.isDirectory())) {
if (!dst.exists()) {
if (!dst.mkdirs()) throw new IOException("unable to mkdir " + dst);
}
File dst... | true |
898,149 | 6,556,152 | 3,578,392 | private static File[] getWsdls(File dirfile) throws Exception {
File[] allfiles = dirfile.listFiles();
List<File> files = new ArrayList<File>();
if (allfiles != null) {
MessageDigest md = MessageDigest.getInstance("MD5");
String outputDir = argMap.get(OUTPUT_DIR);
... | public static void copyFile(File in, File out) throws FileNotFoundException, IOException {
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(in).getChannel();
destinationChannel = new FileOutputStream(ou... | false |
898,150 | 6,988,217 | 777,609 | public void testQueryForBinary() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource source = (JCRNodeSource) resolveSource(BASE_URL + "images/photo.png");
assertNotNull(source);
assertEquals(false, source.exists());
OutputStream os = source.getOutputStream(... | 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 |
898,151 | 189,777 | 1,629,598 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public static void copyFile(File src, File dest) throws IOException {
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
java.nio.channels.FileChannel channelSrc = fis.getChannel();
java.nio.channels.FileChannel channelDest = fos.getCha... | true |
898,152 | 20,955,452 | 11,892,804 | private void criarQuestaoMultiplaEscolha(QuestaoMultiplaEscolha q) throws SQLException {
PreparedStatement stmt = null;
String sql = "INSERT INTO multipla_escolha (id_questao, texto, gabarito) VALUES (?,?,?)";
try {
for (Alternativa alternativa : q.getAlternativa()) {
... | private int[] Tri(int[] pertinence, int taille) {
boolean change = true;
int tmp;
while (change) {
change = false;
for (int i = 0; i < taille - 2; i++) {
if (pertinence[i] < pertinence[i + 1]) {
tmp = pertinence[i];
... | false |
898,153 | 16,519,742 | 15,471,169 | public File getFile(String file) {
DirProperties dp;
List files = new ArrayList();
for (int i = 0; i < locs.size(); i++) {
dp = (DirProperties) locs.get(i);
if (dp.isReadable()) {
File g = new File(dp.getLocation() + slash() + file);
if... | public static String getMD5(String value) {
if (StringUtils.isBlank(value)) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(value.getBytes("UTF-8"));
return toHexString(md.digest());
} catch (Throwable e) {
ret... | false |
898,154 | 17,513,478 | 4,726,770 | public void create(File target) {
if ("dir".equals(type)) {
File dir = new File(target, name);
dir.mkdirs();
for (Resource c : children) {
c.create(dir);
}
} else if ("package".equals(type)) {
String[] dirs = name.split("\\.... | public void execute() throws MojoExecutionException, MojoFailureException {
try {
this.getLog().info("copy source web.xml - " + this.getWebXml() + " to build dir (source web.xml required if mergewebxml execution is enabled)");
File destination = new File(this.getBuildDir(), "web.xml"... | true |
898,155 | 1,977,263 | 17,477,957 | private String fetchCompareContent() throws IOException {
URL url = new URL(compareTo);
StringWriter sw = new StringWriter();
IOUtils.copy(url.openStream(), sw);
return sw.getBuffer().toString();
}
| public static void unzipModel(String filename, String tempdir) throws Exception {
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(filename);
int BUFFER = 2048;
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fi... | true |
898,156 | 22,271,237 | 14,196,272 | public static void copy(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
... | 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));
... | true |
898,157 | 19,279,820 | 19,194,277 | private void copyFile(URL from, File to) {
try {
InputStream is = from.openStream();
IOUtils.copy(is, new FileOutputStream(to));
} catch (IOException e) {
e.printStackTrace();
}
}
| public void create() throws IOException {
FileChannel fc = new FileInputStream(sourceFile).getChannel();
for (RangeArrayElement element : array) {
FileChannel fc_ = fc.position(element.starting());
File part = new File(destinationDirectory, "_0x" + Long.toHexString(element.st... | true |
898,158 | 16,485,992 | 12,206,255 | private void sendBinaryFile(File file) throws IOException, CVSException {
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
if (m_bCompressFiles) {
GZIPOutputStream gzipOut = null;
InputStream gzipIn ... | private void parseTemplate(File templateFile, Map dataMap) throws ContainerException {
Debug.log("Parsing template : " + templateFile.getAbsolutePath(), module);
Reader reader = null;
try {
reader = new InputStreamReader(new FileInputStream(templateFile));
} catch (FileNo... | true |
898,159 | 1,907,167 | 18,850,012 | private void sendData(HttpServletResponse response, MediaBean mediaBean) throws IOException {
if (logger.isInfoEnabled()) logger.info("sendData[" + mediaBean + "]");
response.setContentLength(mediaBean.getContentLength());
response.setContentType(mediaBean.getContentType());
response... | public void copy(String fromFileName, String toFileName) throws IOException {
log.info("copy() file:" + fromFileName + " toFile:" + toFileName);
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "n... | true |
898,160 | 3,517,430 | 1,906,172 | public static String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
... | public void deploy(String baseDir, boolean clean) throws IOException {
try {
ftp.connect(hostname, port);
log.debug("Connected to: " + hostname + ":" + port);
ftp.login(username, password);
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCo... | false |
898,161 | 302,826 | 22,926,731 | static String fetchURLComposeExternPackageList(String urlpath, String pkglisturlpath) {
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (Malforme... | public void testDelegateUsage() throws IOException {
MockControl elementParserControl = MockControl.createControl(ElementParser.class);
ElementParser elementParser = (ElementParser) elementParserControl.getMock();
elementParserControl.replay();
URL url = getClass().getResource("/net/... | false |
898,162 | 18,065,573 | 200,484 | private static String executeGet(String urlStr) {
StringBuffer result = new StringBuffer();
try {
Authentication.doIt();
URL url = new URL(urlStr);
System.out.println("Host: " + url.getHost());
BufferedReader in = new BufferedReader(new InputStreamRead... | void bubbleSort(int[] a) {
int i = 0;
int j = a.length - 1;
int aux = 0;
int stop = 0;
while (stop == 0) {
stop = 1;
i = 0;
while (i < j) {
if (a[i] > a[i + 1]) {
aux = a[i];
a[i] = a[... | false |
898,163 | 14,047,630 | 2,721,037 | @Override
public void run() {
try {
IOUtils.copy(getSource(), processStdIn);
System.err.println("Copy done.");
close();
} catch (IOException e) {
e.printStackTrace();
... | 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 |
898,164 | 17,994,731 | 3,621,790 | 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;
}
| private String sha1(String s) {
String encrypt = s;
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.update(s.getBytes());
byte[] digest = sha.digest();
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < di... | true |
898,165 | 6,037,295 | 19,538,929 | public void copyContent(long mailId1, long mailId2) throws Exception {
File file1 = new File(this.getMailDir(mailId1) + "/");
File file2 = new File(this.getMailDir(mailId2) + "/");
this.recursiveDir(file2);
if (file1.isDirectory()) {
File[] files = file1.listFiles();
... | 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())... | true |
898,166 | 20,029,245 | 13,438,575 | public static void main(String[] args) throws IOException {
long readfilelen = 0;
BufferedRandomAccessFile brafReadFile, brafWriteFile;
brafReadFile = new BufferedRandomAccessFile("C:\\WINNT\\Fonts\\STKAITI.TTF");
readfilelen = brafReadFile.initfilelen;
brafWriteFile = new Bu... | private static void serveHTML() throws Exception {
Bus bus = BusFactory.getDefaultBus();
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
Endpoi... | true |
898,167 | 13,447,231 | 22,550,493 | public void copy(String pathFileIn, String pathFileOut) {
try {
File inputFile = new File(pathFileIn);
File outputFile = new File(pathFileOut);
FileReader in = new FileReader(inputFile);
File outDir = new File(DirOut);
if (!outDir.exists()) outDir.... | private String createVisadFile(String fileName) throws FileNotFoundException, IOException {
ArrayList<String> columnNames = new ArrayList<String>();
String visadFile = fileName + ".visad";
BufferedReader buf = new BufferedReader(new FileReader(fileName));
String firstLine = buf.readL... | true |
898,168 | 17,981,986 | 16,788,944 | public void saveProjectFile(File aFile) {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
File destDir = new File(theProjectsDirectory, sdf.format(Calendar.getInstance().getTime()));
if (destDir.mkdirs()) {
File outFile = new File(destDir, "project.xml");
... | private void refreshCacheFile(RepositoryFile file, File cacheFile) throws FileNotFoundException, IOException {
FileOutputStream fos = new FileOutputStream(cacheFile);
InputStream is = file.getInputStream();
int count = IOUtils.copy(is, fos);
logger.debug("============================... | true |
898,169 | 15,712,380 | 23,291,433 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Specify name of the file, just one entry per line");
System.exit(0);
}
File inFile = new File(args[0]);
BufferedReader myBR = null;
File outFile = new File(args[0] + "... | public static String sendRequest(String urlstring) {
URL url;
String line;
Log.i("DVBMonitor", "Please wait while receiving data from dvb...");
try {
url = new URL(urlstring);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
... | false |
898,170 | 1,676,011 | 3,156,435 | ServiceDescription getServiceDescription() throws ConfigurationException {
final XPath pathsXPath = this.xPathFactory.newXPath();
try {
final Node serviceDescriptionNode = (Node) pathsXPath.evaluate(ConfigurationFileTagsV1.SERVICE_DESCRIPTION_ELEMENT_XPATH, this.configuration, XPathConst... | public static void fileCopy(File src, File dst) throws FileNotFoundException, IOException {
if (src.isDirectory() && (!dst.exists() || dst.isDirectory())) {
if (!dst.exists()) {
if (!dst.mkdirs()) throw new IOException("unable to mkdir " + dst);
}
File dst... | false |
898,171 | 18,194,344 | 17,003,469 | public void setPassword(String plaintext) throws java.security.NoSuchAlgorithmException {
StringBuffer encrypted = new StringBuffer();
java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(plaintext.getBytes());
byte[] digestArray = digest... | public static String login() throws Exception {
if (sid == null) {
String login = ROLAPClientAux.loadProperties().getProperty("user");
String password = ROLAPClientAux.loadProperties().getProperty("password");
MessageDigest md = MessageDigest.getInstance("MD5");
... | true |
898,172 | 21,609,544 | 17,415,423 | public static JSONObject delete(String uid) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpGet get = new HttpGet(DELETE_URI + "?uid=" + uid);
HttpResponse response = client.execute(get);
if (response.getStatusLine()... | public void overwriteFileTest() throws Exception {
File filefrom = new File("/tmp/from.txt");
File fileto = new File("/tmp/to.txt");
InputStream from = null;
OutputStream to = null;
try {
from = new FileInputStream(filefrom);
to = new FileOutputStream(... | false |
898,173 | 7,680,527 | 11,335,657 | static String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = m... | public void sorter() {
String inputLine1, inputLine2;
String epiNames[] = new String[1000];
String epiEpisodes[] = new String[1000];
int lineCounter = 0;
try {
String pluginDir = pluginInterface.getPluginDirectoryName();
String eplist_file = pluginDir ... | false |
898,174 | 2,525,684 | 4,520,177 | private void add(Hashtable applicantInfo) throws Exception {
String mode = "".equals(getParam("applicant_id_gen").trim()) ? "update" : "insert";
String applicant_id = getParam("applicant_id");
String password = getParam("password");
if ("".equals(applicant_id)) applicant_id = getPara... | public void fetchKey() throws IOException {
String strurl = MessageFormat.format(keyurl, new Object[] { username, secret, login, session });
StringBuffer result = new StringBuffer();
BufferedReader reader = null;
URL url = null;
try {
url = new URL(strurl);
... | false |
898,175 | 22,950,121 | 19,299,263 | private boolean createPKCReqest(String keystoreLocation, String pw) {
boolean created = false;
Security.addProvider(new BouncyCastleProvider());
KeyStore ks = null;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new BufferedInputStream(new... | 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 ==... | true |
898,176 | 12,394,809 | 7,187,035 | public static final File getFile(final URL url) throws IOException {
final File shortcutFile;
final File currentFile = files.get(url);
if (currentFile == null || !currentFile.exists()) {
shortcutFile = File.createTempFile("windowsIsLame", ".vbs");
shortcutFile.deleteO... | @Override
public byte[] read(String path) throws PersistenceException {
InputStream reader = null;
ByteArrayOutputStream sw = new ByteArrayOutputStream();
try {
reader = new FileInputStream(path);
IOUtils.copy(reader, sw);
} catch (Exception e) {
... | false |
898,177 | 380,318 | 21,134,287 | static void conditionalCopyFile(File dst, File src) throws IOException {
if (dst.equals(src)) return;
if (!dst.isFile() || dst.lastModified() < src.lastModified()) {
System.out.println("Copying " + src);
InputStream is = new FileInputStream(src);
OutputStream os =... | private List<Document> storeDocuments(List<Document> documents) {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
List<Document> newDocuments = new ArrayList<Document>();
try {
session.beginTransaction();
Preference preference = new Preference... | true |
898,178 | 20,103,134 | 5,505,322 | public static String base64HashedString(String v) {
String base64HashedPassword = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(v.getBytes());
String hashedPassword = new String(md.digest());
sun.misc.BASE64Encoder enc = ne... | public Atividade insertAtividade(Atividade atividade) throws SQLException {
Connection conn = null;
String insert = "insert into Atividade (idatividade, requerente_idrequerente, datacriacao, datatermino, valor, tipoatividade, descricao, fase_idfase, estado) " + "values " + "(nextval('seq_atividade')... | false |
898,179 | 16,055,802 | 4,303,376 | public static void main(String[] args) throws Exception {
DES des = new DES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test1.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\test2.txt"));
SingleKey key = new SingleKe... | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String[] path = StringUtils.split(request.getRequestURI(), "/");
String file = path[path.length - 1];
File f = new File(pathToImages + "/" + file);
response.setConten... | true |
898,180 | 23,677,130 | 8,680,491 | public FTPClient sample3c(String ftpserver, int ftpport, String proxyserver, int proxyport, String username, String password) throws SocketException, IOException {
FTPHTTPClient ftpClient = new FTPHTTPClient(proxyserver, proxyport);
ftpClient.setDefaultPort(ftpport);
ftpClient.connect(ftpserver);
ftpClient.log... | public static final boolean compressToZip(final String sSource, final String sDest, final boolean bDeleteSourceOnSuccess) {
ZipOutputStream os = null;
InputStream is = null;
try {
os = new ZipOutputStream(new FileOutputStream(sDest));
is = new FileInputStream(sSource)... | false |
898,181 | 13,753,266 | 13,405,484 | public static void s_copy(FileInputStream fis, FileOutputStream fos) throws Exception {
FileChannel in = fis.getChannel();
FileChannel out = fos.getChannel();
in.transferTo(0, in.size(), out);
if (in != null) in.close();
if (out != null) out.close();
}
| public boolean send(String number, String message) throws IOException {
init();
message = message.substring(0, Math.min(MAX_PAYLOAD, message.length()));
message = message.replace('\r', ' ');
message = message.replace('\n', ' ');
ActualFormParameters params = new ActualFormPar... | false |
898,182 | 8,352,956 | 22,246,374 | void IconmenuItem5_actionPerformed(ActionEvent e) {
JFileChooser jFileChooser1 = new JFileChooser();
String separator = "";
if (getPath() != null && !getPath().equals("")) {
jFileChooser1.setCurrentDirectory(new File(getPath()));
jFileChooser1.setSelectedFile(new File... | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | true |
898,183 | 10,425,169 | 6,483,359 | private void getRandomGUID(boolean secure, Object o) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
... | private void unzipData(ZipFile zipfile, ZipEntry entry) {
if (entry.getName().equals("backUpExternalInfo.out")) {
File outputFile = new File("temp", entry.getName());
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
... | false |
898,184 | 7,990,229 | 15,804,547 | public static InputStream gunzip(final InputStream inputStream) throws IOException {
Assert.notNull(inputStream, "inputStream");
GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
InputOutputStream inputOutputStream = new InputOutputStream();
IOUtils.copy(gzipInputSt... | 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 |
898,185 | 22,098,632 | 8,166,293 | private String getMd5(String base64image) {
String token = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(base64image.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
token = hash.toString(16);
} cat... | public static void main(String[] args) {
int dizi[] = { 23, 78, 45, 8, 3, 32, 56, 39, 92, 28 };
boolean test = false;
int kars = 0;
int tas = 0;
while (true) {
for (int j = 0; j < dizi.length - 1; j++) {
kars++;
if (dizi[j] > dizi[j... | false |
898,186 | 17,241,450 | 10,656,323 | public static boolean copyFile(File src, File des) {
try {
BufferedInputStream in = new BufferedInputStream(new FileInputStream(src));
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(des));
int b;
while ((b = in.read()) != -1) out.writ... | public void copy(File s, File t) throws IOException {
FileChannel in = (new FileInputStream(s)).getChannel();
FileChannel out = (new FileOutputStream(t)).getChannel();
in.transferTo(0, s.length(), out);
in.close();
out.close();
}
| true |
898,187 | 11,731,587 | 11,339,042 | public File createFileFromClasspathResource(String resourceUrl) throws IOException {
File fichierTest = File.createTempFile("xmlFieldTestFile", "");
FileOutputStream fos = new FileOutputStream(fichierTest);
InputStream is = XmlFieldDomSelectorTest.class.getResourceAsStream(resourceUrl);
... | public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = null;
ServletOutputStream outstream = null;
try {
String action = req.getParameter("nmrshiftdbaction");
String relativepath = ServletUtils.expa... | true |
898,188 | 7,682,331 | 250,596 | @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 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 |
898,189 | 11,319,479 | 616,260 | 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.... | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | true |
898,190 | 22,262,998 | 8,052,478 | public static String SHA512(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-512");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("UTF-8"), 0, text.length());
sha1hash = md.digest();
... | private static void execute(String fileName) throws IOException, SQLException {
InputStream input = DatabaseConstants.class.getResourceAsStream(fileName);
StringWriter writer = new StringWriter();
IOUtils.copy(input, writer);
String sql = writer.toString();
Statement statemen... | false |
898,191 | 5,017,376 | 18,096,549 | public static String md5(String str) {
StringBuffer buf = new StringBuffer();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] data = new byte[32];
md.update(str.getBytes(md5Encoding), 0, str.length());
data = md.digest();
... | public static void copyFile(File src, File dest, boolean notifyUserOnError) {
if (src.exists()) {
try {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
BufferedInputStream in = new BufferedInputStream(new FileInputStream(src));
... | false |
898,192 | 6,270,867 | 20,929,406 | public static String md5Encrypt(final String txt) {
String enTxt = txt;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
logger.error("Error:", e);
}
if (null != md) {
byte... | public static synchronized String encrypt(String plaintext) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
return (new BASE64Encoder()).encode(raw);
}
| true |
898,193 | 3,585,152 | 1,235,581 | public static void copy(FileInputStream from, FileOutputStream to) throws IOException {
FileChannel fromChannel = from.getChannel();
FileChannel toChannel = to.getChannel();
copy(fromChannel, toChannel);
fromChannel.close();
toChannel.close();
}
| public Object process(Atom oAtm) throws IOException {
File oFile;
FileReader oFileRead;
String sPathHTML;
char cBuffer[];
Object oReplaced;
final String sSep = System.getProperty("file.separator");
if (DebugFile.trace) {
DebugFile.writeln("Begin Fi... | true |
898,194 | 74 | 16,954,340 | static void copy(String src, String dest) throws IOException {
File ifp = new File(src);
File ofp = new File(dest);
if (ifp.exists() == false) {
throw new IOException("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream(ifp);
F... | public static boolean copyFile(String sourceFileName, String destFileName) {
if (sourceFileName == null || destFileName == null) return false;
if (sourceFileName.equals(destFileName)) return false;
try {
java.io.FileInputStream in = new java.io.FileInputStream(sourceFileName);
... | true |
898,195 | 9,510,815 | 20,517,803 | public static void copy(File source, File target) {
FileChannel in = null;
FileChannel out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(target).getChannel();
ByteBuffer buffer = ByteBuffer.allocateDirect(BUFFER);
... | 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... | true |
898,196 | 16,797,551 | 14,778,878 | public boolean backup() {
try {
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String currentDBPath = "/data/android.bluebox/databases/bluebox.db";
String backupDBPath =... | public void copyFile(String oldPathFile, String newPathFile) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPathFile);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPathFile);
FileO... | true |
898,197 | 2,668,863 | 11,673,911 | public static boolean encodeFileToFile(final String infile, final 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(infil... | private void _save(ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form) throws Exception {
List list = (List) req.getAttribute(WebKeys.LANGUAGE_MANAGER_LIST);
for (int i = 0; i < list.size(); i++) {
long langId = ((Language) list.get(i)).getId();
try ... | true |
898,198 | 4,525,216 | 20,051,892 | private static void backupFile(File file) {
FileChannel in = null, out = null;
try {
if (!file.getName().endsWith(".bak")) {
in = new FileInputStream(file).getChannel();
out = new FileOutputStream(new File(file.toString() + ".bak")).getChannel();
... | public String fileUpload(final ResourceType type, final String currentFolder, final String fileName, final InputStream inputStream) throws InvalidCurrentFolderException, WriteException {
String absolutePath = getRealUserFilesAbsolutePath(RequestCycleHandler.getUserFilesAbsolutePath(ThreadLocalData.getReques... | true |
898,199 | 23,299,439 | 19,251,429 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String contentType = req.getParameter("type");
String arg = req.getParameter("file");
if (arg == null) {
resp.sendError(404, "Missing File Arg");
... | private static void addFile(File file, ZipArchiveOutputStream zaos) throws IOException {
String filename = null;
filename = file.getName();
ZipArchiveEntry zae = new ZipArchiveEntry(filename);
zae.setSize(file.length());
zaos.putArchiveEntry(zae);
FileInputStream fis ... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.