Class AImage

    • Constructor Summary

      Constructors 
      Constructor Description
      AImage​(java.io.File file)
      Constructs an image with a file.
      AImage​(java.lang.String filename)
      Constructs an image with a file name.
      AImage​(java.lang.String name, byte[] data)
      Constructs an image with a byte array.
      AImage​(java.lang.String name, java.io.InputStream is)
      Constructs an image with an input stream.
      AImage​(java.net.URL url)
      Constructs an image with an URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getByteData()
      Returns the raw data in byte array.
      java.lang.String getContentType()
      Returns the content type, e.g., "image/jpeg", or null if not available.
      java.lang.String getFormat()
      Returns the format name, e.g., "jpeg", or null if not available.
      int getHeight()
      Returns the height.
      java.lang.String getName()
      Returns the name (usually filename) of this media, or null if not available.
      java.io.Reader getReaderData()
      Always throws IllegalStateException.
      java.io.InputStream getStreamData()
      Return a ByteArrayInputStream that contains data of getByteData().
      java.lang.String getStringData()
      Always throws IllegalStateException.
      int getWidth()
      Returns the width.
      boolean inMemory()
      Returns whether the data is cached in memory (in form of byte[] or String).
      boolean isBinary()
      Returns whether the format of this content is binary or text-based.
      boolean isContentDisposition()
      Whether to allow Content-Disposition or not when writing the media to response header.
      javax.swing.ImageIcon toImageIcon()
      Converts to an image icon.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AImage

        public AImage​(java.lang.String name,
                      byte[] data)
               throws java.io.IOException
        Constructs an image with a byte array.
        Throws:
        java.io.IOException
      • AImage

        public AImage​(java.lang.String name,
                      java.io.InputStream is)
               throws java.io.IOException
        Constructs an image with an input stream.

        Note that this method automatically closes the input stream (since ZK 3.0.0).

        Throws:
        java.io.IOException
      • AImage

        public AImage​(java.lang.String filename)
               throws java.io.IOException
        Constructs an image with a file name.
        Throws:
        java.io.IOException
      • AImage

        public AImage​(java.io.File file)
               throws java.io.IOException
        Constructs an image with a file.
        Throws:
        java.io.IOException
      • AImage

        public AImage​(java.net.URL url)
               throws java.io.IOException
        Constructs an image with an URL.
        Throws:
        java.io.IOException