01: /*
02: * $RCSfile: FPXCodec.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:55:36 $
10: * $State: Exp $
11: */
12: package com.sun.media.jai.codecimpl;
13:
14: import java.awt.image.RenderedImage;
15: import java.io.InputStream;
16: import java.io.OutputStream;
17: import com.sun.media.jai.codec.ImageCodec;
18: import com.sun.media.jai.codec.ImageDecoder;
19: import com.sun.media.jai.codec.ImageDecodeParam;
20: import com.sun.media.jai.codec.ImageEncoder;
21: import com.sun.media.jai.codec.ImageEncodeParam;
22: import com.sun.media.jai.codec.SeekableStream;
23: import com.sun.media.jai.codec.FPXDecodeParam;
24:
25: // import com.sun.media.jai.codec.FPXEncodeParam;
26:
27: /**
28: * @since EA3
29: */
30: public final class FPXCodec extends ImageCodec {
31:
32: public FPXCodec() {
33: }
34:
35: public String getFormatName() {
36: return "fpx";
37: }
38:
39: public Class getEncodeParamClass() {
40: return null;
41: }
42:
43: public Class getDecodeParamClass() {
44: return com.sun.media.jai.codec.FPXDecodeParam.class;
45: }
46:
47: public boolean canEncodeImage(RenderedImage im,
48: ImageEncodeParam param) {
49: return false;
50: }
51:
52: protected ImageEncoder createImageEncoder(OutputStream dst,
53: ImageEncodeParam param) {
54: throw new RuntimeException(JaiI18N.getString("FPXCodec0"));
55: }
56:
57: protected ImageDecoder createImageDecoder(SeekableStream src,
58: ImageDecodeParam param) {
59: return new FPXImageDecoder(src, param);
60: }
61:
62: public int getNumHeaderBytes() {
63: return 8;
64: }
65:
66: public boolean isFormatRecognized(byte[] header) {
67: return ((header[0] == (byte) 0xd0)
68: && (header[1] == (byte) 0xcf)
69: && (header[2] == (byte) 0x11)
70: && (header[3] == (byte) 0xe0)
71: && (header[4] == (byte) 0xa1)
72: && (header[5] == (byte) 0xb1)
73: && (header[6] == (byte) 0x1a) && (header[7] == (byte) 0xe1));
74: }
75:
76: }
|