bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

java對(duì)hdfs的操作是怎樣的

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)java對(duì)hdfs的操作是怎樣的,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

員工經(jīng)過長(zhǎng)期磨合與沉淀,具備了協(xié)作精神,得以通過團(tuán)隊(duì)的力量開發(fā)出優(yōu)質(zhì)的產(chǎn)品。創(chuàng)新互聯(lián)堅(jiān)持“專注、創(chuàng)新、易用”的產(chǎn)品理念,因?yàn)椤皩W⑺詫I(yè)、創(chuàng)新互聯(lián)網(wǎng)站所以易用所以簡(jiǎn)單”。公司專注于為企業(yè)提供成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開發(fā)、電商網(wǎng)站開發(fā),微信小程序開發(fā),軟件按需制作網(wǎng)站等一站式互聯(lián)網(wǎng)企業(yè)服務(wù)。

package hdfs;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
/**
 * java對(duì)hdfs的操作
 * @author 林
 *
 */
public class App2 {
 public static final String HDFS_PATH = "hdfs://hadoop:9000";
 public static final String DRI_PATH = "/d1000";
 public static final String FILE_PATH = "/d1000/f1000";
 public static void main(String[] args) throws Exception {
  FileSystem fileSystem = FileSystem.get(new URI(HDFS_PATH),new Configuration());
  //創(chuàng)建文件夾
  mkDri(fileSystem);
  //上傳文件
  uploadDate(fileSystem);
  //下載文件
  downloadFile(fileSystem);
  //刪除文件
  deleteFile(fileSystem);
 }
 public static void deleteFile(FileSystem fileSystem) throws IOException {
  fileSystem.delete(new Path(FILE_PATH), true);
 }
 
 //下載文件
 public static void downloadFile(FileSystem fileSystem) throws IOException {
  FSDataInputStream in = fileSystem.open(new Path(FILE_PATH));
  FileOutputStream out = new FileOutputStream(new File("D:/copy.txt"));
  //IOUtils.copyBytes(in, System.out, 2048, true);下載到控制臺(tái)
  IOUtils.copyBytes(in,out, 2048, true);
 }
 
 //上傳文件
 public static void uploadDate(FileSystem fileSystem) throws IOException,
   FileNotFoundException {
  FSDataOutputStream out = fileSystem.create(new Path(FILE_PATH));
  FileInputStream in = new FileInputStream("D:/hadoop安裝.txt");
  IOUtils.copyBytes(in, out, 1024,true);
 }
 //創(chuàng)建目錄
 public static void mkDri(FileSystem fileSystem) throws IOException {
  fileSystem.mkdirs(new Path(DRI_PATH));
 }
}

上述就是小編為大家分享的java對(duì)hdfs的操作是怎樣的了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

網(wǎng)頁標(biāo)題:java對(duì)hdfs的操作是怎樣的
網(wǎng)頁鏈接:http://vcdvsql.cn/article14/pejhge.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)響應(yīng)式網(wǎng)站網(wǎng)站設(shè)計(jì)定制開發(fā)Google網(wǎng)站維護(hù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)