com.giraone.io.copier.web.index.AutoIndexReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of file-tree-copier Show documentation
Show all versions of file-tree-copier Show documentation
Utility JAR for copying a file tree from web server or from classpath resources to a (local) file system.
The newest version!
package com.giraone.io.copier.web.index;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class AutoIndexReader {
private static final TypeReference> listAutoIndexItemTypeRef
= new TypeReference<>() {
};
private static final ObjectMapper objectMapper = buildObjectMapper();
public AutoIndexReader() {
}
public List read(InputStream in) throws IOException {
return objectMapper.readValue(in, listAutoIndexItemTypeRef);
}
private static ObjectMapper buildObjectMapper() {
final ObjectMapper mapper = new ObjectMapper();
// Be tolerant in reading
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// Date/Date-Time settings
mapper.registerModule(new JavaTimeModule());
return mapper;
}
}