FeatureCollection.fromJson() should also accept a 'Reader' parameter
還沒有人認領這個 Issue。
評估
研究方向
閱讀 services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java 和現有的 fromJson(String) 入口點。使用所示的 Gson 適配器設定新增 Reader 多載,接著執行相關的專案測試,並確認 Reader 輸入會產生 FeatureCollection,同時不改變現有的 String 行為。
由索引模型根據 Issue 內容生成。
描述
Currently a FeatureCollection can not be instantiated from a Reader.
The only function provided requires a String in JSON format as can be seen here.
Such approach is inefficient when reading larger files since the entire file content has to be read and stored in memory before it can be transformed into a FeatureCollection.
If a FeatureCollection could be instantiated from a Reader aswell, only parts of the read file would have to be stored in memory which makes this the more desirable approach in the presented situation.
As the used GSON library already enables the use of a Reader instead of a String, the implementation would be very simple and could look like this:
@Nullable
public static FeatureCollection fromJson(@NonNull Reader reader) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
gson.registerTypeAdapterFactory(GeometryAdapterFactory.create());
return gson.create().fromJson(reader, FeatureCollection.class);
}
- 主要語言
- Java
- 星號
- 438
- 分支
- 117
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
mapbox/mapbox-java 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
mapbox/mapbox-java#1640 ·
-
難度 4/5 3-5 天 新手友好度 55/100
mapbox/mapbox-java#1635 ·
-
難度 5/5 一週以上 新手友好度 15/100
mapbox/mapbox-java#1619 ·
-
Mapbox-java incompatible with gson 2.13.0 and up - call to internal GSON classes that were renamed未關閉
難度 2/5 1-3 小時 新手友好度 48/100
mapbox/mapbox-java#1614 · 2 則留言 · 1 個 reaction ·
-
難度 5/5 一週以上 新手友好度 20/100
mapbox/mapbox-java#1612 · 1 個 reaction ·
查看 mapbox/mapbox-java 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
checkstyle/checkstyle#21755 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
agentic-workflows
難度 2/5 1-3 小時 新手友好度 68/100
github/copilot-sdk#2782 ·
維護者通常 1 天內回覆
-
documentation Good for newcomer quick win
難度 2/5 1-3 小時 新手友好度 68/100
CodeForPhilly/benefit-decision-toolkit#519 ·
維護者通常 1 天內回覆
-
area-deployment triage:bot-seen triage:needs-human
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/aspire#20533 · 1 則留言 ·
維護者通常 1 天內回覆