Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Jackson Data Binding Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Databind Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/ext/NioPathDeserializer.java
package com.fasterxml.jackson.databind.ext;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.spi.FileSystemProvider;
import java.util.ServiceLoader;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;
import static java.lang.Character.isLetter;
/**
* @since 2.8
*/
public class NioPathDeserializer extends StdScalarDeserializer<Path>
{
private static final long serialVersionUID = 1;
private static final boolean areWindowsFilePathsSupported;
static {
boolean isWindowsRootFound = false;
for (File file : File.listRoots()) {
String path = file.getPath();
if (path.length() >= 2 && isLetter(path.charAt(0)) && path.charAt(1) == ':') {
isWindowsRootFound = true;
break;
}
}
areWindowsFilePathsSupported = isWindowsRootFound;
}
public NioPathDeserializer() { super(Path.class); }
@Override
public Path deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
if (!p.hasToken(JsonToken.VALUE_STRING)) {
return (Path) ctxt.handleUnexpectedToken(Path.class, p);
}
final String value = p.getText();
// If someone gives us an input with no : at all, treat as local path, instead of failing
// with invalid URI.
if (value.indexOf(':') < 0) {
return Paths.get(value);
}
if (areWindowsFilePathsSupported) {
if (value.length() >= 2 && isLetter(value.charAt(0)) && value.charAt(1) == ':') {
return Paths.get(value);
}
}
final URI uri;
try {
uri = new URI(value);
} catch (URISyntaxException e) {
return (Path) ctxt.handleInstantiationProblem(handledType(), value, e);
}
try {
return Paths.get(uri);
} catch (FileSystemNotFoundException cause) {
try {
final String scheme = uri.getScheme();
// We want to use the current thread's context class loader, not system class loader that is used in Paths.get():
for (FileSystemProvider provider : ServiceLoader.load(FileSystemProvider.class)) {
if (provider.getScheme().equalsIgnoreCase(scheme)) {
return provider.getPath(uri);
}
}
return (Path) ctxt.handleInstantiationProblem(handledType(), value, cause);
} catch (Throwable e) {
e.addSuppressed(cause);
return (Path) ctxt.handleInstantiationProblem(handledType(), value, e);
}
} catch (Throwable e) {
return (Path) ctxt.handleInstantiationProblem(handledType(), value, e);
}
}
}
⏎ com/fasterxml/jackson/databind/ext/NioPathDeserializer.java
Or download all of them as a single archive file:
File name: jackson-databind-2.14.0-sources.jar File size: 1187952 bytes Release date: 2022-11-05 Download
⇒ Jackson Annotations Source Code
⇐ Download and Install Jackson Binary Package
2022-03-29, ≈232🔥, 0💬
Popular Posts:
How to download and install xml-commons External Source Package? The source package contains Java so...
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
JDK 11 jdk.crypto.ec.jmod is the JMOD file for JDK 11 Crypto EC module. JDK 11 Crypto EC module comp...