Package javax.imageio.stream

Examples of javax.imageio.stream.FileImageInputStream


    public void load (InputStream is) throws IOException {
        this.image = ImageIO.read(is);
    }

    public void customLoad (RandomAccessFile raf) throws Exception {
    image = ImageIO.read(new FileImageInputStream(raf));
    }
View Full Code Here


    @Action(enabledProperty = "fileOpenEnabled", selectedProperty = "fileOpenSelected")
    public void fileOpen() {

        File file = null;
        FileImageInputStream inputStream = null;
        BufferedImage bi = null;

        Logger logger = Logger.getLogger(ImageToolsView.class.getName());

        // Present the "open" file chooser without any file selected.
        // If the user cancels this file chooser, exit this method.

        imageChooser.setSelectedFile(null);
        if (imageChooser.showOpenDialog(mainFrame) !=
                JFileChooser.APPROVE_OPTION) {
            return;
        }

        // Obtain the selected file. Validate its extension, which
        // must be .jpg or .jpeg. If extension not present, append
        // .jpg extension.

        file = imageChooser.getSelectedFile();

        // check if file exists and make sure it's an image(or .jpg)
        // if not show an error box
        if (file.exists()) {
            // open it
            try {

                inputStream = new FileImageInputStream(file);
            } catch (FileNotFoundException ex) {
                logger.log(Level.SEVERE, null, ex);
                showError("File not found " + ex);
            } catch (IOException ex) {
                logger.log(Level.SEVERE, null, ex);
View Full Code Here

    public ImageInputStream createInputStreamInstance(Object input,
                                                      boolean useCache,
                                                      File cacheDir) {
        if (input instanceof File) {
            try {
                return new FileImageInputStream((File)input);
            } catch (Exception e) {
                return null;
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

    public ImageInputStream createInputStreamInstance(Object input,
                                                      boolean useCache,
                                                      File cacheDir) {
        if (input instanceof RandomAccessFile) {
            try {
                return new FileImageInputStream((RandomAccessFile)input);
            } catch (Exception e) {
                return null;
            }
        } else {
            throw new IllegalArgumentException
View Full Code Here

    public ImageInputStream createInputStreamInstance(Object input,
                                                      boolean useCache,
                                                      File cacheDir) {
        if (input instanceof File) {
            try {
                return new FileImageInputStream((File)input);
            } catch (Exception e) {
                return null;
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

    public ImageInputStream createInputStreamInstance(Object input,
                                                      boolean useCache,
                                                      File cacheDir) {
        if (input instanceof RandomAccessFile) {
            try {
                return new FileImageInputStream((RandomAccessFile)input);
            } catch (Exception e) {
                return null;
            }
        } else {
            throw new IllegalArgumentException
View Full Code Here

        stringDS = new ByteArrayDataSource(string.getBytes(),"text/plain");

        try {
            //Create a DataSource from an image
            File file = new File(imageResourceDir + File.separator + "test.jpg");
            ImageInputStream fiis = new FileImageInputStream(file);
            Image image = ImageIO.read(fiis);
            imageDS = new DataSourceImpl("image/jpeg", "test.jpg", image);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

    public void setUp() throws Exception {
        String imageResourceDir = System.getProperty("basedir",".")+"/"+"test-resources"+File.separator+"image";
       
        //Create a DataSource from an image
        File file = new File(imageResourceDir+File.separator+"test.jpg");
        ImageInputStream fiis = new FileImageInputStream(file);
        Image image = ImageIO.read(fiis);
        imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
    }
View Full Code Here

       
        String imageResourceDir = IMAGE_DIR;
       
        //Create a DataSource from an image
        File file = new File(imageResourceDir+File.separator+"test.jpg");
        ImageInputStream fiis = new FileImageInputStream(file);
        Image image = ImageIO.read(fiis);
        DataSource imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
       
        //Create a DataHandler with the String DataSource object
        DataHandler dataHandler = new DataHandler(imageDS);
View Full Code Here

       
        String imageResourceDir = IMAGE_DIR;
       
        //Create a DataSource from an image
        File file = new File(imageResourceDir+File.separator+"test.jpg");
        ImageInputStream fiis = new FileImageInputStream(file);
        Image image = ImageIO.read(fiis);
        DataSource imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
       
        //Create a DataHandler with the String DataSource object
        DataHandler dataHandler = new DataHandler(imageDS);
View Full Code Here

TOP

Related Classes of javax.imageio.stream.FileImageInputStream

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.