Class LocalImagesService

java.lang.Object
com.google.appengine.tools.development.AbstractLocalRpcService
com.google.appengine.api.images.dev.LocalImagesService
All Implemented Interfaces:
LocalRpcService

@AutoService(LocalRpcService.class) public final class LocalImagesService extends AbstractLocalRpcService
Java stub implementation of the images api backend using Image 2D. Depends on ImageIO being able to load and save in the correct image formats.
  • Field Details

  • Constructor Details

    • LocalImagesService

      public LocalImagesService()
  • Method Details

    • getPackage

      public String getPackage()
      Returns the package for the service, for example, "datastore_v3".
      Returns:
      a not null package name.
    • init

      public void init(LocalServiceContext context, Map<String,String> properties)
      Initializes the service with a set of configuration properties. Must be called before a service is started.
      Specified by:
      init in interface LocalRpcService
      Overrides:
      init in class AbstractLocalRpcService
      Parameters:
      context - A context object for the application
      properties - A read-only Map of properties.
    • start

      public void start()
      Puts a new service into "serving" mode. Aside from setting properties, the service is not functional until after having been started.
      Specified by:
      start in interface LocalRpcService
      Overrides:
      start in class AbstractLocalRpcService
    • stop

      public void stop()
      Stops the service, releasing all of its resources.
      Specified by:
      stop in interface LocalRpcService
      Overrides:
      stop in class AbstractLocalRpcService
    • transform

      public com.google.appengine.api.images.ImagesServicePb.ImagesTransformResponse transform(LocalRpcService.Status status, com.google.appengine.api.images.ImagesServicePb.ImagesTransformRequest request)
      Apply the transform request to the contained image.
      Parameters:
      status - RPC status
      request - request to be processed
      Returns:
      a transform response containing the processed image
    • composite

      public com.google.appengine.api.images.ImagesServicePb.ImagesCompositeResponse composite(LocalRpcService.Status status, com.google.appengine.api.images.ImagesServicePb.ImagesCompositeRequest request)
      Parameters:
      status - RPC status
      request - request to be processed
      Returns:
      a transform response containing the processed image
    • getMimeType

      public String getMimeType(com.google.appengine.api.images.ImagesServicePb.ImageData imageData)
      Obtains the mime type of the image data.
      Parameters:
      imageData - a reference to the image
      Returns:
      a string representing the mime type. Valid return values include inputFormats in LocalImagesService.init().
      Throws:
      com.google.apphosting.api.ApiProxy.ApplicationException - If the image cannot be opened
    • openImage

      public BufferedImage openImage(com.google.appengine.api.images.ImagesServicePb.ImageData imageData, LocalRpcService.Status status)
      Loads an image represented by a byte array into a BufferedImage.
      Parameters:
      imageData - A byte array representing an image
      status - RPC status
      Returns:
      a BufferedImage of the image.
      Throws:
      com.google.apphosting.api.ApiProxy.ApplicationException - If the image cannot be opened.
    • saveImage

      public byte[] saveImage(BufferedImage image, com.google.appengine.api.images.ImagesServicePb.OutputSettings.MIME_TYPE mimeType, LocalRpcService.Status status)
      Saves a BufferedImage into a byte array using the mimeType encoding.
      Parameters:
      image - the image to be encoded.
      status - RPC status.
      Returns:
      A byte array representing an image.
      Throws:
      com.google.apphosting.api.ApiProxy.ApplicationException - If the image cannot be encoded.
    • histogram

      public com.google.appengine.api.images.ImagesServicePb.ImagesHistogramResponse histogram(LocalRpcService.Status status, com.google.appengine.api.images.ImagesServicePb.ImagesHistogramRequest request)
      Calculate the histogram of the supplied image.
      Parameters:
      status - RPC status
      request - request to be processed
      Returns:
      a histogram response containing the histogram of the image
    • getUrlBase

      public com.google.appengine.api.images.ImagesServicePb.ImagesGetUrlBaseResponse getUrlBase(LocalRpcService.Status status, com.google.appengine.api.images.ImagesServicePb.ImagesGetUrlBaseRequest request)
      Gets a Local image URL.
      Parameters:
      status - RPC status
      request - request containing the blobkey to be served
      Returns:
      a response containing the Local image Url
    • deleteUrlBase

      public com.google.appengine.api.images.ImagesServicePb.ImagesDeleteUrlBaseResponse deleteUrlBase(LocalRpcService.Status status, com.google.appengine.api.images.ImagesServicePb.ImagesDeleteUrlBaseRequest request)
    • getMaxApiRequestSize

      public Integer getMaxApiRequestSize()
      Description copied from interface: LocalRpcService
      Returns the maximum size of an encoded API request in bytes, or null for the default size.
      Specified by:
      getMaxApiRequestSize in interface LocalRpcService
      Overrides:
      getMaxApiRequestSize in class AbstractLocalRpcService
    • processTransform

      public BufferedImage processTransform(BufferedImage image, com.google.appengine.api.images.ImagesServicePb.Transform transform, LocalRpcService.Status status)
      Apply an individual transform to the provided image.
      Parameters:
      image - image to be processed
      transform - transform to be applied to the image
      status - RPC status
      Returns:
      processed image