Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSCommon
Commits
81e40af0
Commit
81e40af0
authored
7 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Changed file reading method to token by token (SAXish)
parent
4e09b490
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/no/nibio/vips/util/test/WeatherDataFileReader.java
+12
-2
12 additions, 2 deletions
...n/java/no/nibio/vips/util/test/WeatherDataFileReader.java
with
12 additions
and
2 deletions
src/main/java/no/nibio/vips/util/test/WeatherDataFileReader.java
+
12
−
2
View file @
81e40af0
...
...
@@ -21,6 +21,7 @@ package no.nibio.vips.util.test;
import
com.fasterxml.jackson.core.JsonFactory
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.core.JsonToken
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.MappingJsonFactory
;
...
...
@@ -115,9 +116,18 @@ public class WeatherDataFileReader {
BufferedInputStream
inputStream
=
new
BufferedInputStream
(
this
.
getClass
().
getResourceAsStream
(
weatherDataFileName
));
JsonFactory
f
=
new
MappingJsonFactory
();
JsonParser
jp
=
f
.
createParser
(
inputStream
);
JsonNode
all
=
jp
.
readValueAsTree
();
ObjectMapper
mapper
=
new
ObjectMapper
();
List
<
PointWeatherObservationList
>
theList
=
mapper
.
convertValue
(
all
,
new
TypeReference
<
List
<
PointWeatherObservationList
>>(){});
List
<
PointWeatherObservationList
>
theList
=
new
ArrayList
<>();
jp
.
nextToken
();
// Jumping past the START_ARRAY
while
(
jp
.
nextToken
()
!=
JsonToken
.
END_ARRAY
)
{
PointWeatherObservationList
list
=
jp
.
readValueAs
(
PointWeatherObservationList
.
class
);
theList
.
add
(
list
);
//System.out.println(jp.toString());
}
//JsonNode all = jp.readValueAsTree();
//List<PointWeatherObservationList> theList = mapper.convertValue(all, new TypeReference<List<PointWeatherObservationList>>(){});
config
.
setConfigParameter
(
"multiPointWeatherObservations"
,
theList
);
return
config
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment