Package com.sun.media.jai.codec

Examples of com.sun.media.jai.codec.SeekableStream


        init(fileURL);
    }

    public void init(URL fileURL) throws IOException, IllegalArgumentException {
        this.fileURL = fileURL;
        SeekableStream ss = SeekableStream.wrapInputStream(fileURL.openStream(),
                true);
        GeoTIFFDescriptor.register();
        GeoTIFFFactory gtFactory = new GeoTIFFFactory();
        gtfDirectory = (GeoTIFFDirectory) gtFactory.createDirectory(ss, 0);
        geoKeys = gtfDirectory.getGeoKeys();
        ss.close();
    }
View Full Code Here


    public BufferedImage getBufferedImage() throws IOException {
        if (fileURL == null) {
            throw new IOException("Image Decoder not created for retrieving image, need to init() GeoTIFFFile.");
        }

        SeekableStream ss = SeekableStream.wrapInputStream(fileURL.openStream(),
                true);
        XTIFFImageDecoder xtffImageDecoder = new XTIFFImageDecoder(ss, new XTIFFDecodeParam());
        RenderedImage ri = xtffImageDecoder.decodeAsRenderedImage();
        BufferedImage bi = new BufferedImage(ri.getColorModel(), ri.copyData(null), false, new Hashtable());
        ss.close();
        return bi;
    }
View Full Code Here

        StringBuffer msg = new StringBuffer();
        if (!validateParameters(paramBlock, msg)) {
            return null;
        }
        try {
            SeekableStream in = (SeekableStream) paramBlock.getObjectParameter(0);
            XTIFFImage image = new XTIFFImage(in, (TIFFDecodeParam) paramBlock.getObjectParameter(1), 0);
            return image;
        } catch (Exception e) {
            return null;
        }
View Full Code Here

     *                 if the image could not be manipulated correctly.
     */
    public static byte[] resizeImageAsJPG(byte[] pImageData, int pMaxWidth, int pMaxHeight) throws IOException {
    InputStream imageInputStream = new ByteArrayInputStream(pImageData);
    // read in the original image from an input stream
    SeekableStream seekableImageStream = SeekableStream.wrapInputStream(imageInputStream, true);
    RenderedOp originalImage = JAI.create(JAI_STREAM_ACTION, seekableImageStream);
    ((OpImage) originalImage.getRendering()).setTileCache(null);
    int origImageWidth = originalImage.getWidth();
    int origImageHeight = originalImage.getHeight();
    // now resize the image
View Full Code Here

     * @param input the <code>File</code> containing the image
     * @return an SWT <code>ImageData</code> version of the image data
     */
    public ImageData load(File input) throws IOException  {

        SeekableStream s = new FileSeekableStream(input);

        TIFFDecodeParam param = new TIFFDecodeParam();
        param.setDecodePaletteAsShorts( false );
        ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param); //$NON-NLS-1$
        int imageToLoad = 0;
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        super.fire();

        InputStream inputStream = null;
        SeekableStream seekableStream = null;

        try {
            try {
                inputStream = _fileURL.openStream();

                // We use a FileCacheSeekableStream here because
                // we need to have a stream that can go backwards.
                // If we are running under the windows installer, Web Start
                // or any other jar based installation, we need to be
                // able to handle images in jar files.
                seekableStream = new FileCacheSeekableStream(inputStream);
            } catch (IOException ex) {
                throw new IllegalActionException(this, ex,
                        "Unable to load file '" + _fileURL + "'");
            }

            _outputtedImage = JAI.create("stream", seekableStream);

            /*PlanarImage dummy =*/_outputtedImage.getRendering();
        } finally {
            if (seekableStream != null) {
                try {
                    seekableStream.close();
                } catch (Throwable throwable2) {
                    throw new IllegalActionException(this, throwable2,
                            "Unable to close SeekableStream for '" + _fileURL
                                    + "'");
                }
View Full Code Here

    }

    public static void main(String[] args) {
        try {
            RandomAccessFile f = new RandomAccessFile(args[0], "r");
            SeekableStream sis = new FileSeekableStream(f);
            StructuredStorage ss = new StructuredStorage(sis);

            ss.changeDirectoryToRoot();

            byte[] s = ss.getStreamAsBytes("SummaryInformation");
View Full Code Here

    }

    private void readImageContents() throws IOException  {
        storage.changeDirectoryToRoot();
        storage.changeDirectory("Data Object Store 000001");
        SeekableStream imageContents =
            storage.getStream("Image Contents");

        PropertySet icps = new PropertySet(imageContents);
        this.numResolutions   = (int)icps.getUI4(0x01000000);
        this.highestResWidth  = (int)icps.getUI4(0x01000002);
View Full Code Here

            properties.put(name.toLowerCase(), new Integer((int)i));
        }
    }

    private void getSummaryInformation() {
        SeekableStream summaryInformation = null;
        PropertySet sips = null;
        try {
            storage.changeDirectoryToRoot();
            summaryInformation = storage.getStream("SummaryInformation");
            sips = new PropertySet(summaryInformation);
View Full Code Here

        addLPSTRProperty("last saved by", sips, 0x000000008);
        addLPSTRProperty("revision number", sips, 0x000000009);
    }

    private void getImageInfo() {
        SeekableStream imageInfo = null;
        PropertySet iips = null;
        try {
            storage.changeDirectoryToRoot();
            imageInfo = storage.getStream("Image Info");
            if (imageInfo == null) {
View Full Code Here

TOP

Related Classes of com.sun.media.jai.codec.SeekableStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.