91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

以hadoop、hbase為基礎,hdfs存儲文件,hbase存儲相應索引,使用分詞技術,實現視頻的存儲及索引,這是一個簡單的web項目,歡迎交流學習:770838433

資源截圖

代碼片段和文件信息

package?com.util;

import?java.io.BufferedInputStream;
import?java.io.FileInputStream;
import?java.io.FileNotFoundException;
import?java.io.FileOutputStream;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.OutputStream;
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.FileStatus;
import?org.apache.hadoop.fs.FileSystem;
import?org.apache.hadoop.fs.Path;
import?org.apache.hadoop.io.IOUtils;
import?org.apache.hadoop.util.Progressable;

public?class?HdsfAPI?{

/**?上傳文件到HDFS上去?*/

private?static?void?uploadToHdfs(){
String?localSrc?=?“/usr/test/image/1.jpg“;
String?dst?=?“hdfs://localhost:9000/input/image/1.jpg“;
try?{
InputStream?in?=?new?BufferedInputStream(new?FileInputStream(localSrc));
Configuration?conf?=?new?Configuration();
FileSystem?fs?=?FileSystem.get(URI.create(dst)?conf);
OutputStream?out?=?fs.create(new?Path(dst)?new?Progressable()?{
public?void?progress()?{
System.out.print(“.“);
}
});
IOUtils.copyBytes(in?out?4096?true);
}?catch?(FileNotFoundException?e)?{
e.printStackTrace();
}?catch?(IOException?e)?{
e.printStackTrace();
}
}

/**?從HDFS上讀取文件到本地*/
private?static?void?readFromHdfs()?throws?FileNotFoundException
IOException?{
String?dst?=?“hdfs://localhost:9000/input/image/1.jpg“;
Configuration?conf?=?new?Configuration();
FileSystem?fs?=?FileSystem.get(URI.create(dst)?conf);
FSDataInputStream?hdfsInStream?=?fs.open(new?Path(dst));
OutputStream?out?=?new?FileOutputStream(“/usr/test/image/1.jpg“);
byte[]?ioBuffer?=?new?byte[1024];
int?readLen?=?hdfsInStream.read(ioBuffer);
while?(-1?!=?readLen)?{
out.write(ioBuffer?0?readLen);
readLen?=?hdfsInStream.read(ioBuffer);
}
out.close();
hdfsInStream.close();
fs.close();
}



/*private?static?void?appendToHdfs()?throws?FileNotFoundException
IOException?{
String?dst?=?“hdfs://localhost:9000/input/uploadToHdfs.txt“;
Configuration?conf?=?new?Configuration();
FileSystem?fs?=?FileSystem.get(URI.create(dst)?conf);
FSDataOutputStream?out?=?fs.append(new?Path(dst));
int?readLen?=?“huangyicong?append?this?file?!“.getBytes().length;
while?(-1?!=?readLen)?{
out.write(“huangyicong?append?this?file?!“.getBytes()?0?readLen);
}
out.close();
fs.close();
}*/

/**?從HDFS上刪除文件?*/
private?static?void?deleteFromHdfs()?throws?FileNotFoundException
IOException?{
String?dst?=?“hdfs://localhost:9000/user/root“;
Configuration?conf?=?new?Configuration();
FileSystem?fs?=?FileSystem.get(URI.create(dst)?conf);
fs.deleteOnExit(new?Path(dst));
fs.close();
}

/**?遍歷HDFS上的文件和目錄?*/
private?static?void?getDirectoryFromHdfs()?throws?FileNotFoundException
IOException?{
String?dst?=?“hdfs://localhost:9000/input/image“;
Configuration?conf?=?new?Configuration();
FileSystem?fs?=?FileSystem.get(URI.create(dst)?conf);
File

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-05-09?21:25??HbaseVideo\
?????文件????????1075??2015-05-06?12:52??HbaseVideo\.classpath
?????文件????????1007??2015-05-06?12:10??HbaseVideo\.project
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\.settings\
?????文件?????????491??2015-05-06?12:10??HbaseVideo\.settings\.jsdtscope
?????文件?????????357??2015-05-06?12:10??HbaseVideo\.settings\org.eclipse.jdt.core.prefs
?????文件?????????475??2015-05-06?12:10??HbaseVideo\.settings\org.eclipse.wst.common.component
?????文件?????????335??2015-05-06?12:10??HbaseVideo\.settings\org.eclipse.wst.common.project.facet.core.xml
?????文件??????????49??2015-05-06?12:10??HbaseVideo\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2015-05-06?12:10??HbaseVideo\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件?????????498??2015-05-09?21:38??HbaseVideo\README.txt
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\analyseWords\
?????文件????????1067??2015-05-07?01:50??HbaseVideo\src\com\util\analyseWords\AnalyseWords.java
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\commonUtil\
?????文件????????2098??2015-05-08?19:07??HbaseVideo\src\com\util\commonUtil\CommonUtil.java
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\ffmpegUtil\
?????文件????????1813??2015-05-04?23:59??HbaseVideo\src\com\util\ffmpegUtil\FfmpegUtil.java
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\HbaseUtil\
?????文件????????2532??2015-05-05?20:07??HbaseVideo\src\com\util\HbaseUtil\HbaseUtil.java
?????文件????????3620??2015-05-06?13:09??HbaseVideo\src\com\util\HdsfAPI.java
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\similarityUtil\
?????文件????????1647??2012-08-05?15:09??HbaseVideo\src\com\util\similarityUtil\SimilarityUtil.java
?????文件????????4163??2015-05-08?18:40??HbaseVideo\src\com\util\TestHbase.java
?????目錄???????????0??2015-05-09?21:19??HbaseVideo\src\com\util\videoUtil\
?????文件????????3406??2015-05-09?01:06??HbaseVideo\src\com\util\videoUtil\VideoUtil.java
?????文件?????????414??2012-02-14?11:21??HbaseVideo\src\IKAnalyzer.cfg.xml
?????文件?????????241??2015-05-08?20:59??HbaseVideo\src\ipConfig.properties
?????文件?????????161??2011-04-15?16:39??HbaseVideo\src\stopword.dic
............此處省略102個文件信息

評論

共有 條評論