📄 com.kcmultimedia.gifcanvas.gifparser.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Tue Aug 04 23:24:55 EDT 1998 -->
<title>
Class com.kcmultimedia.gifcanvas.GIFParser
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-com.kcmultimedia.gifcanvas.html">This Package</a> <a href="com.kcmultimedia.gifcanvas.GIFFrame.html#_top_">Previous</a> <a href="Package-com.kcmultimedia.gifcanvas.html">Next</a> <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
Class com.kcmultimedia.gifcanvas.GIFParser
</h1>
<pre>
java.lang.Object
|
+----com.kcmultimedia.gifcanvas.GIFParser
</pre>
<hr>
<dl>
<dt> public class <b>GIFParser</b>
<dt> extends Object
</dl>
The GIFParser class encapsulates methods for parsing the frames and control data for an animated (or static) GIF image. The class is instantiated with a Component object (used to create images with the Component's Toolkit.) Next, a Vector of GIFFrame objects are obtained using this class's parse(byte[]) method. The GIFFrame objects contain individual images, absolute positioning, timing and disposal data. The overall width and height of the image are obtained next using the getLogicalScreenWidth() and getLogicalScreenHeight() methods. Finally, the number of iterations for looping are obtained using the getIterations() method. Static methods are provided for conveniently extracting the GIF's byte array from either a File, URL, or generalized DataInputStream. <p>Sample code for extracting GIF data is shown below:</p> <pre> import java.util.*; import java.awt.*; import com.kcmultimedia.gifcanvas.*; Vector gifFrames; int overallWidth, overallHeight, doLoops; public void sampleImageParse(Component aComponent,URL imageURL) throws Exception { //Instantiate GIFParser with the Component and get //the data we want... GIFParser p = new GIFParser(aComponent); gifFrames = p.parse(GIFParser.getBytes(imageURL)); overallWidth = p.getLogicalScreenWidth(); overallHeight = p.getLogicalScreenHeight(); doLoops = p.getIterations(); } </pre>
<p>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#GIFParser(java.awt.Component)"><b>GIFParser</b></a>(Component)
<dd> Construct a GIFParser object <p>
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getBytes(java.io.DataInputStream)"><b>getBytes</b></a>(DataInputStream)
<dd> Get the GIF's bytes from a java.io.DataInputStream <p>
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getBytes(java.io.File)"><b>getBytes</b></a>(File)
<dd> Get the GIF's bytes from a java.awt.File object <p>
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getBytes(java.net.URL)"><b>getBytes</b></a>(URL)
<dd> Get the GIF's bytes from a java.net.URL object <p>
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getIterations()"><b>getIterations</b></a>()
<dd> Get the number of times to repeat the animation.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getLogicalScreenHeight()"><b>getLogicalScreenHeight</b></a>()
<dd> Get the overall height of the GIF image.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#getLogicalScreenWidth()"><b>getLogicalScreenWidth</b></a>()
<dd> Get the overall width of the GIF image.
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#parse(byte[])"><b>parse</b></a>(byte[])
<dd> Parse a GIF image, represented by an array of bytes returning a Vector of GIFFrame objects.
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="GIFParser"></a>
<a name="GIFParser(java.awt.Component)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>GIFParser</b>
<pre>
public GIFParser(Component component)
</pre>
<dl>
<dd> Construct a GIFParser object <p>
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> component - a java.awt.Component object that is used to obtain the Toolkit for creating images
</dl></dd>
</dl>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="parse(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="parse"><b>parse</b></a>
<pre>
public Vector parse(byte b[]) throws Exception
</pre>
<dl>
<dd> Parse a GIF image, represented by an array of bytes returning a Vector of GIFFrame objects. <p>
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> b - a array of bytes representing the GIF image
<dt> <b>Returns:</b>
<dd> a Vector of GIFFrame objects that contain the GIF data
<dt> <b>Throws:</b> Exception
<dd> thrown if the GIF file cannot be read or converted into an image.
<dt> <b>See Also:</b>
<dd> <a href="com.kcmultimedia.gifcanvas.GIFFrame.html#_top_">GIFFrame</a>
</dl></dd>
</dl>
<a name="getLogicalScreenWidth()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLogicalScreenWidth"><b>getLogicalScreenWidth</b></a>
<pre>
public int getLogicalScreenWidth()
</pre>
<dl>
<dd> Get the overall width of the GIF image. <p>
<p>
<dd><dl>
<dt> <b>Returns:</b>
<dd> the overall width of the GIF in pixels
</dl></dd>
</dl>
<a name="getLogicalScreenHeight()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLogicalScreenHeight"><b>getLogicalScreenHeight</b></a>
<pre>
public int getLogicalScreenHeight()
</pre>
<dl>
<dd> Get the overall height of the GIF image. <p>
<p>
<dd><dl>
<dt> <b>Returns:</b>
<dd> the overall height of the GIF in pixels
</dl></dd>
</dl>
<a name="getIterations()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getIterations"><b>getIterations</b></a>
<pre>
public int getIterations()
</pre>
<dl>
<dd> Get the number of times to repeat the animation. <i><b>Note that zero (0) indicates infinite loop.</b></i> <p>
<p>
<dd><dl>
<dt> <b>Returns:</b>
<dd> the number of iterations for the animation loop.
</dl></dd>
</dl>
<a name="getBytes(java.io.File)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBytes"><b>getBytes</b></a>
<pre>
public static byte[] getBytes(File file) throws IOException
</pre>
<dl>
<dd> Get the GIF's bytes from a java.awt.File object <p>
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> file - the GIF image file
<dt> <b>Returns:</b>
<dd> a byte array containing the GIF data
<dt> <b>Throws:</b> IOException
<dd> thrown if an I/O Exception occurs.
</dl></dd>
</dl>
<a name="getBytes(java.net.URL)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBytes"><b>getBytes</b></a>
<pre>
public static byte[] getBytes(URL url) throws IOException
</pre>
<dl>
<dd> Get the GIF's bytes from a java.net.URL object <p>
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> url - the GIF image's URL
<dt> <b>Returns:</b>
<dd> a byte array containing the GIF data
<dt> <b>Throws:</b> IOException
<dd> thrown if an I/O Exception occurs.
</dl></dd>
</dl>
<a name="getBytes(java.io.DataInputStream)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBytes"><b>getBytes</b></a>
<pre>
public static byte[] getBytes(DataInputStream in) throws IOException
</pre>
<dl>
<dd> Get the GIF's bytes from a java.io.DataInputStream <p>
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> in - the DataInputStream representing the GIF data
<dt> <b>Returns:</b>
<dd> a byte array containing the GIF data
<dt> <b>Throws:</b> IOException
<dd> thrown if an I/O Exception occurs.
</dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-com.kcmultimedia.gifcanvas.html">This Package</a> <a href="com.kcmultimedia.gifcanvas.GIFFrame.html#_top_">Previous</a> <a href="Package-com.kcmultimedia.gifcanvas.html">Next</a> <a href="AllNames.html">Index</a></pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -