Package aQute.bnd.service.url
Class TaggedData
- java.lang.Object
-
- aQute.bnd.service.url.TaggedData
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class TaggedData extends java.lang.Object implements java.io.CloseableRepresents 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.net.URLConnectiongetConnection()java.io.FilegetFile()java.io.InputStreamgetInputStream()Returns the input stream containing the resource data.longgetModified()intgetResponseCode()StategetState()java.lang.StringgetTag()Returns the ETag for the retrieved resource, ornullif the ETag was not provided by the server.java.net.URIgetUrl()booleanhasPayload()booleanisNotFound()booleanisNotModified()booleanisOk()voidthrowIt()java.lang.StringtoString()
-
-
-
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, ornullif the ETag was not provided by the server.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionReturns 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:
toStringin classjava.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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-