public String readUTF8Document(final Path path) throws IOException {

        sessionExistsPreCondition(); // throws illegalStateException if no session

        try (Serioulizer.Stream stream = getDocumentStream(path)) {
            if (stream.getLength() == 0) {
                return "";
            }

            if (stream.getMimeType() == null || !stream.getMimeType().contains("charset=UTF-8")) {
                throw new RuntimeException("not an UTF8 document: "+path.toString());
            }

            try (InputStream inputStream = stream.getInputStream()) {
                String content = utf8inputStream2String(inputStream);

                log.info("Document read! path: {}, content: {}", path.toString(), getMax80StringEndingWithEllipsisWhenNeeded(content));

                return content;
            }
        }

    }
public String readUTF8Document ( final Path path ) throws IOException { sessionExistsPreCondition ( ) ; try ( Serioulizer . Stream stream = getDocumentStream ( path ) ) { if ( stream . getLength ( ) == 0 ) { return "" ; } if ( stream . getMimeType ( ) == null || ! stream . getMimeType ( ) . contains ( "charset=UTF-8" ) ) { throw new RuntimeException ( "not an UTF8 document: " + path . toString ( ) ) ; } try ( InputStream inputStream = stream . getInputStream ( ) ) { String content = utf8inputStream2String ( inputStream ) ; log . info ( "Document read! path: {}, content: {}" , path . toString ( ) , getMax80StringEndingWithEllipsisWhenNeeded ( content ) ) ; return content ; } } }
@Override