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.
    Author:
    Neil Bartlett
    • 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)  
    • 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

      • 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