Class URLResource

  • All Implemented Interfaces:
    Resource, java.io.Closeable, java.lang.AutoCloseable

    public class URLResource
    extends java.lang.Object
    implements Resource
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteBuffer buffer  
      private static java.nio.ByteBuffer CLOSED  
      private java.lang.String extra  
      private long lastModified  
      private int size  
      private java.net.URL url  
    • Constructor Summary

      Constructors 
      Constructor Description
      URLResource​(java.net.URL url)  
    • Field Detail

      • CLOSED

        private static final java.nio.ByteBuffer CLOSED
      • buffer

        private java.nio.ByteBuffer buffer
      • url

        private final java.net.URL url
      • extra

        private java.lang.String extra
      • lastModified

        private long lastModified
      • size

        private int size
    • Constructor Detail

      • URLResource

        public URLResource​(java.net.URL url)
    • Method Detail

      • buffer

        public java.nio.ByteBuffer buffer()
                                   throws java.lang.Exception
        Specified by:
        buffer in interface Resource
        Throws:
        java.lang.Exception
      • getBuffer

        private java.nio.ByteBuffer getBuffer()
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • openConnection

        private java.net.URLConnection openConnection()
                                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • openInputStream

        public java.io.InputStream openInputStream()
                                            throws java.lang.Exception
        Specified by:
        openInputStream in interface Resource
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • write

        public void write​(java.io.OutputStream out)
                   throws java.lang.Exception
        Specified by:
        write in interface Resource
        Throws:
        java.lang.Exception
      • getExtra

        public java.lang.String getExtra()
        Specified by:
        getExtra in interface Resource
      • setExtra

        public void setExtra​(java.lang.String extra)
        Specified by:
        setExtra in interface Resource
      • size

        public long size()
                  throws java.lang.Exception
        Specified by:
        size in interface Resource
        Throws:
        java.lang.Exception
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException