public abstract class ResourceType extends Object
Modifier and Type | Field and Description |
---|---|
static ResourceType |
RTYPE_CDF
Resource type for table.load.cdf.
|
static ResourceType |
RTYPE_FITS
Resource type for image.load.fits.
|
static ResourceType |
RTYPE_VOTABLE
Resource type for table.load.votable.
|
Constructor and Description |
---|
ResourceType(String name,
String mtype,
String[] ctypes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Message |
createMessage(URL url)
Returns a Message object that will forward a given URL to SAMP
clients.
|
static ResourceType[] |
getKnownResourceTypes()
Returns the known resource types.
|
String |
getMType()
Returns the MType of the message to be constructed.
|
String |
getName()
Returns the name of this resource type.
|
boolean |
isContentType(String ctype)
Indicates whether this resource type is suitable for use
with a given MIME type.
|
abstract boolean |
isMagic(byte[] magic)
Indicates whether this resource type is suitable for use
with a resource having a given magic number.
|
static ResourceType |
readContentResourceType(URL url)
Attempts to determine the resource type of a given URL by
downloading the first part of its content and examining the
magic number.
|
static ResourceType |
readHeadResourceType(URL url)
Attempts to determine the resource type of a given URL by
making an HTTP HEAD request and looking at the Content-Type.
|
String |
toString() |
public static final ResourceType RTYPE_VOTABLE
public static final ResourceType RTYPE_FITS
public static final ResourceType RTYPE_CDF
public String getMType()
public Message createMessage(URL url)
url
- URL of resourcepublic boolean isContentType(String ctype)
ctype
- content-type header valuepublic abstract boolean isMagic(byte[] magic)
magic
- buffer containing the first few bytes of
resource contentpublic String getName()
public static ResourceType[] getKnownResourceTypes()
public static ResourceType readHeadResourceType(URL url)
url
- resource locationpublic static ResourceType readContentResourceType(URL url)
url
- resource locationCopyright © 2008–2024. All rights reserved.