public FileCacheImageOutputStream(OutputStream stream, File cacheDir) throws IOException { if (stream == null) { throw new IllegalArgumentException(Messages.getString("imageio.0A")); } os = stream; if (cacheDir == null || cacheDir.isDirectory()) { file = File.createTempFile(IIO_TEMP_FILE_PREFIX, null, cacheDir); file.deleteOnExit(); } else { throw new IllegalArgumentException(Messages.getString("imageio.0B")); } raf = new RandomAccessFile(file, "rw"); }
public Attr setAttributeNode(Attr newAttr) throws DOMException { // Check if this attribute is already in use. Element owner = newAttr.getOwnerElement(); if (owner != null) { if (owner == this) { // Replacing an attribute node by itself has no effect return null; } else { throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, Messages.getString("imageio.8E")); } } String name = newAttr.getName(); Attr oldAttr = getAttributeNode(name); if (oldAttr != null) { removeAttributeNode(oldAttr); } IIOMetadataAttr iioAttr; if (newAttr instanceof IIOMetadataAttr) { iioAttr = (IIOMetadataAttr) newAttr; iioAttr.setOwnerElement(this); } else { iioAttr = new IIOMetadataAttr(name, newAttr.getValue(), this); } attrs.list.add(iioAttr); return oldAttr; }
public Node removeChild(Node oldChild) throws DOMException { if (oldChild == null) { throw new IllegalArgumentException(Messages.getString("imageio.62")); } IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild; // Fix next and previous IIOMetadataNode previous = oldIIOChild.previousSibling; IIOMetadataNode next = oldIIOChild.nextSibling; if (previous != null) { previous.nextSibling = next; } if (next != null) { next.previousSibling = previous; } // Fix this node if (lastChild == oldIIOChild) { lastChild = previous; } if (firstChild == oldIIOChild) { firstChild = next; } nChildren--; // Fix old child oldIIOChild.parent = null; oldIIOChild.previousSibling = null; oldIIOChild.nextSibling = null; return oldIIOChild; }
@Override public ImageOutputStream createOutputStreamInstance( Object output, boolean useCache, File cacheDir) throws IOException { if (output instanceof RandomAccessFile) { return new FileImageOutputStream((RandomAccessFile) output); } throw new IllegalArgumentException(Messages.getString("imageio.87")); }
public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (!attrs.list.remove(oldAttr)) { // Not found throw new DOMException(DOMException.NOT_FOUND_ERR, Messages.getString("imageio.8F")); } ((IIOMetadataAttr) oldAttr).setOwnerElement(null); return oldAttr; }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { if (newChild == null) { throw new IllegalArgumentException(Messages.getString("imageio.61")); } IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild; IIOMetadataNode refIIOChild = (IIOMetadataNode) refChild; newIIOChild.parent = this; if (refIIOChild == null) { newIIOChild.nextSibling = null; newIIOChild.previousSibling = lastChild; // Fix this node lastChild = newIIOChild; if (firstChild == null) { firstChild = newIIOChild; } } else { newIIOChild.nextSibling = refIIOChild; newIIOChild.previousSibling = refIIOChild.previousSibling; // Fix this node if (firstChild == refIIOChild) { firstChild = newIIOChild; } // Fix next node if (refIIOChild != null) { refIIOChild.previousSibling = newIIOChild; } } // Fix prev node if (newIIOChild.previousSibling != null) { newIIOChild.previousSibling.nextSibling = newIIOChild; } nChildren++; return newIIOChild; }
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if (newChild == null) { throw new IllegalArgumentException(Messages.getString("imageio.61")); } IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild; IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild; IIOMetadataNode next = oldIIOChild.nextSibling; IIOMetadataNode previous = oldIIOChild.previousSibling; // Fix new node newIIOChild.parent = this; newIIOChild.nextSibling = next; newIIOChild.previousSibling = previous; // Fix this node if (lastChild == oldIIOChild) { lastChild = newIIOChild; } if (firstChild == oldIIOChild) { firstChild = newIIOChild; } // Fix siblings if (next != null) { next.previousSibling = newIIOChild; } if (previous != null) { previous.nextSibling = newIIOChild; } // Fix old child oldIIOChild.parent = null; oldIIOChild.nextSibling = next; oldIIOChild.previousSibling = previous; return oldIIOChild; }
public boolean isDefaultNamespace(String namespaceURI) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { throw new DOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getString("imageio.91")); }
public Node setNamedItemNS(Node arg) throws DOMException { throw new DOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getString("imageio.91")); }
public boolean isId() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public Object getUserData(String key) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public Object setUserData(String key, Object data, UserDataHandler handler) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public Object getFeature(String feature, String version) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public TypeInfo getSchemaTypeInfo() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public boolean isSameNode(Node other) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public short compareDocumentPosition(Node other) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public String getBaseURI() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }
public MemoryCacheImageOutputStream(OutputStream stream) { if (stream == null) { throw new IllegalArgumentException(Messages.getString("imageio.0A")); } os = stream; }
public String lookupNamespaceURI(String prefix) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, Messages.getString("imageio.90")); }