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 |
|---|---|---|---|---|---|
900,400 | 10,826,994 | 7,518,607 | public static void copyFile(File in, File out) throws EnhancedException {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), des... | private ArrayList<String> getFiles(String date) {
ArrayList<String> files = new ArrayList<String>();
String info = "";
try {
obtainServerFilesView.setLblProcessText(java.util.ResourceBundle.getBundle("bgpanalyzer/resources/Bundle").getString("ObtainServerFilesView.Label.Progress.... | false |
900,401 | 10,386,966 | 21,343,573 | private ByteBuffer getByteBuffer(String resource) throws IOException {
ClassLoader classLoader = this.getClass().getClassLoader();
InputStream in = classLoader.getResourceAsStream(resource);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, out);
retur... | private static String getProviderName(URL url, PrintStream err) {
InputStream in = null;
try {
in = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
String result = null;
while (true) {
S... | false |
900,402 | 6,371,595 | 12,214,439 | public void setUserPassword(final List<NewUser> users) {
try {
final List<Integer> usersToRemoveFromCache = new ArrayList<Integer>();
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
... | public boolean saveNote(NoteData n) {
String query;
try {
conn.setAutoCommit(false);
Statement stmt = null;
ResultSet rset = null;
stmt = conn.createStatement();
query = "select * from notes where noteid = " + n.getID();
rset = ... | true |
900,403 | 14,770,723 | 11,771,875 | public static boolean copyFile(File dest, File source) {
FileInputStream fis = null;
FileOutputStream fos = null;
boolean rv = false;
byte[] buf = new byte[1000000];
int bytesRead = 0;
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
try {
... | private synchronized jdbcResultSet executeHTTP(String s) throws SQLException {
byte result[];
try {
URL url = new URL(sConnect);
String p = StringConverter.unicodeToHexString(sUser);
p += "+" + StringConverter.unicodeToHexString(sPassword);
p += "+" + ... | false |
900,404 | 21,977,773 | 14,711,051 | public void run() {
try {
if (useStream || inputStream != null) {
InputStream inputStream = null;
if (LoadDocumentOperation.this.inputStream != null) inputStream = LoadDocumentOperation.this.inputStream; else inputStream = url.openStream();
... | public static void copyFile(final File in, final File out) throws IOException {
final FileChannel inChannel = new FileInputStream(in).getChannel();
final FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
... | false |
900,405 | 6,980,854 | 4,047,586 | public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in... | public static void toValueSAX(Property property, Value value, int valueType, ContentHandler contentHandler, AttributesImpl na, Context context) throws SAXException, RepositoryException {
na.clear();
String _value = null;
switch(valueType) {
case PropertyType.DATE:
... | true |
900,406 | 6,270,867 | 14,284,458 | 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... | private String md5(String txt) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(txt.getBytes(), 0, txt.length());
return new BigInteger(1, m.digest()).toString(16);
} catch (Exception e) {
return "BAD MD5";
}
}
| true |
900,407 | 19,172,383 | 11,730,227 | public void readEntry(String name, InputStream input) throws Exception {
File file = new File(this.directory, name);
OutputStream output = new BufferedOutputStream(FileUtils.openOutputStream(file));
try {
org.apache.commons.io.IOUtils.copy(input, output);
... | private void copy(File source, File target) throws IOException {
FileChannel in = (new FileInputStream(source)).getChannel();
FileChannel out = (new FileOutputStream(target)).getChannel();
in.transferTo(0, source.length(), out);
in.close();
out.close();
}
| true |
900,408 | 4,340,712 | 7,847,812 | public static Map<VariableLengthInteger, ElementDescriptor> readDescriptors(URL url) throws IOException, XMLStreamException {
if (url == null) {
throw new IllegalArgumentException("url is null");
}
InputStream stream = new BufferedInputStream(url.openStream());
try {
... | protected synchronized void doLogin(long timeout, String eventMask) throws IOException, AuthenticationFailedException, TimeoutException {
ChallengeAction challengeAction;
ManagerResponse challengeResponse;
String challenge;
String key;
LoginAction loginAction;
Manager... | false |
900,409 | 7,911,395 | 18,142,979 | public void executaAlteracoes() {
Album album = Album.getAlbum();
Photo[] fotos = album.getFotos();
Photo f;
int ultimoFotoID = -1;
int albumID = album.getAlbumID();
sucesso = true;
PainelWebFotos.setCursorWait(true);
albumID = recordAlbumData(album, a... | private String copyTutorial() throws IOException {
File inputFile = new File(getFilenameForOriginalTutorial());
File outputFile = new File(getFilenameForCopiedTutorial());
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
w... | true |
900,410 | 9,593,609 | 10,942,052 | public static void main(String[] args) throws Exception {
File rootDir = new File("C:\\dev\\workspace_fgd\\gouvqc_crggid\\WebContent\\WEB-INF\\upload");
File storeDir = new File(rootDir, "storeDir");
File workDir = new File(rootDir, "workDir");
LoggerFacade loggerFacade = new Commons... | public static void copy(String from, String to) throws Exception {
File inputFile = new File(from);
File outputFile = new File(to);
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outputFile);
byte[] buffer = new byte[1024];
... | true |
900,411 | 13,862,028 | 7,214,727 | public static void main(String[] args) {
try {
String completePath = null;
String predictionFileName = null;
if (args.length == 2) {
completePath = args[0];
predictionFileName = args[1];
} else {
System.out.print... | public byte[] pipeBytes() {
byte ba[] = null;
try {
URL url = new URL(server);
conn = (HttpURLConnection) url.openConnection();
InputStream is = conn.getInputStream();
ByteArrayOutputStream tout = new ByteArrayOutputStream();
int nmax = 100... | false |
900,412 | 13,020,691 | 5,391,696 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
}
try {
long time = System.currentTi... | public static StringBuffer getCachedFile(String url) throws Exception {
File urlCache = new File("tmp-cache/" + url.replace('/', '-'));
new File("tmp-cache/").mkdir();
if (urlCache.exists()) {
BufferedReader in = new BufferedReader(new FileReader(urlCache));
StringBuf... | false |
900,413 | 17,374,912 | 20,368,648 | public void copyTo(File folder) {
if (!isNewFile()) {
return;
}
if (!folder.exists()) {
folder.mkdir();
}
File dest = new File(folder, name);
try {
FileInputStream in = new FileInputStream(cur... | private void copyFile(File in, File out) {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | true |
900,414 | 19,090,291 | 9,068,428 | public static String extractIconPath(String siteURL) throws IOException {
siteURL = siteURL.trim();
if (!siteURL.startsWith("http://")) {
siteURL = "http://" + siteURL;
}
URL url = new URL(siteURL);
BufferedReader in = new BufferedReader(new InputStreamReader(url.... | public static String getTextFileFromURL(String urlName) {
try {
StringBuffer textFile = new StringBuffer("");
String line = null;
URL url = new URL(urlName);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
while... | true |
900,415 | 11,664,487 | 330,896 | public static void main(String[] args) throws IOException {
ReadableByteChannel in = Channels.newChannel((new FileInputStream("/home/sannies/suckerpunch-distantplanet_h1080p/suckerpunch-distantplanet_h1080p.mov")));
Movie movie = MovieCreator.build(in);
in.close();
List<Track> tracks... | public static void main(String[] argv) {
if (1 < argv.length) {
File[] sources = Source(argv[0]);
if (null != sources) {
for (File src : sources) {
File[] targets = Target(src, argv);
if (null != targets) {
... | true |
900,416 | 5,620,476 | 23,537,684 | private String[] verifyConnection(Socket clientConnection) throws Exception {
List<String> requestLines = new ArrayList<String>();
InputStream is = clientConnection.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
StringTokenizer st = new StringTok... | public static void copyResourceToFile(Class owningClass, String resourceName, File destinationDir) {
final byte[] resourceBytes = readResource(owningClass, resourceName);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(resourceBytes);
final File destinationFile = new File(d... | true |
900,417 | 11,717,079 | 6,597,125 | void copyFile(File inputFile, File outputFile) {
try {
FileReader in;
in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
... | public static void writeToFile(final File file, final InputStream in) throws IOException {
IOUtils.createFile(file);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
IOUtils.copyStream(in, fos);
} finally {
IOUtils.closeIO(fos);... | true |
900,418 | 369,844 | 21,649,305 | private boolean enregistreToi() {
PrintWriter lEcrivain;
String laDest = "./img_types/" + sonImage;
if (!new File("./img_types").exists()) {
new File("./img_types").mkdirs();
}
try {
FileChannel leFicSource = new FileInputStream(sonFichier).getChannel(... | private String choosePivotVertex() throws ProcessorExecutionException {
String result = null;
Graph src;
Graph dest;
Path tmpDir;
System.out.println("##########>" + _dirMgr.getSeqNum() + " Choose the pivot vertex");
src = new Graph(Graph.defaultGraph());
src.s... | true |
900,419 | 1,811,746 | 5,306,724 | public void testSimpleHttpPostsChunked() throws Exception {
int reqNo = 20;
Random rnd = new Random();
List testData = new ArrayList(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(20000);
byte[] data = new byte[size];
rnd.nextByte... | private void initURL() {
try {
log.fine("Checking: " + locator);
URLConnection conn = URIFactory.url(locator).openConnection();
conn.setUseCaches(false);
log.info(conn.getHeaderFields().toString());
String header = conn.getHeaderField(null);
... | false |
900,420 | 9,209,383 | 5,777,003 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final Map<String, String> fileAttr = new HashMap<String, String>();
boolean download = false;
String dw = req.getParameter("d");
if (StringUtils.isNotEmpty(dw) ... | public void testDecodeJTLM_publish100() throws Exception {
EXISchema corpus = EXISchemaFactoryTestUtil.getEXISchema("/JTLM/schemas/TLMComposite.xsd", getClass(), m_compilerErrors);
Assert.assertEquals(0, m_compilerErrors.getTotalCount());
GrammarCache grammarCache = new GrammarCache(corpus, ... | false |
900,421 | 6,322,440 | 3,050,742 | public static void copyFile(final File fromFile, File toFile) throws IOException {
try {
if (!fromFile.exists()) {
throw new IOException("FileCopy: " + "no such source file: " + fromFile.getAbsoluteFile());
}
if (!fromFile.isFile()) {
throw... | public static String encryptPasswd(String pass) {
try {
if (pass == null || pass.length() == 0) return pass;
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.reset();
sha.update(pass.getBytes("UTF-8"));
return Base64OutputStream.encode(s... | false |
900,422 | 14,007,786 | 21,750,583 | @Override
protected IStatus run(IProgressMonitor monitor) {
final int BUFFER_SIZE = 1024;
final int DISPLAY_BUFFER_SIZE = 8196;
File sourceFile = new File(_sourceFile);
File destFile = new File(_destFile);
if (sourceFile.exists()) {
try {
Log.g... | protected void doProxyInternally(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpRequestBase proxyReq = buildProxyRequest(req);
URI reqUri = proxyReq.getURI();
String cookieDomain = reqUri.getHost();
DefaultHttpClient httpClient = new Defau... | true |
900,423 | 11,799,025 | 21,870,537 | @Override
public Document duplicate() {
BinaryDocument b = new BinaryDocument(this.name, this.content.getContentType());
try {
IOUtils.copy(this.getContent().getInputStream(), this.getContent().getOutputStream());
return b;
} catch (IOException e) {
th... | 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 |
900,424 | 20,081,426 | 592,607 | private static GSP loadGSP(URL url) {
try {
InputStream input = url.openStream();
int c;
while ((c = input.read()) != -1) {
result = result + (char) c;
}
Unmarshaller unmarshaller = getUnmarshaller();
unmarshaller.setVal... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | false |
900,425 | 9,136,261 | 17,398,520 | public void copyFile(String source_name, String dest_name) throws IOException {
File source_file = new File(source_name);
File destination_file = new File(dest_name);
Reader source = null;
Writer destination = null;
char[] buffer;
int bytes_read;
try {
... | public void SendFile(File testfile) {
try {
SocketChannel sock = SocketChannel.open(new InetSocketAddress("127.0.0.1", 1234));
sock.configureBlocking(true);
while (!sock.finishConnect()) {
System.out.println("NOT connected!");
}
Sys... | true |
900,426 | 21,224,683 | 13,067,555 | public void delete(String user) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatemen... | public static String MD5Digest(String source) {
MessageDigest digest;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(source.getBytes("UTF8"));
byte[] hash = digest.digest();
String strHash = byteArrayToHexString(hash);
... | false |
900,427 | 7,781,594 | 6,569,409 | @Override
protected IStatus runCancelableRunnable(IProgressMonitor monitor) {
IStatus returnValue = Status.OK_STATUS;
monitor.beginTask(NLS.bind(Messages.SaveFileOnDiskHandler_SavingFiles, open), informationUnitsFromExecutionEvent.size());
... | public String obfuscateString(String string) {
String obfuscatedString = null;
try {
MessageDigest md = MessageDigest.getInstance(ENCRYPTION_ALGORITHM);
md.update(string.getBytes());
byte[] digest = md.digest();
obfuscatedString = new String(Base64.enc... | false |
900,428 | 12,721,185 | 310,580 | public static int fileUpload(long lngFileSize, InputStream inputStream, String strFilePath, String strFileName) throws IOException {
String SEPARATOR = System.getProperty("file.separator");
if (lngFileSize > (10 * 1024 * 1024)) {
return -1;
}
InputStream is = null;
... | 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 |
900,429 | 5,482,150 | 15,178,715 | private static void writeUrl(String filePath, String data, String charCoding, boolean urlIsFile) throws IOException {
int chunkLength;
OutputStream os = null;
try {
if (!urlIsFile) {
URL urlObj = new URL(filePath);
URLConnection uc = urlObj.openCon... | public static void main(String[] args) throws IOException, DataFormatException {
byte in_buf[] = new byte[20000];
if (args.length < 2) {
System.out.println("too few arguments");
System.exit(0);
}
String inputName = args[0];
InputStream in = new FileInp... | false |
900,430 | 12,267,657 | 6,930,078 | public Reader create(final URI url) throws IOException {
this.url = url;
if (!url.isAbsolute()) {
return new FileReader(new File(url.toString()));
}
URLConnection connection = url.toURL().openConnection();
connection.setDoInput(true);
final InputStream inp... | public void ztest_cluster() throws Exception {
Configuration.init();
TomcatServer ts1 = new TomcatServer();
ts1.registerServlet("/*", TestServlet.class.getName());
ts1.registerCluster(5554);
ts1.start(5555);
TomcatServer ts2 = new TomcatServer();
ts2.registerS... | false |
900,431 | 417,300 | 15,519,967 | 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]... | private void output(HttpServletResponse resp, InputStream is, long length, String fileName) throws Exception {
resp.reset();
String mimeType = "image/jpeg";
resp.setContentType(mimeType);
resp.setContentLength((int) length);
resp.setHeader("Content-Disposition", "inline; file... | true |
900,432 | 8,296,360 | 19,060,603 | public static void copiaAnexos(String from, String to, AnexoTO[] anexoTO) {
FileChannel in = null, out = null;
for (int i = 0; i < anexoTO.length; i++) {
try {
in = new FileInputStream(new File((uploadDiretorio.concat(from)).concat(File.separator + anexoTO[i].getNome())))... | public static void copyFile(File in, File out) throws IOException {
if (in.getCanonicalPath().equals(out.getCanonicalPath())) {
return;
}
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
... | true |
900,433 | 266,571 | 12,214,442 | 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 boolean saveTemplate(Template t) {
try {
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
String query;
ResultSet rset;
if (Integer.parseInt(executeMySQLGet("SELECT COUNT(*) FROM templates WHERE name='" + escapeCharacters(... | true |
900,434 | 21,605,296 | 17,267,680 | 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"));
... | private String transferWSDL(String wsdlURL, String userPassword) throws WiseConnectionException {
String filePath = null;
try {
URL endpoint = new URL(wsdlURL);
HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
conn.setDoOutput(false);
... | false |
900,435 | 18,923,105 | 22,689,223 | public static byte[] read(URL url) throws IOException {
byte[] bytes;
InputStream is = null;
try {
is = url.openStream();
bytes = readAllBytes(is);
} finally {
if (is != null) {
is.close();
}
}
return byt... | @Override
public void testAction(ITestThread testThread) throws Throwable {
try {
final InputStream urlIn = new URL("http://jdistunit.sourceforge.net").openStream();
final int availableBytes = urlIn.available();
if (0 == availableBytes) {
... | false |
900,436 | 888,827 | 20,080,195 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public void restoreDrivers() throws ExplorerException {
try {
drivers.clear();
URL url = URLUtil.getResourceURL("default_drivers.xml");
loadDefaultDrivers(url.openStream());
} catch (IOException e) {
throw new ExplorerException(e);
}
}
| false |
900,437 | 1,312,612 | 19,915,605 | public void initFromXml(final String xmlFileName) throws java.net.MalformedURLException, ConfigurationException, IOException {
if (xmlInitialized) {
return;
}
templates = null;
MergeTemplateWriter.setTokenList(getTokenProvider().getKnownTokens());
java.net.URL url... | public static String Execute(HttpRequestBase httprequest) throws IOException, ClientProtocolException {
httprequest.setHeader("Accept", "application/json");
httprequest.setHeader("Content-type", "application/json");
String result = "";
HttpClient httpclient = new DefaultHttpClient();... | false |
900,438 | 8,924,519 | 12,274,679 | private String grabInformationFromWeb(String query, String infoName) throws Exception {
String result = "";
URL url = new URL(query);
HttpURLConnection request = null;
request = (HttpURLConnection) url.openConnection();
if (request != null) {
InputStream in = url.... | public JSONObject executeJSON(final String path, final JSONObject jsRequest) throws IOException, HttpException, JSONException {
final HttpPost httpRequest = newHttpPost(path);
httpRequest.setHeader("Content-Type", "application/json");
final String request = jsRequest.toString();
http... | false |
900,439 | 9,665,214 | 1,037,402 | public void testConvert() throws IOException, ConverterException {
InputStreamReader reader = new InputStreamReader(new FileInputStream("test" + File.separator + "input" + File.separator + "A0851ohneex.dat"), CharsetUtil.forName("x-PICA"));
FileWriter writer = new FileWriter("test" + File.separator ... | public static final String getContent(String address) {
String content = "";
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
URL url = new URL(address);
out = new ByteArrayOutputStream();
conn = url.openConn... | false |
900,440 | 3,024,980 | 22,728,535 | @Test
public void testCopy_inputStreamToWriter_Encoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new YellOn... | public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new ImageFilter());
fc.setAccessory(new ImagePreview(fc));
int returnVal = fc.showDialog(Administrac... | true |
900,441 | 5,498,222 | 11,312,022 | public static void copyFile(String inputFile, String outputFile) throws IOException {
FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
for (int b = fis.read(); b != -1; b = fis.read()) fos.write(b);
fos.close();
fi... | public static void downloadFromUrl(URL url, String localFilename, String userAgent) throws IOException {
InputStream is = null;
FileOutputStream fos = null;
System.setProperty("java.net.useSystemProxies", "true");
try {
URLConnection urlConn = url.openConnection();
... | false |
900,442 | 14,632,238 | 6,270,868 | public static void bubble(double[] a) {
for (int i = a.length - 1; i > 0; i--) for (int j = 0; j < i; j++) if (a[j] > a[j + 1]) {
double temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
| public static String shaEncrypt(final String txt) {
String enTxt = txt;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
logger.error("Error:", e);
}
if (null != md) {
by... | false |
900,443 | 8,702,780 | 778,641 | final void saveProject(Project project, final File file) {
if (projectsList.contains(project)) {
if (project.isDirty() || !file.getParentFile().equals(workspaceDirectory)) {
try {
if (!file.exists()) {
if (!file.createNewFile()) throw n... | 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 |
900,444 | 11,193,872 | 19,053,519 | private static <T> Collection<T> loadFromServices(Class<T> interf) throws Exception {
ClassLoader classLoader = DSServiceLoader.class.getClassLoader();
Enumeration<URL> e = classLoader.getResources("META-INF/services/" + interf.getName());
Collection<T> services = new ArrayList<T>();
... | protected String getManualDownloadURL() {
if (_newestVersionString.indexOf("weekly") > 0) {
return "http://www.cs.rice.edu/~javaplt/drjavarice/weekly/";
}
final String DRJAVA_FILES_PAGE = "http://sourceforge.net/project/showfiles.php?group_id=44253";
final String LINK_PRE... | true |
900,445 | 7,130,579 | 1,708,100 | public void copyFile(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPath);
FileOutputStream fs =... | private void sendFile(File file, HttpExchange response) throws IOException {
response.getResponseHeaders().add(FileUploadBase.CONTENT_LENGTH, Long.toString(file.length()));
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
IOUtils.copy(inp... | true |
900,446 | 5,271,797 | 5,138,483 | 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.... | public static List<String> extract(String zipFilePath, String destDirPath) throws IOException {
List<String> list = null;
ZipFile zip = new ZipFile(zipFilePath);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
... | true |
900,447 | 21,302,551 | 649,639 | public static Document convertHtmlToXml(final InputStream htmlInputStream, final String classpathXsltResource, final String encoding) {
Parser p = new Parser();
javax.xml.parsers.DocumentBuilder db;
try {
db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuil... | 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 |
900,448 | 2,464,907 | 3,134,513 | private boolean importTablesData(Connection conn) {
try {
boolean status = true;
boolean autoCommit = conn.getAutoCommit();
conn.setAutoCommit(false);
String dbType = this.getFromSession("database");
List statements = ParseDBDumpFile.parse(SystemGl... | public static boolean validPassword(String password, String passwordInDb) throws NoSuchAlgorithmException, UnsupportedEncodingException {
byte[] pwdInDb = hexStringToByte(passwordInDb);
byte[] salt = new byte[SALT_LENGTH];
System.arraycopy(pwdInDb, 0, salt, 0, SALT_LENGTH);
MessageDi... | false |
900,449 | 9,439,748 | 21,195,765 | public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
lon... | private void writeFile(FileInputStream inFile, FileOutputStream outFile) throws IOException {
byte[] buf = new byte[2048];
int read;
while ((read = inFile.read(buf)) > 0) outFile.write(buf, 0, read);
inFile.close();
}
| true |
900,450 | 10,192,341 | 5,609,837 | @SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
PositionParser pp;
Database.init("XIDResult");
pp = new PositionParser("01:33:50.904+30:39:35.79");
String url = "http://simbad.u-strasbg.fr/simbad/sim-script?submit=submit+script&script=";
... | public String postXmlRequest(String url, String data) {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
StringBuffer responseStr = new StringBuffer();
try {
System.out.println(data);
Log4j.logger.info("Request:\n"... | true |
900,451 | 14,495,973 | 16,485,992 | public static int copy(File src, int amount, File dst) {
final int BUFFER_SIZE = 1024;
int amountToRead = amount;
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(src));
out = new BufferedOutputStre... | 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 ... | true |
900,452 | 18,099,086 | 13,433,127 | @Override
protected void service(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
res.setHeader("X-Generator", "VisualMon");
String path = req.getPathInfo();
if (null == path || "".equals(path)) res.sendRedirect(req.getServletPath() + "/... | public void save(File selectedFile) throws IOException {
if (storeEntriesInFiles) {
boolean moved = false;
for (int i = 0; i < tempFiles.size(); i++) {
File newFile = new File(selectedFile.getAbsolutePath() + "_" + Integer.toString(i) + ".zettmp");
mov... | true |
900,453 | 849,586 | 23,241,192 | 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 publishMap(LWMap map) throws IOException {
File savedMap = PublishUtil.saveMap(map);
InputStream istream = new BufferedInputStream(new FileInputStream(savedMap));
OutputStream ostream = new BufferedOutputStream(new FileOutputStream(ActionUtil.selectFile("ConceptMap", "vue")));
... | true |
900,454 | 23,188,868 | 5,659,863 | public void run(IProgressMonitor runnerMonitor) throws CoreException {
try {
Map<String, File> projectFiles = new HashMap<String, File>();
IPath basePath = new Path("/");
for (File nextLocation : filesToZip) {
... | public static FileChannel newFileChannel(File file, String rw, boolean enableException) throws IOException {
if (file == null) return null;
if (rw == null || rw.length() == 0) {
return null;
}
rw = rw.toLowerCase();
if (rw.equals(MODE_READ)) {
if (File... | true |
900,455 | 4,822,222 | 7,209,394 | public static void copy(String srcFileName, String destFileName) throws IOException {
if (srcFileName == null) {
throw new IllegalArgumentException("srcFileName is null");
}
if (destFileName == null) {
throw new IllegalArgumentException("destFileName is null");
... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inChan... | true |
900,456 | 17,901,734 | 10,359,449 | public static void track(String strUserName, String strShortDescription, String strLongDescription, String strPriority, String strComponent) {
String strFromToken = "";
try {
URL url = new URL(getTracUrl() + "newticket");
BufferedReader reader = new BufferedReader(new InputSt... | protected Class findClass(String name) throws ClassNotFoundException {
String classFile = name.replace('.', '/') + ".class";
InputStream classInputStream = null;
if (this.extensionJars != null) {
for (int i = 0; i < this.extensionJars.length; i++) {
JarFile extens... | false |
900,457 | 9,240,872 | 20,368,648 | public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
lon... | private void copyFile(File in, File out) {
try {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
s... | true |
900,458 | 4,988,270 | 288,978 | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | 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 |
900,459 | 17,633,231 | 956,075 | private void openConnection() throws IOException {
connection = (HttpURLConnection) url.openConnection(Global.getProxy());
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml; ... | public void loginSendSpace() throws Exception {
loginsuccessful = false;
HttpParams params = new BasicHttpParams();
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
DefaultHttpClient httpclient = new Defaul... | false |
900,460 | 17,871,427 | 9,219,797 | public void decryptFile(String encryptedFile, String decryptedFile, String password) throws Exception {
CipherInputStream in;
OutputStream out;
Cipher cipher;
SecretKey key;
byte[] byteBuffer;
cipher = Cipher.getInstance("DES");
key = new SecretKeySpec(passwor... | public static void encryptFile(String infile, String outfile, String keyFile) throws Exception {
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, getKey());
java.io.FileInputStream in = new java.io.FileInputSt... | true |
900,461 | 1,362,134 | 18,731,109 | public void delete(int row) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();... | 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.... | false |
900,462 | 11,101,258 | 22,768,446 | private String getPlayerName(String id) throws UnsupportedEncodingException, IOException {
String result = "";
Map<String, String> players = (Map<String, String>) sc.getAttribute("players");
if (players.containsKey(id)) {
result = players.get(id);
System.out.println("... | public static String hashJopl(String password, String algorithm, String prefixKey, boolean useDefaultEncoding) {
try {
MessageDigest digest = MessageDigest.getInstance(algorithm);
if (useDefaultEncoding) {
digest.update(password.getBytes());
} else {
... | false |
900,463 | 3,488,916 | 3,067,994 | public static void main(String[] args) {
if (args.length != 2) throw new IllegalArgumentException("Expected arguments: fileName log");
String fileName = args[0];
String logFile = args[1];
LineNumberReader reader = null;
PrintWriter writer = null;
try {
Rea... | private String hashMD5(String strToHash) throws Exception {
try {
byte[] bHash = new byte[strToHash.length() * 2];
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(strToHash.getBytes("UTF-16LE"));
bHash = md.digest();
StringBuffer hex... | false |
900,464 | 441,377 | 2,911,006 | 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... | protected String encrypt(String text) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(text.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
... | false |
900,465 | 14,924,022 | 22,626,443 | private boolean saveDocumentXml(String repository, String tempRepo) {
boolean result = true;
try {
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "documents/document";
InputSource insource = new InputSource(new FileInputStream(tempRepo + ... | public static File jar(File in, String outArc, File tempDir, PatchConfigXML conf) {
FileOutputStream arcFile = null;
JarOutputStream jout = null;
DirectoryScanner ds = null;
ds = new DirectoryScanner();
ds.setCaseSensitive(true);
ds.setBasedir(in);
ds.scan();
... | true |
900,466 | 4,013,485 | 1,042,173 | void copyFileOnPeer(String path, RServerInfo peerserver, boolean allowoverwrite) throws IOException {
RFile file = new RFile(path);
OutputStream out = null;
FileInputStream in = null;
try {
in = fileManager.openFileRead(path);
out = localClient.openWrite(file,... | @Test
public void config() throws IOException {
Reader reader = new FileReader(new File("src/test/resources/test.yml"));
Writer writer = new FileWriter(new File("src/site/apt/config.apt"));
writer.write("------\n");
writer.write(FileUtils.readFully(reader));
writer.flush(... | true |
900,467 | 17,267,601 | 10,118,207 | public void setBckImg(String newPath) {
try {
File inputFile = new File(getPath());
File outputFile = new File(newPath);
if (!inputFile.getCanonicalPath().equals(outputFile.getCanonicalPath())) {
FileInputStream in = new FileInputStream(inputFile);
... | public static final boolean zipUpdate(String zipfile, String name, String oldname, byte[] contents, boolean delete) {
try {
File temp = File.createTempFile("atf", ".zip");
InputStream in = new BufferedInputStream(new FileInputStream(zipfile));
OutputStream os = new Buffer... | true |
900,468 | 7,895,612 | 14,370,985 | public final String encrypt(String input) throws Exception {
try {
MessageDigest messageDigest = (MessageDigest) MessageDigest.getInstance(algorithm).clone();
messageDigest.reset();
messageDigest.update(input.getBytes());
String output = convert(messageDigest.... | public static String encrypt(String password) {
String sign = password;
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(sign.getBytes());
byte[] hash = md.digest();
StringBuffer hexString = new StringBuf... | true |
900,469 | 8,708,601 | 21,370,186 | public void testReadNormal() throws Exception {
archiveFileManager.executeWith(new TemporaryFileExecutor() {
public void execute(File temporaryFile) throws Exception {
ZipArchive archive = new ZipArchive(temporaryFile.getPath());
InputStream input = archive.getIn... | public static void replaceAll(File file, String substitute, String substituteReplacement) throws IOException {
log.debug("Replace " + substitute + " by " + substituteReplacement);
Pattern pattern = Pattern.compile(substitute);
FileInputStream fis = new FileInputStream(file);
FileChan... | true |
900,470 | 11,219,274 | 13,883,878 | private static void addFolderToZip(File folder, ZipOutputStream zip, String baseName) throws IOException {
File[] files = folder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
String name = file.getAbsolutePath().substring(baseName.length());
... | PathElement(String path) throws MaxError {
this.path = path;
if (path.startsWith("http:")) {
try {
url = new URL(path);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("HEAD... | false |
900,471 | 4,787,102 | 22,135,198 | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
OutputStream output = getOutputStream();
if (cachedContent != null) {
output.write(cachedContent);
} else {
FileInputStream input = new FileInput... | public void testCodingBeyondContentLimitFromFile() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WritableByteChannel channel = newChannel(baos);
HttpParams params = new BasicHttpParams();
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 12... | true |
900,472 | 3,762,872 | 10,977,091 | public String getHash(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] toChapter1Digest = md.digest();
return Keystore.hexEncode(toChapter1Digest);
} catch (Exception e) {
logger.err... | public String md5(String password) {
MessageDigest m = null;
try {
m = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
}
m.update(password.getBytes(), 0, password.length());
return new BigInteger(1, m.digest()).toString(16);
}... | true |
900,473 | 16,001,374 | 2,103,971 | 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... | @Override
protected void writeFile() {
super.writeFile();
try {
String tagListFilePath = file.toURI().toASCIIString();
tagListFilePath = tagListFilePath.substring(0, tagListFilePath.lastIndexOf(FileManager.GLIPS_VIEW_EXTENSION)) + FileManager.TAG_LIST_FILE_EXTENSION;
... | true |
900,474 | 12,595,519 | 1,718,589 | @SuppressWarnings("unchecked")
public static void main(String[] args) {
System.out.println("Starting encoding test....");
Properties p = new Properties();
try {
InputStream pStream = ClassLoader.getSystemResourceAsStream("sample_weather.properties");
p.load(pStrea... | @Override
public ImageData getImageData(URL url) {
InputStream in = null;
try {
URLConnection conn = url.openConnection();
conn.setRequestProperty("user-agent", "Tahiti/Alpha5x");
conn.setRequestProperty("agent-system", "aglets");
conn.setAllowUser... | false |
900,475 | 210,006 | 20,209,162 | 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 java.io.File gzip(java.io.File file) throws Exception {
java.io.File tmp = null;
InputStream is = null;
OutputStream os = null;
try {
tmp = java.io.File.createTempFile(file.getName(), ".gz");
tmp.deleteOnExit();
is = new BufferedInputStream(... | true |
900,476 | 16,055,802 | 4,681,906 | 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... | public void launch(String xmlControl, String xmlDoc, long docId) {
AgentLauncher l;
Environment env;
Properties prop;
Resource res;
String token;
String deflt;
String answ;
String key;
String entry;
ShipService service;
de.fhg.i... | false |
900,477 | 11,397,480 | 288,978 | public void render(Map map, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(OUTPUT_BYTE_ARRAY_INITIAL_SIZE);
File file = (File) map.get("targetFile");
IOUtils.copy(new FileInputStream(fi... | 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 |
900,478 | 1,953,115 | 13,325,917 | protected int doWork() {
SAMFileReader reader = new SAMFileReader(IoUtil.openFileForReading(INPUT));
reader.getFileHeader().setSortOrder(SORT_ORDER);
SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), false, OUTPUT);
Iterator<SAMRecord> itera... | 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... | true |
900,479 | 23,250,845 | 6,317,842 | 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... | public static String MD5(String str, String encoding) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
messageDigest.reset();
try {
... | false |
900,480 | 13,121,131 | 20,761,702 | 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... | private File newFile(File oldFile) throws IOException {
int counter = 0;
File nFile = new File(this.stateDirProvider.get() + File.separator + oldFile.getName());
while (nFile.exists()) {
nFile = new File(this.stateDirProvider.get() + File.separator + oldFile.getName() + "_" + cou... | true |
900,481 | 7,905,116 | 21,561,833 | protected List<? extends SearchResult> searchVideo(String words, int number, int offset, CancelMonitor cancelMonitor) {
List<VideoSearchResult> resultsList = new ArrayList<>();
try {
// set up the HTTP request factory
HttpTransport transport = new NetHttpTransport();
HttpRequestFactory factory = transport... | private static void copyFile(String src, String dest) throws IOException {
File destFile = new File(dest);
if (destFile.exists()) {
destFile.delete();
}
FileChannel srcChannel = new FileInputStream(src).getChannel();
FileChannel dstChannel = new FileOutputStream(d... | false |
900,482 | 4,579,115 | 18,142,979 | public void copy(String original, String copy) throws SQLException {
try {
OutputStream out = openFileOutputStream(copy, false);
InputStream in = openFileInputStream(original);
IOUtils.copyAndClose(in, out);
} catch (IOException e) {
throw Message.conv... | private String copyTutorial() throws IOException {
File inputFile = new File(getFilenameForOriginalTutorial());
File outputFile = new File(getFilenameForCopiedTutorial());
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
w... | true |
900,483 | 12,039,036 | 8,352,957 | public static ArrayList<Credential> importCredentials(String urlString) {
ArrayList<Credential> results = new ArrayList<Credential>();
try {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer... | void IconmenuItem6_actionPerformed(ActionEvent e) {
JFileChooser jFileChooser1 = new JFileChooser();
String separator = "";
if (JFileChooser.APPROVE_OPTION == jFileChooser1.showOpenDialog(this.getFatherFrame())) {
setDefaultPath(jFileChooser1.getSelectedFile().getPath());
... | false |
900,484 | 17,267,601 | 12,821,749 | public void setBckImg(String newPath) {
try {
File inputFile = new File(getPath());
File outputFile = new File(newPath);
if (!inputFile.getCanonicalPath().equals(outputFile.getCanonicalPath())) {
FileInputStream in = new FileInputStream(inputFile);
... | public static void fastBackup(File file) {
FileChannel in = null;
FileChannel out = null;
FileInputStream fin = null;
FileOutputStream fout = null;
try {
in = (fin = new FileInputStream(file)).getChannel();
out = (fout = new FileOutputStream(file.getAb... | true |
900,485 | 16,658,637 | 346,058 | private void initUserExtensions(SeleniumConfiguration seleniumConfiguration) throws IOException {
StringBuilder contents = new StringBuilder();
StringOutputStream s = new StringOutputStream();
IOUtils.copy(SeleniumConfiguration.class.getResourceAsStream("default-user-extensions.js"), s);
... | 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 |
900,486 | 10,941,155 | 14,652,853 | private void detachFile(File file, Block b) throws IOException {
File tmpFile = volume.createDetachFile(b, file.getName());
try {
IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16 * 1024, true);
if (file.length() != tmpFile.length()) {
... | public static void main(String args[]) {
String midletClass = null;
;
File appletInputFile = null;
File deviceInputFile = null;
File midletInputFile = null;
File htmlOutputFile = null;
File appletOutputFile = null;
File deviceOutputFile = null;
... | true |
900,487 | 19,251,430 | 5,933,078 | public static List<String> unZip(File tarFile, File directory) throws IOException {
List<String> result = new ArrayList<String>();
InputStream inputStream = new FileInputStream(tarFile);
ZipArchiveInputStream in = new ZipArchiveInputStream(inputStream);
ZipArchiveEntry entry = in.get... | 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 |
900,488 | 18,516,388 | 19,579,830 | public void test() throws Exception {
StorageString s = new StorageString("UTF-8");
s.addText("Test");
try {
s.getOutputStream();
fail("Should throw IOException as method not supported.");
} catch (IOException e) {
}
try {
s.getWrit... | public static void copy(File toCopy, File dest) throws IOException {
FileInputStream src = new FileInputStream(toCopy);
FileOutputStream out = new FileOutputStream(dest);
try {
while (src.available() > 0) {
out.write(src.read());
}
} finally {
... | true |
900,489 | 6,508,481 | 7,350,139 | static void invalidSlave(String msg, Socket sock) throws IOException {
BufferedReader _sinp = null;
PrintWriter _sout = null;
try {
_sout = new PrintWriter(sock.getOutputStream(), true);
_sinp = new BufferedReader(new InputStreamReader(sock.getInputStream()));
... | public static void messageDigestTest() {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update("computer".getBytes());
md.update("networks".getBytes());
System.out.println(new String(md.digest()));
System.out.println(new String(md.di... | true |
900,490 | 16,058,262 | 7,187,035 | public static boolean copyFile(final File src, final File dest, long extent, final boolean overwrite) throws FileNotFoundException, IOException {
boolean result = false;
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Copying file " + src + " to " + dest + " extent " + extent + " exist... | @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) {
... | true |
900,491 | 21,870,536 | 10,584,420 | 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 static String checkUpdate() {
URL url = null;
try {
url = new URL("http://googlemeupdate.bravehost.com/");
} catch (MalformedURLException ex) {
ex.printStackTrace();
}
InputStream html = null;
try {
html = url.openStream();
... | false |
900,492 | 20,305,472 | 10,348,730 | @Override
public void run() {
try {
FileChannel out = new FileOutputStream(outputfile).getChannel();
long pos = 0;
status.setText("Slučovač: Proces Slučování spuštěn.. Prosím čekejte..");
for (int i = 1; i <= noofparts; i++) {
FileChannel i... | private void installBinaryFile(File source, File destination) {
byte[] buffer = new byte[8192];
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
int read;
... | true |
900,493 | 23,620,425 | 7,158,123 | private static long copy(InputStream source, OutputStream sink) {
try {
return IOUtils.copyLarge(source, sink);
} catch (IOException e) {
throw new FaultException("System error copying stream", e);
} finally {
IOUtils.closeQuietly(source);
IOUt... | 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 |
900,494 | 19,279,420 | 11,324,607 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final FileManager fmanager = FileManager.getFileManager(request, leechget);
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iter;
try {
... | @Override
@Transactional
public FileData store(FileData data, InputStream stream) {
try {
FileData file = save(data);
file.setPath(file.getGroup() + File.separator + file.getId());
file = save(file);
File folder = new File(PATH, file.getGroup());
... | true |
900,495 | 7,816,467 | 21,937,981 | private CharBuffer decodeToFile(ReplayInputStream inStream, String backingFilename, String encoding) throws IOException {
CharBuffer charBuffer = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, encoding));
File backingFile = new File(backingFilename);
... | private void process(String zipFileName, String directory, String db) throws SQLException {
InputStream in = null;
try {
if (!FileUtils.exists(zipFileName)) {
throw new IOException("File not found: " + zipFileName);
}
String originalDbName = null;
... | true |
900,496 | 11,627,705 | 668,660 | public static void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
in.close();
... | 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 |
900,497 | 6,908,734 | 1,156,882 | public <E extends Exception> void doWithConnection(String httpAddress, ICallableWithParameter<Void, URLConnection, E> toDo) throws E, ConnectionException {
URLConnection connection;
try {
URL url = new URL(httpAddress);
connection = url.openConnection();
} catch (Malf... | @Override
public void onClick(View v) {
Log.d(Config.SS_TAG, "Sending POST request to server...");
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(Config.RPC_SERVLET_URL);
JSONObject requestJ... | false |
900,498 | 1,466,343 | 9,096,316 | public boolean finish() {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName.getText());
try {
project.create(null);
project.open(null);
IProjectDescription desc = project.getDescription();
desc.setNatureIds(new String[]... | private void handleNodeDown(long eventID, long nodeID, String eventTime) {
Category log = ThreadCategory.getInstance(OutageWriter.class);
if (eventID == -1 || nodeID == -1) {
log.warn(EventConstants.NODE_DOWN_EVENT_UEI + " ignored - info incomplete - eventid/nodeid: " + eventID + "/" + n... | false |
900,499 | 17,808,807 | 8,428,267 | static String doHttp(String postURL, String text) {
String returnValue = null;
StringBuffer sb = new StringBuffer();
sb.append("bsh.client=Remote");
sb.append("&bsh.script=");
sb.append(URLEncoder.encode(text));
String formData = sb.toString();
try {
... | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException nsae) {
nsae.printStackTrace();
}
}
try {
digest.up... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.