Code example for ByteArrayOutputStream

Methods: toByteArraywrite

0
 
    @Override 
    public byte[] get(String key) throws IOException {
	File f = new File(mStoreDir, key);
	InputStream is = new BufferedInputStream(new FileInputStream(f));
	ByteArrayOutputStream bos = new ByteArrayOutputStream();
	try { 
	    byte[] data = new byte[1024];
	    is.read(data);
	    bos.write(data);
	} finally { 
	    is.close();
	} 
	return bos.toByteArray();
    } 
 
    @Override 
    public boolean contains(String key) {
	File f = new File(mStoreDir, key);
	return f.exists();
Contextual code suggestions in your IDE  Get Codota for Java