Package org.axsl.graphic

Examples of org.axsl.graphic.GraphicException


                loadTransparency(cm);
            } else {
                this.isTransparent = false;
            }
        } catch (final InterruptedException ex) {
            throw new GraphicException("Error while loading image "
                                        + getUrl().toString() + " : "
                                        + ex.getClass() + " - "
                                        + ex.getMessage());
        } catch (final IOException ex) {
            throw new GraphicException("Error while loading image "
                    + getUrl().toString() + " : "
                    + ex.getClass() + " - "
                    + ex.getMessage());
}
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public byte[] getRawSamples() throws GraphicException {
        /* TODO: Add support for this feature. */
        throw new GraphicException("Unsupported feature getRawSamples() in "
                + this.getClass().getName() + "for: "
                + this.getUrl().toExternalForm());
    }
View Full Code Here

            }
            this.rawContent = readBuf;

            return;
        } catch (final IOException ioe) {
            throw new GraphicException(ioe);
        } finally {
            IOUtils.closeQuietly(this.seekableInput);
            IOUtils.closeQuietly(this.getInputStream());
            this.seekableInput = null;
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public byte[] getContent() throws GraphicException {
        /* TODO: Add support for this feature. */
        throw new GraphicException("Unsupported feature getContent() in "
                + this.getClass().getName() + "for: "
                + this.getUrl().toExternalForm());
    }
View Full Code Here

            while ((bytesRead = getInputStream().read(readBuf)) != -1) {
                baos.write(readBuf, 0, bytesRead);
            }
        } catch (final IOException ex) {
            this.setValid(false);
            throw new GraphicException("Error loading image:\n  " +
                    getUrl().toString()
                    + "\n  " + ex.getClass() + " - " + ex.getMessage());
        }

        final byte[] contentBytes = baos.toByteArray();
        /* The image size is normally computed in parseBasics(), which instead
         * here calls this method, loadImage().
         * See parseBasics() for a comment explaining why. */
        findImageSize(contentBytes);
        setBitDepth(WKConstants.BITS_PER_BYTE);

        if (contentBytes.length > (index + 2) &&
                contentBytes[index] == JPEGGraphic.MARK &&
                contentBytes[index + 1] == JPEGGraphic.SOI) {
            processRemainder(contentBytes, iccStream, index);
        } else {
            this.setValid(false);
            throw new GraphicException("Error loading image:\n  "
                    + getUrl().toString()
                    + "\n  JpegImage - Invalid JPEG Header.");
        }
        if (iccStream.size() > 0) {
            final byte[] align = new byte[((iccStream.size())
                    % WKConstants.BITS_PER_BYTE) + WKConstants.BITS_PER_BYTE];
            try {
                iccStream.write(align);
            } catch (final IOException e) {
                throw new GraphicException("\n1 Error while loading image " +
                        getUrl().toString() + " : " + e.getMessage());
            }
            final ICC_Profile icc = ICC_Profile.getInstance(
                    iccStream.toByteArray());
            this.colorSpace = new ICC_ColorSpace(icc);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public byte[] getContent() throws GraphicException {
        /* TODO: Add support for this feature. */
        throw new GraphicException("Unsupported feature getContent() in "
                + this.getClass().getName() + "for: "
                + this.getUrl().toExternalForm());
    }
View Full Code Here

            this.bis.reset();
            this.bis.mark(this.maxBytesToParseBasics());
            parseBasics();
            this.bis.reset();
        } catch (final IOException e) {
            throw new GraphicException(e.getMessage());
        }
        this.basicsParsed = true;
    }
View Full Code Here

    protected byte[] getPdfContent() throws GraphicException {
        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        final GraphicOutput graphicOutput = this.graphic.getGraphicOutput(
                Mime.PDF.getMimeString());
        if (! (graphicOutput instanceof GraphicPdf)) {
            throw new GraphicException("Unable to get PDF output helper for "
                    + this.graphic.getUrl());
        }
        final GraphicPdf graphicPdf = (GraphicPdf) graphicOutput;
        graphicPdf.drawVectorContent(outputStream, this.getPDFDocument(),
                this.fontConsumer, this.strokeText, false);
View Full Code Here

    protected byte[] getPdfContent() throws GraphicException {
        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        final GraphicOutput graphicOutput = this.graphic.getGraphicOutput(
                Mime.PDF.getMimeString());
        if (! (graphicOutput instanceof GraphicPdf)) {
            throw new GraphicException("Unable to get PDF output helper for "
                    + this.graphic.getUrl());
        }
        final GraphicPdf graphicPdf = (GraphicPdf) graphicOutput;
        graphicPdf.drawVectorContent(outputStream, this.getPDFDocument(),
                this.fontConsumer, this.strokeText, false);
View Full Code Here

            case JPEG:
                filter = psServer.makeEncodeFilter(PsFilterType.DCT, outputStream);
                filter.setInactive();
                return filter;
            default:
                throw new GraphicException("Error while loading image "
                        + graphic.getUrl() + " : "
                        + this.getClass() + " - "
                        + "unsupported compression value "
                        + imageCompression);
            }
View Full Code Here

TOP

Related Classes of org.axsl.graphic.GraphicException

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.