code: @Override
      public long write(final InputStream _in,
                        final long _size,
                        final String _fileName)
          throws EFapsException
      {
          long size = _size;
          try {
              final Binary bin = getBinary(_in);
              final Node resNode;
              if (this.identifier == null) {
                  final Node fileNode = getFolderNode().addNode(getInstance().getOid(), NodeType.NT_FILE);
                  setIdentifer(fileNode.getIdentifier());
                  resNode = fileNode.addNode(Property.JCR_CONTENT, NodeType.NT_RESOURCE);
              } else {
                  final Node fileNode = getSession().getNodeByIdentifier(this.identifier);
                  resNode = fileNode.getNode(Property.JCR_CONTENT);
              }
              resNode.setProperty(Property.JCR_DATA, bin);
              resNode.setProperty(Property.JCR_ENCODING, "UTF-8");
              resNode.setProperty(Property.JCR_LAST_MODIFIED, Calendar.getInstance());
              resNode.setProperty(Property.JCR_LAST_MODIFIED_BY, Context.getThreadContext().getPerson().getName());
              // if size is unkown!
              if (size < 0)  {
                  final byte[] buffer = new byte[1024];
                  int length = 1;
                  size = 0;
                  final OutputStream out = new ByteArrayOutputStream();
                  while (length > 0)  {
                      length = _in.read(buffer);
                      if (length > 0)  {
                          out.write(buffer, 0, length);
                          size += length;
                      }
                  }
              }
          } catch (final RepositoryException e) {
              throw new EFapsException(JCRStoreResource.class, "write.RepositoryException", e);
          } catch (final IOException e) {
              throw new EFapsException(JCRStoreResource.class, "write.IOException", e);
          }
          setFileInfo(_fileName, size);
          return size;
      }
docs: {@inheritDoc}