Package javax.activation

Examples of javax.activation.UnsupportedDataTypeException


    closeDatabase();
    try {
      db = Db4o.openFile(file.getAbsolutePath());
    } catch (Db4oException e) {
      if (e.getMessage().equals("File format incompatible.")) {
        throw new UnsupportedDataTypeException(
            "The file "
                + file.getAbsolutePath()
                + " is no project-file.\nPlease choose a project-file or enter a name for a new file.");
      } else
        throw e;
View Full Code Here


    }

    public Object getContent(DataSource ds) throws IOException {
        Iterator i = ImageIO.getImageReadersByMIMEType(ds.getContentType());
        if (!i.hasNext()) {
            throw new UnsupportedDataTypeException();
        }
        ImageReader reader = (ImageReader) i.next();
        return reader.read(0);
    }
View Full Code Here

    }

    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        Iterator i = ImageIO.getImageWritersByMIMEType(mimeType);
        if (!i.hasNext()) {
            throw new UnsupportedDataTypeException();
        }
        ImageWriter writer = (ImageWriter) i.next();
        writer.setOutput(os);

        if (obj instanceof RenderedImage) {
            writer.write((RenderedImage) obj);
        } else if (obj instanceof BufferedImage) {
            BufferedImage buffered = (BufferedImage) obj;
            writer.write(new IIOImage(buffered.getRaster(), null, null));
        } else if (obj instanceof Image) {
            Image image = (Image) obj;
            BufferedImage buffered = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
            Graphics2D graphics = buffered.createGraphics();
            graphics.drawImage(image, 0, 0, null, null);
            writer.write(new IIOImage(buffered.getRaster(), null, null));
        } else {
            throw new UnsupportedDataTypeException();
        }
        os.flush();
    }
View Full Code Here

           return toSource(((String)xml).getBytes(optionalEncoding), context);
       }
        
        
      
       throw new UnsupportedDataTypeException("Datatype " + xml.getClass().getName() + " not (yet) supported.");

   }
View Full Code Here

     if ( xml instanceof Source)
       return factory.createXMLEventReader((Source) xml);
     if ( xml instanceof String)
       return toXMLEventReader( new StringReader((String) xml), context);
    
     throw new UnsupportedDataTypeException("Datatype " + xml.getClass().getName() + " not (yet) supported.");
   }
View Full Code Here

        FileUtils.writeByteArrayToFile(new File(documentationTargetDir,
            filename), (byte[]) zoomInNode.getAttributes()
            .getValue());
       
      }else {
        warningHandler.handleThrowable(new UnsupportedDataTypeException("type " + type ));
      }
     

    }
   
View Full Code Here

      }else if (GeneralConstants.TEXT.equals(type)){
        DomUtils.appendText(doc, parentElement, zoomInNode.getAttributes().getValue());
      }else if (GeneralConstants.RAW.equals(type)){
        DomUtils.appendRaw(doc, parentElement, zoomInNode.getAttributes().getValue());
      }else {
        warningHandler.handleThrowable(new UnsupportedDataTypeException("type " + type ));
      }
    }
     
  }
View Full Code Here

                        this.dimension = Integer.parseInt(value);
                        hasDimension = true;
                       
                    } else if (key.equals("EDGE_WEIGHT_TYPE")) {
                        if (!value.equals("EUC_2D")) {
                            throw new UnsupportedDataTypeException("Only EUC_2D edge weights are supported for now");
                        }
                    } else if (key.equals("BEST_KNOWN")) {
                        this.bestKnown = Integer.parseInt(value);
                    }
                }
View Full Code Here

    }

    public Object getContent(DataSource ds) throws IOException {
        Iterator i = ImageIO.getImageReadersByMIMEType(ds.getContentType());
        if (!i.hasNext()) {
            throw new UnsupportedDataTypeException();
        }
        ImageReader reader = (ImageReader) i.next();
        return reader.read(0);
    }
View Full Code Here

    }

    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        Iterator i = ImageIO.getImageWritersByMIMEType(mimeType);
        if (!i.hasNext()) {
            throw new UnsupportedDataTypeException();
        }
        ImageWriter writer = (ImageWriter) i.next();
        writer.setOutput(os);

        if (obj instanceof RenderedImage) {
            writer.write((RenderedImage) obj);
        } else if (obj instanceof BufferedImage) {
            BufferedImage buffered = (BufferedImage) obj;
            writer.write(new IIOImage(buffered.getRaster(), null, null));
        } else if (obj instanceof Image) {
            Image image = (Image) obj;
            BufferedImage buffered = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
            Graphics2D graphics = buffered.createGraphics();
            graphics.drawImage(image, 0, 0, null, null);
            writer.write(new IIOImage(buffered.getRaster(), null, null));
        } else {
            throw new UnsupportedDataTypeException();
        }
        os.flush();
    }
View Full Code Here

TOP

Related Classes of javax.activation.UnsupportedDataTypeException

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.