Add javadocs to make contract more clear
Fix line-end detection for binary streams upload.

- Related: #1016