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.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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
java.net.URLConnection
getConnection()
java.io.File
getFile()
java.io.InputStream
getInputStream()
Returns the input stream containing the resource data.long
getModified()
int
getResponseCode()
State
getState()
java.lang.String
getTag()
Returns the ETag for the retrieved resource, ornull
if the ETag was not provided by the server.java.net.URI
getUrl()
boolean
hasPayload()
boolean
isNotFound()
boolean
isNotModified()
boolean
isOk()
void
throwIt()
java.lang.String
toString()
-
-
-
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, ornull
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 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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-