/j2cl-java-net

A minimalist J2cl implementation of some of the classes within java.net

Primary LanguageJavaApache License 2.0Apache-2.0

Build Status Coverage Status License Language grade: Java Total alerts J2CL compatible

java.net for j2cl

An emulation of some of the classes in the java.net package. More may be added in the future, while many such as java.net.SocketServer will never make any sense within a browser.

Source code were copied from the Apache Harmony project with numerous patches made to ensure the behaviour of both the JRE and the emulated class are identical. The java.net.URL required some patches to handle several edge cases, such as handling of missing components, such as an empty host. Tests are provided to verify both do the same thing with the same parameters.

  • MalformedURLException
  • URI
  • URL
  • URLDecoder
  • URLEncoder

The java.net.URLStreamHandler is absent as one of its primary functionalities is to handle connectivity to a resource on a network.

walkingkooka.j2cl.java.net

  • The package walkingkooka.j2cl.java.net is shaded to java.net.

URL

URL should only be used to parse java.lang.String. All network connectivity and interaction methods have been removed. Customization depending on the protocol portion of a URL via a java.net.URLStreamHandler is not possible and all methods with it have been removed.

Methods

  • java.net.URLStreamHandler ctor methods are absent
  • getContent absent.
  • openConnection absent.
  • openStream absent.
  • setURLStreamHandlerFactory absent.