Class SpeedTestResourceLoader

java.lang.Object
net.targetr.wtm3.io.loader.SpeedTestResourceLoader
All Implemented Interfaces:
ResourceLoader

public class SpeedTestResourceLoader extends Object implements ResourceLoader
Generates random bytes for download speed tests.
  • Constructor Details

    • SpeedTestResourceLoader

      public SpeedTestResourceLoader(int maxSizeBytes)
      Constructs a loader with a limit for sizes requested in the resource path. Paths without an explicit size generate 1 MiB of data.
      Parameters:
      maxSizeBytes - the upper limit in bytes for an explicitly requested size
  • Method Details

    • openInputStream

      public InputStream openInputStream(String path) throws IOException
      Description copied from interface: ResourceLoader
      Opens a resource stream. The caller is responsible for closing the returned stream.
      Specified by:
      openInputStream in interface ResourceLoader
      Parameters:
      path - the resource path understood by this loader
      Returns:
      a stream containing the resource data, or null if the resource is not found
      Throws:
      IOException - if opening or reading the resource fails
    • getSource

      public String getSource()
      Description copied from interface: ResourceLoader
      Returns the resource source.
      Specified by:
      getSource in interface ResourceLoader
      Returns:
      a string representing the source resources are loaded from