KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > image > codec > jpeg > TruncatedFileException


1 /*
2  * @(#)TruncatedFileException.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 /* ********************************************************************
9  **********************************************************************
10  **********************************************************************
11  *** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
12  *** As an unpublished work pursuant to Title 17 of the United ***
13  *** States Code. All rights reserved. ***
14  **********************************************************************
15  **********************************************************************
16  **********************************************************************/

17
18 package com.sun.image.codec.jpeg;
19
20 import java.awt.image.Raster JavaDoc;
21 import java.awt.image.BufferedImage JavaDoc;
22 /**
23  * Signals that a truncated file was detected. This object contains
24  * the Raster/BufferedImage that has the partially decoded image data
25  * in it. There is no indication of the portion of the Raster that
26  * may or may not be good.
27  * <p>
28  * Note that the classes in the com.sun.image.codec.jpeg package are not
29  * part of the core Java APIs. They are a part of Sun's JDK and JRE
30  * distributions. Although other licensees may choose to distribute these
31  * classes, developers cannot depend on their availability in non-Sun
32  * implementations. We expect that equivalent functionality will eventually
33  * be available in a core API or standard extension.
34  * <p>
35  *
36  * @author Thomas DeWeese
37  * @see JPEGImageDecoder
38  * @since JDK1.2
39  */

40 public
41 class TruncatedFileException extends RuntimeException JavaDoc {
42     private Raster JavaDoc ras = null;
43     private BufferedImage JavaDoc bi = null;
44
45
46     /**
47      * Constructs a <code>TruncatedFileException/code> with the
48      * partially decoded BufferedImage.
49      *
50      * @param bi the partially decoded BufferedImage (may be null).
51      * @since JDK1.2
52      */

53     public TruncatedFileException(BufferedImage JavaDoc bi) {
54         super("Premature end of input file");
55         this.bi = bi;
56         this.ras = bi.getData();
57     }
58
59     /**
60      * Constructs an <code>TruncatedFileException</code> with the
61      * partially decoded Raster
62      *
63      * @param ras the partially decoded Raster (may be null).
64      * @since JDK1.2
65      */

66     public TruncatedFileException(Raster JavaDoc ras) {
67         super("Premature end of input file");
68         this.ras = ras;
69     }
70
71     /** Allows access to the raster that was in the progress of being
72      * decoded may be null, it is likely to be only partially filled
73      * with image data.
74      * @since JDK1.2
75      */

76     public Raster JavaDoc getRaster() { return ras; }
77
78     /** Allows access to the BufferedImage that was in the progress of
79      * being decoded, this may be null, it is likely to be only
80      * partially filled with image data.
81      * @since JDK1.2
82      */

83     public BufferedImage JavaDoc getBufferedImage() { return bi; }
84 }
85
Popular Tags