Practical exercise unit 7 Topic : MapReduce program in Java Work purpose : Display function, convolution function and the assignment perform the code study


File system using information read API


Download 398.17 Kb.
bet7/12
Sana26.03.2023
Hajmi398.17 Kb.
#1296788
1   2   3   4   5   6   7   8   9   ...   12
Bog'liq
2-deadline

File system using information read API
Previous in the department telling as in the past , sometimes setURLStream - Call to HandlerFactory to do opportunity there is in the app possible not _ Such without , you using FileSystem _ file for access flow you open need _
Hadoop file in the system file is a Hadoop object with is expressed Path ( rather than java.io File ., because of the other semantics local file system with very closely linked ). Road object as a URI to look can Hadoop file in the system ( eg hdfs : //localhost/user/tom/quangle.txt ) _ _ _ _ _ _
FileSystem is a common API file system , therefore for the first step we want to use has been file system sample is to get - our HDFS in our case . FileSystem sample get for one how many static factory methods available :
Configuration in the object configuration in the files defined customer or server configuration encapsulates ( eg conf / core - site . xml ) . First method standard file system returns ( conf / core - site.xml in the file shown or not installed if , local standard file system ). Second method of the given URI scheme and authority file system determines ; if the circuit in the URI if not specified , default file system is used . Third method file system object given user on behalf takes , this safety in the context of important ( see " Security ", page 419) .
Some cases you local file system sample get need will be Such without , getLocal () helper method your use can :

File from the length bigger in the place seek( ) . to call IOException releases _ Stream current from the situation except to the point take going java.io.InputStream from the skip() method of the class different , seek() method in the file optional absolute to the position transition enable gives _
Listing 3.3 of Listing 3.2 extension and the file standard to exit two times sends and the first times of the file At the beginning of located _
Read() method to length reads bytes given file from the position offset in the offset to the position in the buffer . _ Return value in reality read bytes the number own into takes _ call while doing , you acceptance done the value your check is necessary because it is long less to be can _ readFully () methods length to the clipboard is read byte ( or buffer . length buffer byte array acceptance doer version for ) ; if this of the file to the end if , EOFException is sent .
This of methods all of them current file offset keeps and the work particles for is safe . They are of the file main content reading during of the file another refer to parts ( for example , metadata ) . to do for comfortable mechanism provides .
Finally , that's it in mind hold seek() call relatively expensive and caution with use need _ In the application to information access model one how many location determination operations not but _ flowing information again to work based on to be needed ( for example , using MapReduce ) .

Download 398.17 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   12




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling