Jump to: navigation, search

Difference between revisions of "Main Page"

m (Correct the software name and URL protocol for our paste service)
 
(114 intermediate revisions by 13 users not shown)
Line 1: Line 1:
__NOTOC__
+
<div id="mf-index">
+8801713083079
+
<table border=0 width=100% cellpadding=15><tr><td width=25% align=center>
 +
[[File:Openstack-vertical-small.png]]
 +
</td><td>
 +
== Welcome to the OpenStack wiki ==
 +
The OpenStack Mission is to produce a ubiquitous Open Source Cloud Computing platform that is easy to use, simple to implement, interoperable between deployments, works well at all scales, and meets the needs of users and operators of both public and private clouds.
  
1. Download files data from many
+
OpenStack is '''[http://docs.openstack.org/project-team-guide/open-source.html open source]''', '''[http://docs.openstack.org/project-team-guide/open-design.html openly designed]''', '''[http://docs.openstack.org/project-team-guide/open-development.html openly developed]''' by an '''[http://docs.openstack.org/project-team-guide/open-community.html open community]'''.
URLs and save them to the local
 
files in the directory of your choice:
 
  
This Java program lets you download files from one or more URLs and save them in the directory where you want. This program takes destination directory for the files to save as first command line argument and URLs for the files as next command line arguments separated by space. Java provides URLConnection class that represents a communication link between the application and a URL. Invoking the openConnection method on a URL creates URLConnection object. Now get [[InputStream]] object from that connection and read the data. Finally write the data to the local file.
+
The '''OpenStack wiki''' is a collaboration tool for the community to publish various documents in a collaborative manner. Content may be out of date or inaccurate. Please refer primarily to other OpenStack websites for reference information (see below).
 
+
</td></tr>
[[FileDataDownload]].java:
+
</table>
 
+
----
import java.io.*;
+
<table border=0 width=100%>
import java.net.*;
+
<tr valign=top><td width=50%>
public class [[FileDataDownload]] {
+
==== Help in using the wiki ====
final static int size=1024;
+
* '''[[How_To_Use_The_Wiki|How to use this wiki]]'''
public static void
+
* Learn [https://www.mediawiki.org/wiki/Help:Formatting Wiki markup]
[[FileDownload]](String fileAddress, String
+
* [https://www.mediawiki.org/wiki/Help:Editing_pages Editing pages]
localFileName, String destinationDir) {
+
* [https://www.mediawiki.org/wiki/Help:Tracking_changes Tracking changes] and setting up a [https://www.mediawiki.org/wiki/Help:Watchlist Watchlist]
[[OutputStream]] os = null;
+
* Interested in quick collaborative editing? Try out [https://etherpad.openstack.org Etherpad]
URLConnection URLConn = null;
+
* In need of a collaborative spreadsheet? Try out [https://ethercalc.openstack.org Ethercalc]
 
+
* Looking to paste and link arbitrary text? Try out [http://paste.openstack.org LodgeIt]
// URLConnection class represents a communication link between the
+
</td><td width=50%>
// application and a URL.
+
==== Links ====
 
+
* [https://www.openstack.org/ OpenStack main website]
[[InputStream]] is = null;
+
* [https://releases.openstack.org/ OpenStack releases]
try {
+
* [https://git.openstack.org/cgit Source code]
URL fileUrl;
+
* [https://docs.openstack.org/ Documentation]
byte[] buf;
+
* '''[https://www.openstack.org/community How to contribute]'''
int [[ByteRead]],[[ByteWritten]]=0;
+
* [https://governance.openstack.org/ Project governance]
fileUrl= new URL(fileAddress);
+
* Links from the [[Old_Main_Page|previous version of this wiki main page]]
os = new [[BufferedOutputStream]](new
+
</td></tr></table>
[[FileOutputStream]](destinationDir+”\\”+
+
__NOTOC__
localFileName));
+
__NOEDITSECTION__
//The URLConnection object is
+
</div>
created by invoking the
 
 
 
// openConnection method on a URL.
 
 
 
URLConn = fileUrl.openConnection();
 
is = URLConn.getInputStream();
 
buf = new byte[size];
 
while (([[ByteRead]] = is.read(buf)) != -1) {
 
os.write(buf, 0, [[ByteRead]]);
 
[[ByteWritten]] += [[ByteRead]];
 
}
 
System.out.println(“Downloaded
 
Successfully.”);
 
System.out.println(“File name
 
:\””+localFileName+ “\”\nNo of
 
bytes :” + [[ByteWritten]]);
 
}
 
catch (Exception e) {
 
e.printStackTrace();
 
}
 
finally {
 
try {
 
is.close();
 
os.close();
 
}
 
catch (IOException e) {
 
e.printStackTrace();
 
</nowiki></pre>
 
public static void fileDownload(String
 
fileAddress, String destinationDir)
 
{
 
 
 
// Find the index of last occurance of character ‘/’ and ‘.’.
 
 
 
int lastIndexOfSlash =
 
fileAddress.lastIndexOf(‘/’);
 
int lastIndexOfPeriod =
 
fileAddress.lastIndexOf(‘.’);
 
 
 
// Find the name of file to be downloaded from the address.
 
 
 
String fileName=fileAddress.substring
 
(lastIndexOfSlash + 1);
 
 
 
// Check whether path or file name is given correctly.
 
 
 
if (lastIndexOfPeriod >=1 && lastIndexOfSlash >= 0 &&
 
lastIndexOfSlash < fileAddress.length()
 
-1 1)
 
{
 
[[FileDownload]](fileAddress,fileName,
 
destinationDir);
 
}
 
else
 
{
 
System.err.println(“Specify correct path or file name.”);
 
}}
 
public static void main(String[] args)
 
{
 
 
 
// Check whether there are atleast
 
two arguments.
 
 
 
if(args.length==2)
 
{
 
for (int i = 1; i < args.length; i++) {
 
fileDownload(args[i],args[0]);
 
}
 
}
 
else{System.err.println(“Provide
 
\”Destination directory path\” and \”file
 
names\” separated by space.”);
 
}
 
}
 
}
 
 
 
Compile and Run:
 
 
 
In this example, the location for the
 
directory where file “jsf.htm” is to be
 
saved is “c:\download”.
 
 
 
C:\[[JavaJazzup]]>javac [[FileDataDownload]].java
 
C:\[[JavaJazzup]]>java [[FileDataDownload]]
 
c:\download http://localhost:8080/
 
tomahawk_tags/pages/jsf.htm
 

Latest revision as of 16:39, 21 March 2018

Openstack-vertical-small.png

Welcome to the OpenStack wiki

The OpenStack Mission is to produce a ubiquitous Open Source Cloud Computing platform that is easy to use, simple to implement, interoperable between deployments, works well at all scales, and meets the needs of users and operators of both public and private clouds.

OpenStack is open source, openly designed, openly developed by an open community.

The OpenStack wiki is a collaboration tool for the community to publish various documents in a collaborative manner. Content may be out of date or inaccurate. Please refer primarily to other OpenStack websites for reference information (see below).


Help in using the wiki

Links