{"id":20474175,"url":"https://github.com/marschall/line-parser","last_synced_at":"2025-04-13T11:32:30.684Z","repository":{"id":57721341,"uuid":"46663160","full_name":"marschall/line-parser","owner":"marschall","description":"a line parser for Java based on mmap()","archived":false,"fork":false,"pushed_at":"2020-09-23T07:33:12.000Z","size":118,"stargazers_count":7,"open_issues_count":8,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T02:43:12.524Z","etag":null,"topics":["file-input","java","lines","mmap"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marschall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-22T14:04:52.000Z","updated_at":"2024-07-29T01:49:23.000Z","dependencies_parsed_at":"2022-09-26T21:41:30.094Z","dependency_job_id":null,"html_url":"https://github.com/marschall/line-parser","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fline-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fline-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fline-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fline-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marschall","download_url":"https://codeload.github.com/marschall/line-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705514,"owners_count":21148549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-input","java","lines","mmap"],"created_at":"2024-11-15T14:28:29.001Z","updated_at":"2025-04-13T11:32:30.663Z","avatar_url":"https://github.com/marschall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"line-parser  [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/line-parser/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/line-parser) [![Javadocs](https://www.javadoc.io/badge/com.github.marschall/line-parser.svg)](https://www.javadoc.io/doc/com.github.marschall/line-parser) [![Build Status](https://travis-ci.org/marschall/line-parser.svg?branch=master)](https://travis-ci.org/marschall/line-parser)\n===========\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.marschall\u003c/groupId\u003e\n    \u003cartifactId\u003eline-parser\u003c/artifactId\u003e\n    \u003cversion\u003e0.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nAn `mmap()` based line parser for cases when:\n\n * the start byte position of a line in the file is required\n * the length in bytes of a line is required\n * only a few character of every line are required\n\nIn these cases this library can theoretically be more efficient than `BufferedReader` because:\n\n * the copy operations of buffered IO are avoided\n * the allocation and resizing of an intermediate `StringBuffer` is avoided\n * the allocation of the final `String` is avoided, only the required substrings\n   are allocated\n\nThe performance may still be slower than a than `BufferedReader` based approach but it should consume much less memory bandwidth and produce only a fraction of the garbage.\n\nAs this project gives you a `CharSequence` instead of a `String` you may want to have a look at the [charsequences](https://github.com/marschall/charsequences) which gives you some the `String` convenience methods while avoiding allocation.\n\nMisc\n----\n\n * the main parsing loop is likely to benefit from [on-stack replacement (OSR)](http://openjdk.java.net/groups/hotspot/docs/HotSpotGlossary.html#onStackReplacement)\n * if you're using UTF-8 with a [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) then the BOM is returned as well\n * if you're using UTF-16 with a [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) then the BOM is returned as well\n * the library runs on Java 8 but is also a Java 9 module that only requires the `jdk.unsupported` module besides the `java.base` module\n\nUsage\n-----\n\n```java\nLineParser parser = new LineParser();\nparser.forEach(path, cs, (line) -\u003e {\n  System.out.printf(\"[%d,%d]%s%n\", line.getOffset(), line.getLength(), line.getContent());\n});\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarschall%2Fline-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarschall%2Fline-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarschall%2Fline-parser/lists"}