How to upload and download image from habase?
2010-04-28 14:45
429 查看
public static void transformImage(HTable table) throws IOException { // upload String dirName = "/home/alex"; File file = new File("/home/alex/test.jpg"); FileInputStream fis = new FileInputStream(file); byte[] buf = new byte[(int) file.length()]; fis.read(buf); Put put = new Put(Bytes.toBytes("1")); put.add(Bytes.toBytes("image"), Bytes.toBytes("image"), buf); table.put(put); // download Get get = new Get(Bytes.toBytes("1")); get.addColumn(Bytes.toBytes("image"), Bytes.toBytes("image")); Result rs = table.get(get); byte[] value = rs.getValue(Bytes.toBytes("image"), Bytes .toBytes("image")); FileOutputStream fos = new FileOutputStream( "/home/alex/getFromHbase.jpg"); fos.write(value); } |
相关文章推荐
- How to Display Image In Picturebox in VC++ from Iplimage and Mat
- How to Display Image In Picturebox in VC++ from Iplimage and Mat
- Openstack: python API “how to download image from glance using the python api”
- How.To.Process.Image.Infomation.Of.Rotate.And.Flip.From.Server
- How To Use XDOLoader to Manage, Download and Upload Files? (DOC ID 469585.1)
- How do I upload or download XML to/from a database
- Android:How to upload .mp3 file and image to http server?
- If you whant to download SIS, JAR and JAD file from WAP you have to upload file (in the same catalog) with this: [小糊涂的灵感]
- How To Use XDOLoader to Manage, Download and Upload Files? (文档 ID 469585.1)
- How to read images from drawable folder, not by R.drawable.[imageid]
- How to make 9-patch image downloaded from the Network
- How to extract controlfiles, datafiles, and archived logs from SMR backupsets without using RMAN
- To compile Boost.Python yourself download boost from boost.org and then go into the boost root fold
- How to download and compile Android kernel goldfish ?
- How to use virtual path providers to dynamically load and compile content from virtual paths in
- Converting Image File Format From GHO to VMDK and From VMDK to GHO
- How to download Xcode 4 / 5 / 6 / 7 and get the DMG file?
- Howto Setup yum repositories to update or install package from ISO CDROM Image
- JSP URI/URL - How to get the request URI, URL, and Context from a JSP
- How to make 9-patch image downloaded from the Network