// ------------------------------------------------------------------------
private BeeResource encodeResource(final String targetFileName,
final InputStream is, final String secret) {
try {
final BeeResource result;
if (StringUtils.hasText(targetFileName)) {
result = new BeeResource(targetFileName);
result.mkdirs();
} else {
result = BeeLocalStore.getInstance().getTempResource();
}
final OutputStream os = result.openOutputStream();
try {
int total = 0;
// write bytes
byte[] data;
while ((data = BeeResource.getNext(is, ENCODEBUFFER)).length > 0) {