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 |
|---|---|---|---|---|---|
1,400 | 15,527,452 | 20,192,098 | public static void copy(File source, File dest) throws IOException {
if (dest.isDirectory()) {
dest = new File(dest + File.separator + source.getName());
}
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out ... | public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException {
if (log.isTraceEnabled()) log.trace("Read input stream with metadata=" + metadata);
Integer resCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
String resMessage = (Strin... | true |
1,401 | 557,734 | 11,825,739 | public void constructAssociationView() {
String className;
String methodName;
String field;
boolean foundRead = false;
boolean foundWrite = false;
boolean classWritten = false;
try {
AssocView = new BufferedWriter(new FileWriter("InfoFiles/Associat... | public static void copyFile(String from, String to, boolean append) throws IOException {
FileChannel in = new FileInputStream(from).getChannel();
FileChannel out = new FileOutputStream(to, append).getChannel();
ByteBuffer buffer = ByteBuffer.allocate(BSIZE);
while (in.read(buffer) !=... | true |
1,402 | 19,867,423 | 8,166,293 | @Test
public void testPersistor() throws Exception {
PreparedStatement ps;
ps = connection.prepareStatement("delete from privatadresse");
ps.executeUpdate();
ps.close();
ps = connection.prepareStatement("delete from adresse");
ps.executeUpdate();
ps.close(... | 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 |
1,403 | 23,047,157 | 5,428,177 | @Override
public void run() {
long timeout = 10 * 1000L;
long start = (new Date()).getTime();
try {
InputStream is = socket.getInputStream();
boolean available = false;
while (!available && !socket.isClosed()) {
... | public void invoke() throws IOException {
String[] command = new String[files.length + options.length + 2];
command[0] = chmod;
System.arraycopy(options, 0, command, 1, options.length);
command[1 + options.length] = perms;
for (int i = 0; i < files.length; i++) {
... | true |
1,404 | 14,638,789 | 19,682,242 | public static InputStream sendReq(String url, String content, ConnectData data) {
try {
URLConnection con = new URL(url).openConnection();
con.setConnectTimeout(TIMEOUT);
con.setReadTimeout(TIMEOUT);
con.setUseCaches(false);
setUA(con);
... | private boolean getRemoteFiles() throws Exception {
boolean resp = false;
int respCode = 0;
URL url = new URL(storageUrlString);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
RequestUtils requestUtils = new RequestUtils();
requestUtil... | false |
1,405 | 6,780,166 | 7,158,123 | public static void copyFile(File source, File destination) {
if (!source.exists()) {
return;
}
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
destination.getParentFile().mkdirs();
}
try {
FileChannel... | public void truncateLog(long finalZxid) throws IOException {
long highestZxid = 0;
for (File f : dataDir.listFiles()) {
long zxid = isValidSnapshot(f);
if (zxid == -1) {
LOG.warn("Skipping " + f);
continue;
}
if (zxid > ... | true |
1,406 | 2,831,663 | 2,459,317 | public void onMessage(Message message) {
LOG.debug("onMessage");
DownloadMessage downloadMessage;
try {
downloadMessage = new DownloadMessage(message);
} catch (JMSException e) {
LOG.error("JMS error: " + e.getMessage(), e);
return;
}
... | @Test
public void testStandardTee() throws Exception {
final byte[] test = "test".getBytes();
final InputStream source = new ByteArrayInputStream(test);
final ByteArrayOutputStream destination1 = new ByteArrayOutputStream();
final ByteArrayOutputStream destination2 = new ByteArra... | true |
1,407 | 7,680,527 | 1,717,055 | 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 ActionForward dbExecute(ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse) throws DatabaseException {
SubmitRegistrationForm newUserData = (SubmitRegistrationForm) pForm;
if (!newUserData.getAcceptsEULA()) {
pRequest.setAttribute(... | true |
1,408 | 7,263,928 | 7,839,811 | 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... | public static String md5(String input) {
byte[] temp;
try {
MessageDigest messageDigest;
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(input.getBytes());
temp = messageDigest.digest();
} catch (Exception e) {
... | false |
1,409 | 18,115,314 | 17,750,515 | 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... | public SukuData updatePerson(String usertext, SukuData req) {
String insPers;
String userid = Utils.toUsAscii(usertext);
if (userid != null && userid.length() > 16) {
userid = userid.substring(0, 16);
}
StringBuilder sb = new StringBuilder();
sb.append("in... | false |
1,410 | 9,627,687 | 848,240 | private boolean isReservaOK(String urlAddress, String operationId, String idioma, String codigo_pedido, String merchantId) throws ServletException {
StringBuffer buf = new StringBuffer();
try {
URL url = new URL(urlAddress + "?Num_operacion=" + operationId + "&Idioma=" + idioma + "&Codig... | 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 |
1,411 | 1,854,052 | 16,000,121 | @Before
public void setUp() throws Exception {
configureSslSocketConnector();
SecurityHandler securityHandler = createBasicAuthenticationSecurityHandler();
HandlerList handlerList = new HandlerList();
handlerList.addHandler(securityHandler);
handlerList.addHandler(new Abs... | public void invoke(InputStream is) throws AgentException {
try {
addHeader("Content-Type", "application/zip");
addHeader("Content-Length", String.valueOf(is.available()));
connection.setDoOutput(true);
connection.connect();
OutputStream os = connec... | true |
1,412 | 5,636,184 | 661 | public static Element postMessage() throws Exception {
final URL theUrl = getHostURL();
lf.debug("url = " + theUrl.toExternalForm());
final HttpURLConnection urlConn = (HttpURLConnection) (theUrl).openConnection();
urlConn.setRequestMethod("POST");
urlConn.setDoInput(true);
... | 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 |
1,413 | 5,402,254 | 10,095,870 | public void setKey(String key) {
MessageDigest md5;
byte[] mdKey = new byte[32];
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(key.getBytes());
byte[] digest = md5.digest();
System.arraycopy(digest, 0, mdKey, 0, 16);
Syst... | public String getMD5String(String par1Str) {
try {
String s = (new StringBuilder()).append(field_27370_a).append(par1Str).toString();
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(s.getBytes(), 0, s.length());
return (new... | true |
1,414 | 15,507,613 | 13,325,917 | @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
int i;
String dicomURL = request.getParameter("datasetURL");
String c... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getCanonicalPath());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getCanonicalP... | false |
1,415 | 7,781,594 | 9,075,137 | @Override
protected IStatus runCancelableRunnable(IProgressMonitor monitor) {
IStatus returnValue = Status.OK_STATUS;
monitor.beginTask(NLS.bind(Messages.SaveFileOnDiskHandler_SavingFiles, open), informationUnitsFromExecutionEvent.size());
... | public boolean implies(Permission permission) {
if (!permissionClass.isInstance(permission)) {
return false;
}
GCFPermission perm = (GCFPermission) permission;
int perm_low = perm.getMinPort();
int perm_high = perm.getMaxPort();
Enumeration search = permis... | false |
1,416 | 2,716,763 | 20,514,960 | public void saveUploadFile(String toFileName, UploadFile uploadFile, SysConfig sysConfig) throws IOException {
OutputStream bos = new FileOutputStream(toFileName);
IOUtils.copy(uploadFile.getInputStream(), bos);
if (sysConfig.isAttachImg(uploadFile.getFileName()) && sysConfig.getReduceAttach... | static JSONObject executeMethod(HttpClient httpClient, HttpMethod method, int timeout) throws HttpRequestFailureException, HttpException, IOException, HttpRequestTimeoutException {
try {
method.getParams().setSoTimeout(timeout * 1000);
int status = -1;
JSONObject result =... | true |
1,417 | 13,026,685 | 83,802 | public DoSearch(String searchType, String searchString) {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerDoSearch";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "search.xml";
try {
String urldata = urlString + "?user... | private void doTask() {
try {
log("\n\n\n\n\n\n\n\n\n");
log(" =================================================");
log(" = Starting PSCafePOS =");
log(" =================================================");
log(" = An o... | true |
1,418 | 19,136,768 | 16,055,802 | public static void main(String[] args) {
CookieManager cm = new CookieManager();
try {
URL url = new URL("http://www.hccp.org/test/cookieTest.jsp");
URLConnection conn = url.openConnection();
conn.connect();
cm.storeCookies(conn);
System.ou... | 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... | false |
1,419 | 21,354,223 | 7,231,926 | public String kodetu(String testusoila) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(testusoila.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
new MezuLeiho("Ez da zifraketa algoritmoa aurkitu", "Ados", "Zif... | public static PipeID getPipeIDForService(ServiceDescriptor descriptor) {
PipeID id = null;
URI uri = descriptor.getUri();
if (uri != null) {
try {
id = (PipeID) IDFactory.fromURI(uri);
} catch (URISyntaxException e) {
throw new RuntimeE... | true |
1,420 | 17,335,375 | 9,355,156 | public static byte[] encrypt(String x) throws NoSuchAlgorithmException {
MessageDigest d = null;
d = MessageDigest.getInstance("SHA-1");
d.reset();
d.update(x.getBytes());
return d.digest();
}
| public void addScanURL(final URL url) {
if (url == null) throw new NullArgumentException();
try {
url.openConnection().connect();
} catch (IOException e) {
e.printStackTrace();
}
urlList.add(url);
}
| false |
1,421 | 15,999,201 | 18,465,677 | @Override
public void downloadByUUID(final UUID uuid, final HttpServletRequest request, final HttpServletResponse response) throws IOException {
if (!exportsInProgress.containsKey(uuid)) {
throw new IllegalStateException("No download with UUID: " + uuid);
}
final File compres... | public void download(RequestContext ctx) throws IOException {
if (ctx.isRobot()) {
ctx.forbidden();
return;
}
long id = ctx.id();
File bean = File.INSTANCE.Get(id);
if (bean == null) {
ctx.not_found();
return;
}
... | true |
1,422 | 6,233,042 | 11,519,124 | public static void copyFile(File src, File dest, boolean force) throws IOException, InterruptedIOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file!");
}
}
... | protected static void copyFile(File in, File out) throws IOException {
java.io.FileWriter filewriter = null;
java.io.FileReader filereader = null;
try {
filewriter = new java.io.FileWriter(out);
filereader = new java.io.FileReader(in);
char[] buf = new cha... | true |
1,423 | 17,212,288 | 11,163,692 | private void copyFile(File source, File destination) throws IOException {
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = new FileInputStream(source);
fileOutputStream = new FileOutputStream(destination);
... | public static void transfer(File src, File dest, boolean removeSrc) throws FileNotFoundException, IOException {
Log.warning("source: " + src);
Log.warning("dest: " + dest);
if (!src.canRead()) {
throw new IOException("can not read src file: " + src);
}
if (!dest.g... | true |
1,424 | 47,756 | 19,582,152 | 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... | private void copyFile(File source, File target) throws IOException {
FileChannel srcChannel = new FileInputStream(source).getChannel();
FileChannel dstChannel = new FileOutputStream(target).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
... | true |
1,425 | 9,913,187 | 10,350,952 | protected static String encodePassword(String raw_password) throws DatabaseException {
String clean_password = validatePassword(raw_password);
try {
MessageDigest md = MessageDigest.getInstance(DEFAULT_PASSWORD_DIGEST);
md.update(clean_password.getBytes(DEFAULT_PASSWORD_ENCOD... | public synchronized String encrypt(String plaintext) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new Exception(e.getMessage());
}
try {
md.update(plai... | true |
1,426 | 8,951,478 | 8,389,315 | private void jbInit() throws Exception {
getContentPane().setLayout(borderLayout1);
this.setTitle("�ϥλ���");
jTextPane1.setEditable(false);
this.getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
jScrollPane1.getViewport().add(jTextPane1);
this.setSize(... | 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();
}
| false |
1,427 | 10,689,659 | 15,700,440 | public static void copyFile(File fromFile, File toFile) throws OWFileCopyException {
try {
FileChannel src = new FileInputStream(fromFile).getChannel();
FileChannel dest = new FileOutputStream(toFile).getChannel();
dest.transferFrom(src, 0, src.size());
src.cl... | 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... | false |
1,428 | 16,981,230 | 15,821,341 | public static String encrypt(final String password, final String algorithm, final byte[] salt) {
final StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented"... | public void update() {
try {
String passwordMD5 = new String();
if (this.password != null && this.password.length() > 0) {
MessageDigest md = MessageDigest.getInstance("md5");
md.update(this.password.getBytes());
byte[] digest = md.dige... | true |
1,429 | 6,850,521 | 7,518,608 | @SuppressWarnings({ "ProhibitedExceptionDeclared" })
public int run(@NotNull final List<String> args) throws Exception {
int returnCode = 0;
if (args.size() == 0) {
log(Level.SEVERE, "noarguments");
returnCode++;
}
final byte[] buf = new byte[BUF_SIZE];
... | private ArrayList<String> getYearsAndMonths() {
String info = "";
ArrayList<String> items = new ArrayList<String>();
try {
obtainServerFilesView.setLblProcessText(java.util.ResourceBundle.getBundle("bgpanalyzer/resources/Bundle").getString("ObtainServerFilesView.Label.Progress.Ob... | false |
1,430 | 16,663,549 | 17,891,160 | private void prepareQueryResultData(ZipEntryRef zer, String nodeDir, String reportDir, Set<ZipEntryRef> statusZers) throws Exception {
String jobDir = nodeDir + File.separator + "job_" + zer.getUri();
if (!WorkDirectory.isWorkingDirectoryValid(jobDir)) {
throw new Exception("Cannot acces... | public void testBeAbleToDownloadAndUpload() throws IOException {
OutputStream outputStream = fileSystem.createOutputStream(_("hello"), OutputMode.OVERWRITE);
outputStream.write(new byte[] { 1, 2, 3 });
outputStream.close();
InputStream inputStream = fileSystem.createInputStream(_("he... | true |
1,431 | 1,035,597 | 16,908,849 | private Concept fetchDataNeeded(String conceptUri) {
if (cache.size() > MAX_CACHE) cache.clear();
if (cache.containsKey(conceptUri)) return this.cache.get(conceptUri);
try {
URL url = new URL(conceptUri);
HttpURLConnection connection = (HttpURLConnection) url.openConn... | public static void changeStructure(double version) throws DException {
try {
Class cl = Class.forName("com.daffodilwoods.daffodildb.server.datadictionarysystem.SystemTablesCreator");
java.net.URL urlw = cl.getResource("/com/daffodilwoods/daffodildb/server/datadictionarysystem/systemt... | false |
1,432 | 15,410,299 | 20,177,224 | public boolean isValid(WizardContext context) {
if (serviceSelection < 0) {
return false;
}
ServiceReference selection = (ServiceReference) serviceList.getElementAt(serviceSelection);
if (selection == null) {
return false;
}
String function = (... | public static String encryptPassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
byte[] hash = md.digest();
int hashLength = hash.length;
StringBuffer hashStringBuf = new StringBuffe... | false |
1,433 | 11,514,180 | 18,666,210 | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | public void executeRequest(OperationContext context) throws Throwable {
long t1 = System.currentTimeMillis();
GetPortrayMapCapabilitiesParams params = context.getRequestOptions().getGetPortrayMapCapabilitiesOptions();
String srvCfg = context.getRequestContext().getApplicationConfiguration().... | false |
1,434 | 15,698,947 | 3,189,657 | protected InputStream getInputStream(URL url) {
InputStream is = null;
if (url != null) {
try {
is = url.openStream();
} catch (Exception ex) {
}
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if... | protected InputStream openStreamInternal(String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException {
if (stream != null) return stream;
hasBeenOpened = true;
URL url = null;
try {
url = buildURL();
} catch (MalformedURLException mue) {
... | false |
1,435 | 7,407,182 | 20,164,979 | public static void redirect(String strRequest, PrintWriter sortie) throws Exception {
String level = "info.";
if (ConnectorServlet.debug) level = "debug.";
Log log = LogFactory.getLog(level + "fr.brgm.exows.gml2gsml.GFI");
URL url2Request = new URL(strRequest);
URLConnection ... | private void handleUpload(CommonsMultipartFile file, String newFileName, String uploadDir) throws IOException, FileNotFoundException {
File dirPath = new File(uploadDir);
if (!dirPath.exists()) {
dirPath.mkdirs();
}
InputStream stream = file.getInputStream();
Outp... | false |
1,436 | 11,433,309 | 23,582,992 | 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 int doCheck(URL url) throws IOException {
long start = (System.currentTimeMillis());
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
}
in.close();
long end ... | false |
1,437 | 888,827 | 23,227,325 | 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 String getUniqueId() {
String digest = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String timeVal = "" + (System.currentTimeMillis() + 1);
String localHost = "";
;
try {
localHost = InetAddress.getL... | false |
1,438 | 13,826,024 | 7,068,381 | public static void copyFile(String source, String destination, boolean overwrite) {
File sourceFile = new File(source);
try {
File destinationFile = new File(destination);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(sourceFile));
Buffered... | public static void main(String argv[]) {
try {
if (argv.length != 1 && argv.length != 3) {
usage();
System.exit(1);
}
URL url = new URL(argv[0]);
URLConnection conn;
conn = url.openConnection();
if (conn.... | false |
1,439 | 18,560,649 | 1,168,512 | private static final void addFile(ZipArchiveOutputStream os, File file, String prefix) throws IOException {
ArchiveEntry entry = os.createArchiveEntry(file, file.getAbsolutePath().substring(prefix.length() + 1));
os.putArchiveEntry(entry);
FileInputStream fis = new FileInputStream(file);
... | protected Resolver queryResolver(String resolver, String command, String arg1, String arg2) {
InputStream iStream = null;
String RFC2483 = resolver + "?command=" + command + "&format=tr9401&uri=" + arg1 + "&uri2=" + arg2;
String line = null;
try {
URL url = new URL(RFC248... | false |
1,440 | 17,402,775 | 17,891,162 | public String getResourceAsString(String name) throws IOException {
String content = null;
InputStream stream = aClass.getResourceAsStream(name);
if (stream != null) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
IOUtils.copyAndClose(stream, buffer);
... | public void testAllowClosingInputStreamTwice() throws IOException {
OutputStream outputStream = fileSystem.createOutputStream(_("hello"), OutputMode.OVERWRITE);
outputStream.write(new byte[] { 1, 2, 3 });
outputStream.close();
InputStream inputStream = fileSystem.createInputStream(_(... | true |
1,441 | 5,021,563 | 21,438,070 | private String AddAction(ResultSet node, String modo) throws SQLException {
Connection cn = null;
Connection cndef = null;
String schema = boRepository.getDefaultSchemaName(boApplication.getDefaultApplication()).toLowerCase();
try {
cn = this.getRepositoryConnection(p_ctx... | public ProjectDeploymentConfiguration deleteProjectDeploymentConfig(int id) throws AdaptationException {
ProjectDeploymentConfiguration config = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
String query = "SELEC... | true |
1,442 | 11,198,368 | 9,693,857 | static void linkBlocks(File from, File to, int oldLV) throws IOException {
if (!from.isDirectory()) {
if (from.getName().startsWith(COPY_FILE_PREFIX)) {
IOUtils.copyBytes(new FileInputStream(from), new FileOutputStream(to), 16 * 1024, true);
} else {
i... | 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 |
1,443 | 7,636,710 | 21,605,296 | public String getNextSequence(Integer id) throws ApplicationException {
java.sql.PreparedStatement preStat = null;
java.sql.ResultSet rs = null;
boolean noRecordMatch = false;
String prefix = "";
String suffix = "";
Long startID = null;
Integer length = null;
... | public void transport(File file) throws TransportException {
FTPClient client = new FTPClient();
try {
client.connect(getOption("host"));
client.login(getOption("username"), getOption("password"));
client.changeWorkingDirectory(getOption("remotePath"));
... | false |
1,444 | 12,561,424 | 6,190,163 | private boolean copyFile(File file) throws Exception {
destination = new File(ServiceLocator.getSqliteDir(), file.getName());
logger.debug("Writing to: " + destination);
if (destination.exists()) {
Frame.showMessage(ServiceLocator.getText("Error.file.exists") + file.getName(), nu... | public void xtest7() throws Exception {
System.out.println("Lowagie");
FileInputStream inputStream = new FileInputStream("C:/Temp/arquivo.pdf");
PDFBoxManager manager = new PDFBoxManager();
InputStream[] images = manager.toImage(inputStream, "jpeg");
int count = 0;
fo... | true |
1,445 | 17,930,257 | 14,338,365 | public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new ImageFilter());
fc.setFileView(new ImageFileView());
fc.setAccessory(new ImagePreview(fc));
... | private static String simpleCompute(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("utf-8"), 0, text.length());
sha1hash = md.diges... | false |
1,446 | 16,378,626 | 23,250,845 | public static void copy(String pstrFileFrom, String pstrFileTo) {
try {
FileChannel srcChannel = new FileInputStream(pstrFileFrom).getChannel();
FileChannel dstChannel = new FileOutputStream(pstrFileTo).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size(... | private void unzipResource(final String resourceName, final File targetDirectory) throws IOException {
assertTrue(resourceName.startsWith("/"));
final URL resource = this.getClass().getResource(resourceName);
assertNotNull("Expected '" + resourceName + "' not found.", resource);
asse... | true |
1,447 | 17,921,696 | 5,829,114 | private String generateStorageDir(String stringToBeHashed) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(stringToBeHashed.getBytes());
byte[] hashedKey = digest.digest();
return Util.encodeArrayToHexadecimalString(hashedKey);... | private final String encryptPassword(String pass) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
log.log(Level.WARNING, "Error while obtaining decript algorithm", e);
throw new RuntimeExcept... | true |
1,448 | 23,677,116 | 2,532,322 | public static void copyFile3(File srcFile, File destFile) throws IOException {
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
byte[] buf = new byte[1024];
int len;
while((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close(... | 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 |
1,449 | 22,080,747 | 11,892,441 | @Test
public void testCustomerResource() throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
System.out.println("**** CustomerResource No Query params ***");
HttpGet get = new HttpGet("http://localhost:9095/customers");
HttpResponse response = client.execute(ge... | protected void handleUrl(URL url) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String s;
boolean moreResults = false;
while ((s = in.readLine()) != null) {
if (s.indexOf("<h1>Search Results</h1>") > -1) {
... | false |
1,450 | 22,287,078 | 9,446,836 | @Override
List<String> HttpGet(URL url) throws IOException {
List<String> responseList = new ArrayList<String>();
Logger.getInstance().logInfo("HTTP GET: " + url, null, getGatewayId());
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setConnectTimeout(20000)... | 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 (... | false |
1,451 | 18,413,512 | 10,382,288 | public boolean save(String trxName) {
if (m_value == null || (!(m_value instanceof String || m_value instanceof byte[])) || (m_value instanceof String && m_value.toString().length() == 0) || (m_value instanceof byte[] && ((byte[]) m_value).length == 0)) {
StringBuffer sql = new StringBuffer("UPD... | public static void checkForUpdate(String version) {
try {
URL url = new URL(WiimoteWhiteboard.getProperty("updateURL"));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
final String current = in.readLine();
if (compare(version,... | false |
1,452 | 7,726,775 | 11,617,413 | public void write(URL exportUrl, OutputStream output) throws Exception {
if (exportUrl == null || output == null) {
throw new DocumentListException("null passed in for required parameters");
}
MediaContent mc = new MediaContent();
mc.setUri(exportUrl.toString());
... | private boolean postCorrecao() {
boolean valido = false;
Integer newCodCorrecao = null;
String sqlmaxac = "SELECT MAX(SEQAC) FROM PPOPACAOCORRET WHERE CODEMP=? AND CODFILIAL=? AND CODOP=? AND SEQOP=?";
String sqlmaxcq = "SELECT MAX(SEQOPCQ) + 1 FROM PPOPCQ WHERE CODEMP=? AND CODFILIA... | false |
1,453 | 6,740,469 | 11,370,967 | private void copyFile(String sourceFilename, String destDirname) throws BuildException {
log("Copying file " + sourceFilename + " to " + destDirname);
File destFile = getDestFile(sourceFilename, destDirname);
InputStream inStream = null;
OutputStream outStream = null;
try {
... | public void copyFile(File in, File out) throws Exception {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
}
| true |
1,454 | 172,460 | 15,035,227 | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | private void initialize() {
StringBuffer license = new StringBuffer();
URL url;
InputStreamReader in;
BufferedReader reader;
String str;
JTextArea textArea;
JButton button;
GridBagConstraints c;
setTitle("mibible License");
setSize(600,... | true |
1,455 | 10,392,922 | 9,339,937 | public static void copyCompletely(InputStream input, OutputStream output) throws IOException {
if ((output instanceof FileOutputStream) && (input instanceof FileInputStream)) {
try {
FileChannel target = ((FileOutputStream) output).getChannel();
FileChannel source... | public FileReader(String filePath, Configuration aConfiguration) throws IOException {
file = new File(URLDecoder.decode(filePath, "UTF-8")).getCanonicalFile();
readerConf = aConfiguration;
if (file.isDirectory()) {
File indexFile = new File(file, "index.php");
File in... | true |
1,456 | 22,327,409 | 11,941,960 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter();
} catch (IOException ex) {
... | String[] openUrlAsList(String address) {
IJ.showStatus("Connecting to " + IJ.URL);
Vector v = new Vector();
try {
URL url = new URL(address);
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
... | false |
1,457 | 14,843,540 | 13,490,977 | @Test
public void shouldDownloadFileUsingPublicLink() throws Exception {
String bucketName = "test-" + UUID.randomUUID();
Service service = new WebClientService(credentials);
service.createBucket(bucketName);
File file = folder.newFile("foo.txt");
FileUtils.writeStringToF... | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
OutputStream output = getOutputStream();
if (cachedContent != null) {
output.write(cachedContent);
} else {
FileInputStream input = new FileInput... | true |
1,458 | 5,775,448 | 21,270,256 | private void writeData(IBaseType dataType, Writer writer) throws XMLStreamException {
InputStream isData;
DataType data = (DataType) baseType;
if (data.isSetInputStream()) {
isData = data.getInputStream();
try {
IOUtils.copy(isData, writer);
... | public static boolean start(RootDoc root) {
Logger log = Logger.getLogger("DocletGenerator");
if (destination == null) {
try {
ruleListenerDef = IOUtils.toString(GeneratorOfXmlSchemaForConvertersDoclet.class.getResourceAsStream("/RuleListenersFragment.xsd"), "UTF-8");
... | true |
1,459 | 1,951,103 | 16,076,390 | private List<File> ungzipFile(File directory, File compressedFile) throws IOException {
List<File> files = new ArrayList<File>();
TarArchiveInputStream in = new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(compressedFile)));
try {
TarArchiveEntry entry = in.getNe... | public static String hash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
... | false |
1,460 | 601,908 | 9,816,122 | 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 Request call() {
InputStream is = null;
try {
if (DEBUG) Log.d(TAG, "Requesting: " + request.uri);
HttpGet httpGet = new HttpGet(request.uri.toString());
httpGet.addHeader("Accept-Encoding", "gzip");
... | false |
1,461 | 21,456,138 | 10,959,933 | @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "getServerCertificates", args = { })
public final void test_getServerCertificates() throws Exception {
try {
URL url = new URL("https://localhost:55555");
HttpsURLConnection connection = (HttpsURLConnection) url.ope... | 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());
... | false |
1,462 | 19,045,087 | 21,519,782 | public static void copyfile(String src, String dst) throws IOException {
dst = new File(dst).getAbsolutePath();
new File(new File(dst).getParent()).mkdirs();
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(dst).getChannel(... | protected static void copyDeleting(File source, File dest) throws ErrorCodeException {
byte[] buf = new byte[8 * 1024];
FileInputStream in = null;
try {
in = new FileInputStream(source);
try {
FileOutputStream out = new FileOutputStream(dest);
... | true |
1,463 | 15,805,163 | 5,138,456 | @Override
public String encodePassword(String rawPass, Object salt) throws DataAccessException {
try {
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
digest.reset();
digest.update(((String) salt).getBytes("UTF-8"));
return new String(di... | public static int save(File inputFile, File outputFile) throws IOException {
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(inputFile);
outputFile.getParentFile().mkdirs();
out = new FileOutputStream(outputFile);
} c... | false |
1,464 | 940,862 | 14,317,426 | 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[... | 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.... | false |
1,465 | 12,760,982 | 21,253,562 | public static String MD5Encode(String password) {
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(password.getBytes());
final byte[] digest = messageDigest.digest();
final StringBuilder buf = ne... | @Override
public void fileUpload(UploadEvent uploadEvent) {
FileOutputStream tmpOutStream = null;
try {
tmpUpload = File.createTempFile("projectImport", ".xml");
tmpOutStream = new FileOutputStream(tmpUpload);
IOUtils.copy(uploadEve... | false |
1,466 | 22,556,551 | 22,670,950 | private void copyOneFile(String oldPath, String newPath) {
File copiedFile = new File(newPath);
try {
FileInputStream source = new FileInputStream(oldPath);
FileOutputStream destination = new FileOutputStream(copiedFile);
FileChannel sourceFileChannel = source.get... | private void writeInputStreamToFile(InputStream stream, File file) {
try {
FileOutputStream fOut = new FileOutputStream(file);
IOUtils.copy(stream, fOut);
fOut.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOExcepti... | true |
1,467 | 5,995,233 | 15,193 | public void postProcess() throws StopWriterVisitorException {
dxfWriter.postProcess();
try {
FileChannel fcinDxf = new FileInputStream(fTemp).getChannel();
FileChannel fcoutDxf = new FileOutputStream(m_Fich).getChannel();
DriverUtilities.copy(fcinDxf, fcoutDxf);
... | 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("Copy: no such source file: " + fromFileName);
if (!fromFile.canRead()) throw... | true |
1,468 | 10,106,324 | 4,201,902 | public static String md5Encode(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes());
return toHexString(md.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return s;
}
... | 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 |
1,469 | 5,271,061 | 586,503 | private void createJarArchive(File archiveFile, List<File> filesToBeJared, File base) throws Exception {
FileOutputStream stream = new FileOutputStream(archiveFile);
JarOutputStream out = new JarOutputStream(stream);
for (File tobeJared : filesToBeJared) {
if (tobeJared == null |... | 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 |
1,470 | 20,789,642 | 11,090,451 | private static String getSignature(String data) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return "FFFFFFFFFFFFFFFF";
}
md.update(data.getBytes());
StringBuffer sb = new StringBuffer(... | public static String md5(String str) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(str.getBytes());
byte messageDigest[] = digest.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; ... | true |
1,471 | 1,966,263 | 13,292,580 | 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 Node external_open_url(Node startAt) throws Exception {
if (inUse) {
throw new InterpreterException(StdErrors.extend(StdErrors.Already_used, "File already open"));
}
inUse = true;
startAt.isGoodArgsLength(false, 2);
ExtURL url = new ExtURL(startAt.getSubNod... | false |
1,472 | 20,826,358 | 20,669,450 | public String generateDigest(String password, String saltHex, String algorithm) throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase("crypt")) {
return "{CRYPT}" + UnixCrypt.crypt(password);
} else if (algorithm.equalsIgnoreCase("sha")) {
algorithm = "SHA-1";
... | private void auth() throws IOException {
authorized = false;
seqNumber = 0;
DatagramSocket ds = new DatagramSocket();
ds.setSoTimeout(UDPHID_DEFAULT_TIMEOUT);
ds.connect(addr, port);
DatagramPacket p = new DatagramPacket(buffer.array(), buffer.capacity());
for... | true |
1,473 | 17,562,349 | 638,175 | public String digestResponse() {
String digest = null;
if (null == nonce) return null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(username.getBytes());
md.update(":".getBytes());
md.update(realm.getBytes());
... | void run(String[] args) {
InputStream istream = System.in;
System.out.println("TradeMaximizer " + version);
String filename = parseArgs(args, false);
if (filename != null) {
System.out.println("Input from: " + filename);
try {
if (filename.star... | true |
1,474 | 22,998,998 | 17,044,285 | public static void copyFile(File sourceFile, File destFile) throws IOException {
FileChannel inputFileChannel = new FileInputStream(sourceFile).getChannel();
FileChannel outputFileChannel = new FileOutputStream(destFile).getChannel();
long offset = 0L;
long length = inputFileChannel.... | @Override
public void run() {
try {
URL url = new URL(this.uri);
String data = "tags=" + this.tags + "&mbox=" + this.mbox + "&_method=put";
HttpURLConnection huc = (HttpURLConnection) url.openConnection();
huc.setRequestMethod("POST");
huc.setD... | false |
1,475 | 14,800,064 | 19,307,122 | protected Set<String> moduleNamesFromReader(URL url) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
Set<String> names = new HashSet<String>();
String line;
while ((line = reader.readLine()) != null) {
line = line.... | public static byte[] sendParamPost(String urlString, String param) {
try {
URL url = new URL(urlString + "?" + param);
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.setDoOutput(true);
urlConn.setDefaultUseCaches(false);
... | false |
1,476 | 7,039,646 | 861,011 | private static final void cloneFile(File origin, File target) throws IOException {
FileChannel srcChannel = null;
FileChannel destChannel = null;
try {
srcChannel = new FileInputStream(origin).getChannel();
destChannel = new FileOutputStream(target).getChannel();
... | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | true |
1,477 | 414,463 | 11,346,792 | 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 generate(FileObject outputDirectory, FileObject generatedOutputDirectory, List<Library> libraryModels, String tapdocXml) throws FileSystemException {
if (!generatedOutputDirectory.exists()) {
generatedOutputDirectory.createFolder();
}
if (outputDirectory.exists()) {
... | true |
1,478 | 9,816,121 | 10,254,165 | private Callable<Request> newRequestCall(final Request request) {
return new Callable<Request>() {
public Request call() {
InputStream is = null;
try {
if (DEBUG) Log.d(TAG, "Requesting: " + request.uri);
HttpGet httpGet = ... | public void zipFile(String baseDir, String fileName, boolean encrypt) throws Exception {
List fileList = getSubFiles(new File(baseDir));
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(fileName + ".temp"));
ZipEntry ze = null;
byte[] buf = new byte[BUFFER];
byt... | false |
1,479 | 20,250,217 | 19,747,820 | private byte[] getBytesFromUrl(URL url) {
ByteArrayOutputStream bais = new ByteArrayOutputStream();
InputStream is = null;
try {
is = url.openStream();
byte[] byteChunk = new byte[4096];
int n;
while ((n = is.read(byteChunk)) > 0) {
... | public String parse(String term) throws OntologyAdaptorException {
try {
String sUrl = getUrl(term);
if (sUrl.length() > 0) {
URL url = new URL(sUrl);
InputStream in = url.openStream();
StringBuilder sb = new StringBuilder();
... | false |
1,480 | 8,535,390 | 15,854,397 | public static File doRequestPost(URL url, String req, String fName, boolean override) throws ArcImsException {
File f = null;
URL virtualUrl = getVirtualRequestUrlFromUrlAndRequest(url, req);
if ((f = getPreviousDownloadedURL(virtualUrl, override)) == null) {
File tempDirectory =... | public static Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileIn... | false |
1,481 | 8,258,909 | 11,517,213 | public static void copyFile(File sourceFile, File destFile) {
FileChannel source = null;
FileChannel destination = null;
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
source = new FileInputStream(sourceFile).getChannel();
... | private static void copyFile(File sourceFile, File destFile) {
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream... | true |
1,482 | 12,524,253 | 6,424,563 | public DialogSongList(JFrame frame) {
super(frame, "Menu_SongList", "songList");
setMinimumSize(new Dimension(400, 200));
JPanel panel, spanel;
Container contentPane;
(contentPane = getContentPane()).add(songSelector = new SongSelector(configKey, null, true));
songSel... | public static Element retrieveFromCache(String cacheName, Object key) {
URL url = null;
HttpURLConnection connection = null;
InputStream is = null;
OutputStream os = null;
int result = 0;
StringBuilder sb = null;
Element cacheElement = null;
try {
... | false |
1,483 | 7,901,588 | 6,992,704 | public static long removePropertyInOpenXMLDocument(String ext, InputStream in, OutputStreamProvider outProvider, String propriete) {
in = new BufferedInputStream(in);
try {
File tempPptx = null;
POIXMLDocument doc;
if (ext.toLowerCase().equals("docx")) {
... | public static void main(String[] args) {
File file = null;
try {
file = File.createTempFile("TestFileChannel", ".dat");
final ByteBuffer buffer = ByteBuffer.allocateDirect(4);
final ByteChannel output = new FileOutputStream(file).getChannel();
buffer.p... | true |
1,484 | 2,857,623 | 15,460,365 | private void copy(File src, File dest, String name) {
File srcFile = new File(src, name);
File destFile = new File(dest, name);
if (destFile.exists()) {
if (destFile.lastModified() == srcFile.lastModified()) return;
destFile.delete();
}
FileChannel in ... | private String calculateMD5(String value) {
String finalString;
try {
MessageDigest md5Alg = MessageDigest.getInstance("MD5");
md5Alg.reset();
md5Alg.update(value.getBytes());
byte messageDigest[] = md5Alg.digest();
StringBuilder hexString ... | false |
1,485 | 132,551 | 6,865,572 | public void createBankSignature() {
byte b;
try {
_bankMessageDigest = MessageDigest.getInstance("MD5");
_bankSig = Signature.getInstance("MD5/RSA/PKCS#1");
_bankSig.initSign((PrivateKey) _bankPrivateKey);
_bankMessageDigest.update(getBankString().getB... | 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 |
1,486 | 6,171,405 | 586,503 | public static File createGzip(File inputFile) {
File targetFile = new File(inputFile.getParentFile(), inputFile.getName() + ".gz");
if (targetFile.exists()) {
log.warn("The target file '" + targetFile + "' already exists. Will overwrite");
}
FileInputStream in = null;
... | 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 |
1,487 | 13,997,019 | 21,792,245 | public String read(String url) throws IOException {
URL myurl = new URL(url);
BufferedReader in = new BufferedReader(new InputStreamReader(myurl.openStream()));
StringBuffer sb = new StringBuffer();
String inputLine;
while ((inputLine = in.readLine()) != null) sb.append(input... | public static String[] retrieveFasta(String id) throws Exception {
URL url = new URL("http://www.uniprot.org/uniprot/" + id + ".fasta");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String header = reader.readLine();
StringBuffer seq = new Stri... | true |
1,488 | 1,949,890 | 320,979 | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
req.setCharacterEncoding("UTF-8");
resp.setContentType(req.getContentType());
IOUtils.copy(req.getReader(), resp.getWriter());
}
| 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 |
1,489 | 8,085,496 | 6,747,095 | public MemoryBinaryBody(InputStream is) throws IOException {
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(is, out);
out.close();
tempFile = out.toByteArray();
}
| public void notifyTerminated(Writer r) {
all_writers.remove(r);
if (all_writers.isEmpty()) {
all_terminated = true;
Iterator iterator = open_files.iterator();
while (iterator.hasNext()) {
FileWriter.FileChunk fc = (FileWriter.FileChunk) iterator.ne... | true |
1,490 | 16,082,064 | 15,607,084 | public static void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
... | protected void copyFile(String inputFilePath, String outputFilePath) throws GenerationException {
String from = getTemplateDir() + inputFilePath;
try {
logger.debug("Copying from " + from + " to " + outputFilePath);
InputStream inputStream = Thread.currentThread().getContextC... | true |
1,491 | 5,444,166 | 12,561,704 | public static Image readImage(URL url, ImageMimeType type, int page) throws IOException {
if (type.javaNativeSupport()) {
return ImageIO.read(url.openStream());
} else if ((type.equals(ImageMimeType.DJVU)) || (type.equals(ImageMimeType.VNDDJVU)) || (type.equals(ImageMimeType.XDJVU))) {
... | private void bubbleSort(int[] mas) {
boolean t = true;
while (t) {
t = false;
for (int i = 0; i < mas.length - 1; i++) {
if (mas[i] > mas[i + 1]) {
int temp = mas[i];
mas[i] = mas[i + 1];
mas[i + 1] =... | false |
1,492 | 23,390,255 | 181,591 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public 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 |
1,493 | 4,960,419 | 2,232,619 | public static boolean writeFileByChars(Reader pReader, File pFile, boolean pAppend) {
boolean flag = false;
try {
FileWriter fw = new FileWriter(pFile, pAppend);
IOUtils.copy(pReader, fw);
fw.flush();
fw.close();
pReader.close();
... | public void testStorageStringWriter() throws Exception {
TranslationResponseInMemory r = new TranslationResponseInMemory(2048, "UTF-8");
{
Writer w = r.getWriter();
w.write("This is an example");
w.write(" and another one.");
w.flush();
ass... | true |
1,494 | 4,781,643 | 18,600,879 | public static void loadConfig(URL urlFile) throws CacheException {
Document document;
try {
document = Utilities.getDocument(urlFile.openStream());
} catch (IOException e) {
throw new CacheException("Could not open '" + urlFile.getFile() + "'", e);
} catch (JA... | public static void copyFile(File input, File output) throws Exception {
FileReader in = new FileReader(input);
FileWriter out = new FileWriter(output);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| false |
1,495 | 22,608,103 | 4,491,298 | public static boolean copyFile(File sourceFile, File destFile) {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
srcChannel = new FileInputStream(sourceFile).getChannel();
dstChannel = new FileOutputStream(destFile).getChannel();
long p... | @Transient
public byte[] getData() {
InputStream is = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
is = urlInstance.openStream();
byte[] bytes = new byte[1024 * 20];
while (is.available() > 0) {
int bytesRead = i... | false |
1,496 | 3,788,557 | 20,412,493 | public synchronized String encrypt(String plaintext) throws Exception {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw e;
}
try {
md.update(plaintext.getBytes("UTF-8"));
... | void readData(URL url) throws IOException {
int i = 0, j = 0, k = 0;
double xvalue, yvalue;
double xindex, yindex;
InputStream is = url.openStream();
is.mark(0);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
... | false |
1,497 | 8,624,822 | 18,457,132 | 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... | private static void copyFile(File src, File dst) throws IOException {
FileChannel in = new FileInputStream(src).getChannel();
FileChannel out = new FileOutputStream(dst).getChannel();
in.transferTo(0, in.size(), out);
in.close();
out.close();
}
| true |
1,498 | 20,023,016 | 16,250,771 | private void copy(File from, File to) throws IOException {
InputStream in = new FileInputStream(from);
OutputStream out = new FileOutputStream(to);
byte[] line = new byte[16384];
int bytes = -1;
while ((bytes = in.read(line)) != -1) out.write(line, 0, bytes);
in.close... | public static String genDigest(String info) {
MessageDigest alga;
byte[] digesta = null;
try {
alga = MessageDigest.getInstance("SHA-1");
alga.update(info.getBytes());
digesta = alga.digest();
} catch (NoSuchAlgorithmException e) {
e.pr... | false |
1,499 | 12,049,266 | 17,187,738 | private FTPClient getFTPConnection(String strUser, String strPassword, String strServer, boolean binaryTransfer, String connectionNote, boolean passiveMode) {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(strServer);
ResourcePool.LogMessage(this, R... | public Music(URL url, boolean streamingHint) throws SlickException {
SoundStore.get().init();
String ref = url.getFile();
try {
if (ref.toLowerCase().endsWith(".ogg")) {
if (streamingHint) {
sound = SoundStore.get().getOggStream(url);
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.