LineOffsets (final byte @NotNull [] bytes, final @NotNull Charset charset, final int startOffset, final long modificationStamp) { ByteBuffer byteBuffer = ByteBuffer.wrap(bytes, startOffset, bytes.length - startOffset); CharBuffer charBuffer; try { charBuffer = charset.decode(byteBuffer); } catch (Exception e) { // esoteric charsets can throw any kind of exception charBuffer = CharBuffer.wrap(ArrayUtilRt.EMPTY_CHAR_ARRAY); } return loadLineOffsets(charBuffer, modificationStamp); }