LineOffsets (final @NotNull VirtualFile file) { assert !file.getFileType().isBinary(); try { byte[] bytes = file.contentsToByteArray(); final Charset charset = LoadTextUtil.detectCharsetAndSetBOM(file, bytes, file.getFileType()); final byte[] bom = file.getBOM(); final int bomLength = bom == null ? 0 : bom.length; return loadLineOffsets(bytes, charset, bomLength, file.getModificationStamp()); } catch (IOException e) { return new LineOffsets(file.getModificationStamp(), new int[]{0}, new int[]{0}); } }