Class TaggedData

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

    public class TaggedData
    extends java.lang.Object
    implements java.io.Closeable
    Represents a data stream that has a tag associated with it; the primary use-case is an HTTP response stream with an ETag header.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.net.URLConnection con  
      (package private) static java.util.regex.Pattern ENTITIES_P  
      private java.lang.String etag  
      private java.io.File file  
      (package private) static java.util.regex.Pattern HTML_TAGS_P  
      private java.io.InputStream in  
      private java.lang.String message  
      (package private) static java.util.regex.Pattern NEWLINES_P  
      private int responseCode  
      private java.net.URI url  
    • Constructor Summary

      Constructors 
      Constructor Description
      TaggedData​(java.lang.String tag, java.io.InputStream inputStream)
      Deprecated.
      TaggedData​(java.lang.String tag, java.io.InputStream inputStream, int responseCode)
      Deprecated.
      TaggedData​(java.lang.String tag, java.io.InputStream inputStream, int responseCode, long modified, java.net.URI url)
      Deprecated.
      TaggedData​(java.net.URI url, int responseCode, java.io.File file)  
      TaggedData​(java.net.URLConnection con, java.io.InputStream in)  
      TaggedData​(java.net.URLConnection con, java.io.InputStream in, java.io.File file)  
    • Field Detail

      • con

        private final java.net.URLConnection con
      • responseCode

        private final int responseCode
      • etag

        private final java.lang.String etag
      • in

        private final java.io.InputStream in
      • url

        private final java.net.URI url
      • file

        private final java.io.File file
      • message

        private final java.lang.String message
      • HTML_TAGS_P

        static final java.util.regex.Pattern HTML_TAGS_P
      • NEWLINES_P

        static final java.util.regex.Pattern NEWLINES_P
      • ENTITIES_P

        static final java.util.regex.Pattern ENTITIES_P
    • Constructor Detail

      • TaggedData

        @Deprecated
        public TaggedData​(java.lang.String tag,
                          java.io.InputStream inputStream,
                          int responseCode,
                          long modified,
                          java.net.URI url)
        Deprecated.
      • TaggedData

        @Deprecated
        public TaggedData​(java.lang.String tag,
                          java.io.InputStream inputStream,
                          int responseCode)
        Deprecated.
      • TaggedData

        @Deprecated
        public TaggedData​(java.lang.String tag,
                          java.io.InputStream inputStream)
        Deprecated.
      • TaggedData

        public TaggedData​(java.net.URLConnection con,
                          java.io.InputStream in)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • TaggedData

        public TaggedData​(java.net.URLConnection con,
                          java.io.InputStream in,
                          java.io.File file)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • TaggedData

        public TaggedData​(java.net.URI url,
                          int responseCode,
                          java.io.File file)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • getMessage

        private java.lang.String getMessage​(java.net.URLConnection con)
      • cleanHtml

        private java.lang.String cleanHtml​(java.lang.CharSequence sb)
      • entity

        private java.lang.String entity​(java.lang.String name)
      • getTag

        public java.lang.String getTag()
        Returns the ETag for the retrieved resource, or null if the ETag was not provided by the server.
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Returns the input stream containing the resource data.
        Throws:
        java.io.IOException
      • getResponseCode

        public int getResponseCode()
      • getModified

        public long getModified()
      • hasPayload

        public boolean hasPayload()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getUrl

        public java.net.URI getUrl()
      • getConnection

        public java.net.URLConnection getConnection()
      • toString

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

        public boolean isOk()
      • isNotModified

        public boolean isNotModified()
      • throwIt

        public void throwIt()
      • getState

        public State getState()
      • isNotFound

        public boolean isNotFound()
      • getFile

        public java.io.File getFile()
      • 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