org.w3c.rdfpic.core
Class ImgMetaHandler
java.lang.Object
|
+--org.w3c.rdfpic.core.ImgMetaHandler
- public class ImgMetaHandler
- extends java.lang.Object
A class to get and send meta (text) data to image files. (Currently jpeg's only)
Method Summary |
boolean |
canRead()
Returns whether the image is readable. |
boolean |
canWrite()
Returns whether the image is writable. |
int |
getFileSize()
Returns the size of the image file loaded in bytes. |
java.awt.Image |
getImg()
Returns a (cached) Image of the graphical data of the file currently loaded. |
java.net.URL |
getURL()
Returns the active URL. |
java.lang.String |
read()
Reads the text embedded in the file. |
void |
setURL(java.net.URL url)
Selects (and fully buffers!) an image. |
void |
write(java.lang.String comment)
(Over)writes the text embedded in the file. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
url
java.net.URL url
ph
ProtocolHandler ph
im
ImgMeta im
currentImg
java.awt.Image currentImg
ImgMetaHandler
public ImgMetaHandler()
setURL
public void setURL(java.net.URL url)
throws PHException,
UnknownImgTypeException
- Selects (and fully buffers!) an image.
- Parameters:
url
- The url of the image. Supports whatever ProtocolHandler does (currently http 1.1 and file protocols)
getImg
public java.awt.Image getImg()
- Returns a (cached) Image of the graphical data of the file currently loaded.
Returns
null
if nothing is loaded.
getFileSize
public int getFileSize()
throws PHException
- Returns the size of the image file loaded in bytes.
- Throws:
- PHException - when no file is loaded.
getURL
public java.net.URL getURL()
- Returns the active URL. (Not a copy - so do not change!)
read
public java.lang.String read()
throws java.io.IOException
- Reads the text embedded in the file.
write
public void write(java.lang.String comment)
throws java.io.IOException
- (Over)writes the text embedded in the file.
- Parameters:
comment
- The comment to embed.
canRead
public boolean canRead()
- Returns whether the image is readable.
canWrite
public boolean canWrite()
- Returns whether the image is writable. Because of limitations in HTTP 1.1, it's impossible to know in advance whether
PUT permissions will be granted. So, if HTTP 1.1 is being used, is simply assumes it can write, but signals an IO error
when you actually try to.