URI Dan URL

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

URI dan URL Class

Java Network Programming 4th ed


Page 117 - 149

A URL unambiguously identifies the location of a resource on the Internet. A URL is the most common
type of URI, or Uniform Resource Identifier. A URI can identify a resource by its network location, as in a
URL, or by its name, number, or other characteristics. The URL class is the simplest way for a Java
program to locate and retrieve data from the network.

URI

A Uniform Resource Identifier (URI) is a string of characters in a particular syntax that identifies a
resource. The resource identified may be a file on a server; but it may also be an email address, a news
message, a book, a person’s name, an Internet host, the current stock price of Oracle, or something else.

The syntax of a URI is composed of a scheme and a scheme-specific part, separaa colon, like this:

scheme:scheme-specific-part

The syntax of the scheme-specific part depends on the scheme being used. Current schemes include:

a. Data : Base64-encoded data included directly in a link; see RFC 2397


b. File : A file on a local disk
c. ftp : An FTP server
d. http : A World Wide Web server using the Hypertext Transfer Protocol
e. mailto : An email address
f. magnet : A resource available for download via peer-to-peer networks such as BitTorrent
g. telnet : A connection to a Telnet-based service
h. urn : A Uniform Resource Name

URL

A URL is a URI that, as well as identifying a resource, provides a specific network location for the
resource that a client can use to retrieve a representation of that resource. By contrast, a generic URI
may tell you what a resource is, but not actually tell you where or how to get that resource.

The syntax of a URL is:

protocol://userInfo@host:port/path?query#fragment

Tugas Mandiri :

Baca Chapter URI dan URL pada halaman yang tertera di atas, lalu buatlah program untuk :

1. Mengekstrak bagian-bagian dari sebuah URI and URL pada string link yang diinputkan sesuai
dengan sintaks skema dari URI itu sendiri
2. Melakukan grabbing data pada sebuah website; pada program ini user akan menginputkan link
http://www.bmkg.go.id/BMKG_Pusat/Kualitas_Udara/Informasi_Partikulat.bmkg
- Ketika user menginputkan link, maka program akan membaca url dan mengambil data
halaman website, lalu masukkan halaman website tersebut ke dalam sebuah file txt.
- Lalu baca source tersebut dan ambil data table tingkat partikulat di dan masukkan ke dalam
sebuah file json.

You might also like