Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.storm.blobstore.BlobStoreFile

    public void testGetFileLength() throws IOException {

FileSystem fs = dfscluster.getFileSystem();

Map conf = new HashMap();

String validKey = "validkeyBasic";

String testString = "testingblob";

TestHdfsBlobStoreImpl hbs = new TestHdfsBlobStoreImpl(blobDir, conf, hadoopConf);

BlobStoreFile pfile = hbs.write(validKey, false);

SettableBlobMeta meta = new SettableBlobMeta();

meta.set_replication_factor(1);

pfile.setMetadata(meta);

OutputStream ios = pfile.getOutputStream();

ios.write(testString.getBytes(Charset.forName("UTF-8")));

ios.close();

assertEquals(testString.getBytes(Charset.forName("UTF-8")).length, pfile.getFileLength());

}


   Like      Feedback      org.apache.storm.blobstore.BlobStoreFile



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner