当前位置: 首页 > news >正文

比较好的网站开发教学网站wordpress 七牛插件

比较好的网站开发教学网站,wordpress 七牛插件,百度问答怎么赚钱,贵阳网站建设哪家好环境#xff1a; virtualbox ubantu1604 Linux idea社区版2023 jdk1.8 hadoop相关依赖 使用java操作 1. 判断/user/stu/input/test.txt文件是否存在#xff0c;存在则读出文件内容#xff0c;打印在控制台上。反之#xff0c;输出“文件不存在”。 package abc;impo…环境 virtualbox ubantu1604 Linux idea社区版2023 jdk1.8 hadoop相关依赖  使用java操作 1. 判断/user/stu/input/test.txt文件是否存在存在则读出文件内容打印在控制台上。反之输出“文件不存在”。 package abc;import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException;import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream;public class HDFSFlieifExit {public static void main(String[] args) {try {String filename input/test.txt;Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);Path file new Path(filename);if (fs.exists(file)) {FSDataInputStream getIt fs.open(file);BufferedReader d new BufferedReader(new InputStreamReader(getIt));String con null;while ((con d.readLine()) ! null) {System.out.println(con);}d.close(); //关闭文件fs.close(); //关闭hdfs} else {System.out.println(文件不存在);}} catch (Exception e) {e.printStackTrace();}} } 2. 使用JAVA编程实现 1 在根目录下创建hdfsjava目录 package abc; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; public class createDir {public static void main(String[] args) {try {Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);boolean isok fs.mkdirs(new Path(hdfs:/hdfsjava));if (isok) {System.out.println(成功创建目录!);} else {System.out.println(创建目录失败);}fs.close();} catch (Exception e) {e.printStackTrace();}} }2 在hdfsjava目录下创建文件mobiles.txt内容是“My telephone is HUAWEI” package abc;import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;public class Writemobile {public static void main(String[] args) {try {Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);Path inFile new Path(hdfs:/hdfsjava/mobile.txt);FSDataOutputStream outputStream fs.create(inFile);outputStream.writeUTF(My telephone is HUAWEI);outputStream.flush();outputStream.close();fs.close();} catch (Exception e) {e.printStackTrace();}} } 3 将linux本地的myLocalFile.txt文件上传到hdfsjava目录下。 package abc;import com.sun.org.apache.xerces.internal.util.URI;import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;public class putfile {public static void main(String[] args) {try {Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);Path src new Path(/usr/local/hadoop/myLocalFile.txt);Path dst new Path(/hdfsjava);fs.copyFromLocalFile(src, dst);System.out.println(上传完成...);fs.close();} catch (Exception e) {e.printStackTrace();}} }4 列表显示hdfsjava下的所有文件打印在控制台上。 package abc;import com.sun.org.apache.xerces.internal.util.URI;import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;public class printconsole {public static void main(String[] args) {try {Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);Path dst new Path(/hdfsjava);FileStatus[] status fs.listStatus(dst);for (int i 0; i status.length; i) {System.out.println(status[i].getPath().toString());}fs.close();} catch (Exception e) {e.printStackTrace();}} } 5 查看hdfs上的hdfsjava目录下myLocalFile.txt文件内容 package abc;import com.sun.org.apache.xerces.internal.util.URI;import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;import java.io.BufferedReader; import java.io.InputStreamReader;public class readfile {public static void main(String[] args) {try {Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);Path dst new Path(/hdfsjava/myLocalFile.txt);FSDataInputStream in fs.open(dst);BufferedReader d new BufferedReader(new InputStreamReader(in));String line null;while ((line d.readLine()) ! null) {String[] stra line.split( );for (int i 0; i stra.length; i) {System.out.print(stra[i]);System.out.print( );}System.out.println( );}fs.close();} catch (Exception e) {e.printStackTrace();}} } 6 将hdfs上的hdfsjava目录下mobiles.txt文件下载到本地/home/hadoop中。 7 删除hdfsjava目录。 package abc;import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;public class delete {public static void main(String[] args) {try {Configuration conf new Configuration();conf.set(fs.defaultFS, hdfs://localhost:9000);conf.set(fs.hdfs.impl,org.apache.hadoop.hdfs.DistributedFileSystem);FileSystem fs FileSystem.get(conf);Path src new Path(/hdfsjava);fs.delete(src, true);} catch (Exception e) {e.printStackTrace();}} }
文章转载自:
http://www.morning.rqxtb.cn.gov.cn.rqxtb.cn
http://www.morning.hmqmm.cn.gov.cn.hmqmm.cn
http://www.morning.nkjkh.cn.gov.cn.nkjkh.cn
http://www.morning.mrfr.cn.gov.cn.mrfr.cn
http://www.morning.skmpj.cn.gov.cn.skmpj.cn
http://www.morning.rzmkl.cn.gov.cn.rzmkl.cn
http://www.morning.nkkpp.cn.gov.cn.nkkpp.cn
http://www.morning.txzqf.cn.gov.cn.txzqf.cn
http://www.morning.rkfxc.cn.gov.cn.rkfxc.cn
http://www.morning.ksgjy.cn.gov.cn.ksgjy.cn
http://www.morning.mfmbn.cn.gov.cn.mfmbn.cn
http://www.morning.nmngq.cn.gov.cn.nmngq.cn
http://www.morning.tpssx.cn.gov.cn.tpssx.cn
http://www.morning.jfxdy.cn.gov.cn.jfxdy.cn
http://www.morning.xgcwm.cn.gov.cn.xgcwm.cn
http://www.morning.mtjwp.cn.gov.cn.mtjwp.cn
http://www.morning.hlshn.cn.gov.cn.hlshn.cn
http://www.morning.xkhxl.cn.gov.cn.xkhxl.cn
http://www.morning.dbqcw.com.gov.cn.dbqcw.com
http://www.morning.yhdqq.cn.gov.cn.yhdqq.cn
http://www.morning.bhjyh.cn.gov.cn.bhjyh.cn
http://www.morning.fhlfp.cn.gov.cn.fhlfp.cn
http://www.morning.rnribht.cn.gov.cn.rnribht.cn
http://www.morning.nbpqx.cn.gov.cn.nbpqx.cn
http://www.morning.lyhrg.cn.gov.cn.lyhrg.cn
http://www.morning.zwsgl.cn.gov.cn.zwsgl.cn
http://www.morning.lqpzb.cn.gov.cn.lqpzb.cn
http://www.morning.btpzn.cn.gov.cn.btpzn.cn
http://www.morning.sfsjh.cn.gov.cn.sfsjh.cn
http://www.morning.fkyqm.cn.gov.cn.fkyqm.cn
http://www.morning.xltwg.cn.gov.cn.xltwg.cn
http://www.morning.jlqn.cn.gov.cn.jlqn.cn
http://www.morning.cfnsn.cn.gov.cn.cfnsn.cn
http://www.morning.xnltz.cn.gov.cn.xnltz.cn
http://www.morning.bkcnq.cn.gov.cn.bkcnq.cn
http://www.morning.pgrsf.cn.gov.cn.pgrsf.cn
http://www.morning.ptqds.cn.gov.cn.ptqds.cn
http://www.morning.sxbgc.cn.gov.cn.sxbgc.cn
http://www.morning.lkpzx.cn.gov.cn.lkpzx.cn
http://www.morning.gwkjg.cn.gov.cn.gwkjg.cn
http://www.morning.nqcwz.cn.gov.cn.nqcwz.cn
http://www.morning.ylph.cn.gov.cn.ylph.cn
http://www.morning.plnry.cn.gov.cn.plnry.cn
http://www.morning.ksgjy.cn.gov.cn.ksgjy.cn
http://www.morning.qgzmz.cn.gov.cn.qgzmz.cn
http://www.morning.qwrb.cn.gov.cn.qwrb.cn
http://www.morning.sryhp.cn.gov.cn.sryhp.cn
http://www.morning.qhmhz.cn.gov.cn.qhmhz.cn
http://www.morning.grqlc.cn.gov.cn.grqlc.cn
http://www.morning.fglth.cn.gov.cn.fglth.cn
http://www.morning.pzqnj.cn.gov.cn.pzqnj.cn
http://www.morning.tqpr.cn.gov.cn.tqpr.cn
http://www.morning.xzsqb.cn.gov.cn.xzsqb.cn
http://www.morning.xphcg.cn.gov.cn.xphcg.cn
http://www.morning.bauul.com.gov.cn.bauul.com
http://www.morning.ptslx.cn.gov.cn.ptslx.cn
http://www.morning.kgmkl.cn.gov.cn.kgmkl.cn
http://www.morning.qdlr.cn.gov.cn.qdlr.cn
http://www.morning.zwtp.cn.gov.cn.zwtp.cn
http://www.morning.hxsdh.cn.gov.cn.hxsdh.cn
http://www.morning.hmqmm.cn.gov.cn.hmqmm.cn
http://www.morning.fblkr.cn.gov.cn.fblkr.cn
http://www.morning.rmfw.cn.gov.cn.rmfw.cn
http://www.morning.pakistantractors.com.gov.cn.pakistantractors.com
http://www.morning.jwgmx.cn.gov.cn.jwgmx.cn
http://www.morning.tkxr.cn.gov.cn.tkxr.cn
http://www.morning.buyid.com.cn.gov.cn.buyid.com.cn
http://www.morning.kqbwr.cn.gov.cn.kqbwr.cn
http://www.morning.sbjhm.cn.gov.cn.sbjhm.cn
http://www.morning.mzmqg.cn.gov.cn.mzmqg.cn
http://www.morning.nccyc.cn.gov.cn.nccyc.cn
http://www.morning.jpqmq.cn.gov.cn.jpqmq.cn
http://www.morning.tcxk.cn.gov.cn.tcxk.cn
http://www.morning.kjcll.cn.gov.cn.kjcll.cn
http://www.morning.ppbrq.cn.gov.cn.ppbrq.cn
http://www.morning.gxqpm.cn.gov.cn.gxqpm.cn
http://www.morning.pwksz.cn.gov.cn.pwksz.cn
http://www.morning.iknty.cn.gov.cn.iknty.cn
http://www.morning.rdwm.cn.gov.cn.rdwm.cn
http://www.morning.rqqn.cn.gov.cn.rqqn.cn
http://www.tj-hxxt.cn/news/278328.html

相关文章:

  • 网站建设平台的分析响应式设计网站
  • 陇西学做网站廊坊网站搭建
  • 网站设计有什么前景聊城建设银行官方网站
  • php html5企业网站源码产品线上推广渠道
  • 手机微信官方网站首页横沥网站仿做
  • 做网站赚钱多吗网站描述技巧
  • asp.net网站开发视频教程低价网站建设案例
  • 珠宝网站建设公司jsp网站开发标准
  • 高端的网站名称电商平台网站开发
  • 信誉好的天津网站建设淘客单网站
  • 北京专业网站维护公司设计网页代码源代码
  • 济南网站制作软件理县网站建设公司
  • 北京营销网站建设公司推荐游戏 火爆游戏
  • 昆明做网站费用wordpress 文档插件
  • 珠海横琴建设局网站自助建站系统搭建网站
  • 沂水网站开发软件开发与应用
  • 网站建设项目实践报告书网络seo优化平台
  • cookie做网站访问量wordpress自动抓取
  • 社交网站cmswordpress+qq微信登陆
  • 德州网站建设哪家专业无锡网络公司有哪些
  • opencart做网站视频在线教育平台网站建设
  • 网站360全景图怎么做长沙互联网企业排名
  • 购物帮做特惠的网站惠城中山网站建设
  • 企业互联网营销推广方案郑州网站排名优化
  • 白酒营销网站厦门网站制作开发收费
  • 生物公司网站建设大良网站设计价格
  • 网站设计的流程简答题云南省建筑信息平台
  • 企业信用公示网上查询平台seo整站优化公司持续监控
  • 用pc做网站服务器为什么不如云主机鹤壁市网站建设
  • 做网站常见问题模板纳米加工平台