{"id":12834,"date":"2020-02-25T12:11:11","date_gmt":"2020-02-25T11:11:11","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/"},"modified":"2020-02-25T12:11:11","modified_gmt":"2020-02-25T11:11:11","slug":"java-1-8-utility-classes-xml-zip-bufferedimage-and-download","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/","title":{"rendered":"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download"},"content":{"rendered":"<p>When I write code, I usually need some utility classes to ease the development. So here I will share my most used classes. Hope this will help you as well!<\/p>\n<p><h1>XML store and load<\/h1>\n<p>I strongly use XML for storing configurations or even data, so I made an helper which can store and load any classes (with annotations) as XML, using generics<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\nimport java.io.File;\n\nimport javax.xml.bind.JAXBContext;\nimport javax.xml.bind.JAXBException;\nimport javax.xml.bind.Marshaller;\nimport javax.xml.bind.Unmarshaller;\n\n\/**\n * Utility class to provide some handy method about xml management\n * \n * @author sbi\n *\n *\/\npublic class XmlHelper {\n\n\t\/**\n\t * Generic method to store xml files based on classes with XML anotations\n\t * \n\t * @param element - The object to store as xml\n\t * @param file - The file path where to store the xml\n\t * @throws JAXBException\n\t *\/\n\tpublic static  void storeXml(T element, File file) throws JAXBException {\n\t\tJAXBContext jaxbContext = JAXBContext.newInstance(element.getClass());\n\t\tMarshaller jaxbMarshaller = jaxbContext.createMarshaller();\n\t\tjaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\t\tjaxbMarshaller.marshal(element, file);\n\t}\n\t\n\t\/**\n\t * Generic method to load xml and transform it into an object which was declared with annotations\n\t * @param clazz - The class of the object in which we want the xml to be casted\n\t * @param file - The XML file located on the file system\n\t * @return An object converted from XML\n\t * @throws JAXBException\n\t *\/\n\t@SuppressWarnings(\"unchecked\")\n\tpublic static  T loadXml(Class clazz, File file) throws JAXBException {\n\t\tJAXBContext jaxbContext = JAXBContext.newInstance(clazz);\n\t\tUnmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();\n\t\treturn (T) jaxbUnmarshaller.unmarshal(file);\n\t}\n}\n<\/pre>\n<p>And here an example of a basic class that can be written as XML. I&#8217;ve added 3 kinds of elements:<\/p>\n<ul>\n<li>XMLRootElement: It sets this class as XML enabled. It is mandatory.<\/li>\n<li>XMLElement: Basic XML element which will create the hierarchy<\/li>\n<li>XMLAttribute: Attributes will be located inside the declaration of a new item<\/li>\n<li>XMLElementWrapper: It allows to store lists of objects. You can even add your own object but you will have to add anotations to the underlying object as well. Like you did for this class.<\/li>\n<\/ul>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\nimport java.util.ArrayList;\nimport javax.xml.bind.annotation.XmlAttribute;\nimport javax.xml.bind.annotation.XmlElement;\nimport javax.xml.bind.annotation.XmlElementWrapper;\nimport javax.xml.bind.annotation.XmlRootElement;\n\n@XmlRootElement(name=\"XMLClass\")\npublic class XMLClass {\n\n\tprivate String name;\n\tprivate int id;\n\tprivate ArrayList xmlElements;\n\t\n\tpublic ArrayList getXmlElements() {\n\t\treturn xmlElements;\n\t}\n\t\n\t@XmlElementWrapper(name=\"ElementList\")\n\t@XmlElement(name=\"Element\")\n\tpublic void setXmlElements(ArrayList xmlElements) {\n\t\tthis.xmlElements = xmlElements;\n\t}\n\t\n\tpublic int getId() {\n\t\treturn id;\n\t}\n\t\n\t@XmlAttribute(name=\"ID\")\n\tpublic void setId(int id) {\n\t\tthis.id = id;\n\t}\n\t\n\tpublic String getName() {\n\t\treturn name;\n\t}\n\t\n\t@XmlElement(name=\"Name\")\n\tpublic void setName(String name) {\n\t\tthis.name = name;\n\t}\n}\n<\/pre>\n<p>An example of usage:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\nXMLClass cl = new XMLClass();\ncl.setId(1234);\ncl.setName(\"MyXMLExample\");\ncl.setXmlElements(new ArrayList());\ncl.getXmlElements().add(\"Element1\");\ncl.getXmlElements().add(\"Element2\");\ncl.getXmlElements().add(\"Element3\");\ncl.getXmlElements().add(\"Element4\");\ntry {\n\tXmlHelper.storeXml(cl, new File(\"xmlexample.xml\"));\n} catch (JAXBException e) {\n\te.printStackTrace();\n}\n<\/pre>\n<p>Result:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;XMLClass ID=&quot;1234&quot;&gt;\n    &lt;Name&gt;MyXMLExample&lt;\/Name&gt;\n    &lt;ElementList&gt;\n        &lt;Element&gt;Element1&lt;\/Element&gt;\n        &lt;Element&gt;Element2&lt;\/Element&gt;\n        &lt;Element&gt;Element3&lt;\/Element&gt;\n        &lt;Element&gt;Element4&lt;\/Element&gt;\n    &lt;\/ElementList&gt;\n&lt;\/XMLClass&gt;\n<\/pre>\n<h1>Zipping and Unzipping<\/h1>\n<p>Another handy class to manage zips in Java. I will not cover this one as it is self explanatory. Just call the zip function with a source path and the target path (e.g: my_path\/myZip.zip).<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipInputStream;\nimport java.util.zip.ZipOutputStream;\n\/**\n * Utility class to provide some handy method about zip management\n * Credit goes to: https:\/\/www.baeldung.com\/java-compress-and-uncompress\n * \n * @author sbi\n *\n *\/\npublic class ZipHelper {\n\t\n\t\/**\n\t * Zips a folder. The folder will be contained inside the zip.\n\t * \n\t * @param sourceFile - The path to the source folder to zip\n\t * @param target - The name and path to the target zipped file. e.g: path_to_file\/myZip.zip\n\t * @throws IOException - If the zipping failed\n\t *\/\n\tpublic static void zipFolder(String sourceFile, String target) throws IOException {\n        FileOutputStream fos = new FileOutputStream(target);\n        ZipOutputStream zipOut = new ZipOutputStream(fos);\n        File fileToZip = new File(sourceFile);\n \n        zipFile(fileToZip, fileToZip.getName(), zipOut);\n        zipOut.close();\n        fos.close();\n    }\n \n\t\/**\n\t * Internal zip method to zip a specific file into the folder\n\t * \n\t * @param fileToZip - The file to zip\n\t * @param fileName - The name of the file\n\t * @param zipOut - The outputstream of the current zipping process\n\t * @throws IOException - If the zipping failed\n\t *\/\n    private static void zipFile(File fileToZip, String fileName, ZipOutputStream zipOut) throws IOException {\n        if (fileToZip.isHidden()) {\n            return;\n        }\n        if (fileToZip.isDirectory()) {\n            if (fileName.endsWith(\"\/\")) {\n                zipOut.putNextEntry(new ZipEntry(fileName));\n                zipOut.closeEntry();\n            } else {\n                zipOut.putNextEntry(new ZipEntry(fileName + \"\/\"));\n                zipOut.closeEntry();\n            }\n            File[] children = fileToZip.listFiles();\n            for (File childFile : children) {\n                zipFile(childFile, fileName + \"\/\" + childFile.getName(), zipOut);\n            }\n            return;\n        }\n        FileInputStream fis = new FileInputStream(fileToZip);\n        ZipEntry zipEntry = new ZipEntry(fileName);\n        zipOut.putNextEntry(zipEntry);\n        byte[] bytes = new byte[1024];\n        int length;\n        while ((length = fis.read(bytes)) &gt;= 0) {\n            zipOut.write(bytes, 0, length);\n        }\n        fis.close();\n    }\n    \n    \/**\n     * Unzips a zip file\n     * \n     * @param fileZip - The zip file to unzip\n     * @param destDir - The path to where the zip file will be unzipped\n     * @throws IOException - If the zipping failed\n     *\/\n    public static void unzipFolder(String fileZip, String destDir) throws IOException {\n        byte[] buffer = new byte[1024];\n        ZipInputStream zis = new ZipInputStream(new FileInputStream(fileZip));\n        ZipEntry zipEntry = zis.getNextEntry();\n        while (zipEntry != null) {\n            File newFile = newFile(new File(destDir), zipEntry);\n            FileOutputStream fos = new FileOutputStream(newFile);\n            int len;\n            while ((len = zis.read(buffer)) &gt; 0) {\n                fos.write(buffer, 0, len);\n            }\n            fos.close();\n            zipEntry = zis.getNextEntry();\n        }\n        zis.closeEntry();\n        zis.close();\n    }\n    \n    \/**\n     * Internal unzip method used to unzip a specific file\n     * \n     * @param destinationDir\n     * @param zipEntry\n     * @return\n     * @throws IOException\n     *\/\n    private static File newFile(File destinationDir, ZipEntry zipEntry) throws IOException {\n        File destFile = new File(destinationDir, zipEntry.getName());\n         \n        String destDirPath = destinationDir.getCanonicalPath();\n        String destFilePath = destFile.getCanonicalPath();\n         \n        if (!destFilePath.startsWith(destDirPath + File.separator)) {\n            throw new IOException(\"Entry is outside of the target dir: \" + zipEntry.getName());\n        }\n         \n        return destFile;\n    }\n}\n<\/pre>\n<h1>Storing and loading BufferedImage as string<\/h1>\n<p>I came across a point where I had to manage Images inside a program. I wanted to store images in a handy way other than image formats. I wanted to store it as a String to be able to store it inside an XML file. And transform it on the fly as image again during runtime. So here are 2 simple functions to store and load PNG images. You can adapt it for other formats of course:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\npublic static String imageToString(BufferedImage img) throws IOException {\n\tfinal ByteArrayOutputStream os = new ByteArrayOutputStream();\n\tImageIO.write(img, \"png\", os);\n\treturn Base64.getEncoder().encodeToString(os.toByteArray());\n}\n\npublic static BufferedImage stringToImage(String text) throws IOException {\n\tbyte[] imageData = Base64.getDecoder().decode(text);\n\tByteArrayInputStream bais = new ByteArrayInputStream(imageData);\n\treturn ImageIO.read(bais);\n}\n<\/pre>\n<p>I use Base64 to avoid having strange character results, it&#8217;s then stored on a One Line String which is more beautiful. If you store it without Base64 in an XML document, it will be difficult to load it again, as it doesn&#8217;t support strange characters. And it seems to be a bit more condenced, resulting in lower size footprint.<\/p>\n<h1>Download file from URL<\/h1>\n<p>This one is for downloading a file from an URL, pretty easy to use. Provide the url as the Source and specify a target file.<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\npublic static void downloadFileTo(String source, String target) throws IOException {\n\tBufferedInputStream inputStream = new BufferedInputStream(new URL(source).openStream());\n\tFile file = new File(target);\n\tfile.getParentFile().mkdirs();\n\tfile.createNewFile();\n\tFileOutputStream fileOS = new FileOutputStream(file,false);\n\tbyte data[] = new byte[1024];\n\tint byteContent;\n\twhile ((byteContent = inputStream.read(data, 0, 1024)) != -1) {\n\t\tfileOS.write(data, 0, byteContent);\n\t}\n\tfileOS.close();\n}\n<\/pre>\n<h1>Log4j2 external file configuration<\/h1>\n<p>I came to the point where I had to configure log4j2 to use a specific file outside the generated jar file. I don&#8217;t really like embedded configuration files as you cannot edit them on the fly. So here is a function to specify the location of the log4j2.xml file. You will have to call it at the start of your program so you can use logging as soon as possible:<\/p>\n<pre class=\"brush: java; gutter: true; first-line: 1\">\nprivate static Logger log;\nprivate void configureLogging(String location) throws FileNotFoundException, IOException {\n\t\/\/ Set configuration file for log4j2\n\tConfigurationSource source = new ConfigurationSource(new FileInputStream(location));\n\tConfigurator.initialize(null, source);\n\tlog = LogManager.getLogger(YourClass.class);\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When I write code, I usually need some utility classes to ease the development. So here I will share my most used classes. Hope this will help you as well! XML store and load I strongly use XML for storing configurations or even data, so I made an helper which can store and load any [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[],"type_dbi":[],"class_list":["post-12834","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download\" \/>\n<meta property=\"og:description\" content=\"When I write code, I usually need some utility classes to ease the development. So here I will share my most used classes. Hope this will help you as well! XML store and load I strongly use XML for storing configurations or even data, so I made an helper which can store and load any [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-25T11:11:11+00:00\" \/>\n<meta name=\"author\" content=\"Middleware Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Middleware Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/\"},\"author\":{\"name\":\"Middleware Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d8563acfc6e604cce6507f45bac0ea1\"},\"headline\":\"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download\",\"datePublished\":\"2020-02-25T11:11:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/\"},\"wordCount\":505,\"commentCount\":0,\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/\",\"name\":\"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2020-02-25T11:11:11+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d8563acfc6e604cce6507f45bac0ea1\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d8563acfc6e604cce6507f45bac0ea1\",\"name\":\"Middleware Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"caption\":\"Middleware Team\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/middleware-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/","og_locale":"en_US","og_type":"article","og_title":"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download","og_description":"When I write code, I usually need some utility classes to ease the development. So here I will share my most used classes. Hope this will help you as well! XML store and load I strongly use XML for storing configurations or even data, so I made an helper which can store and load any [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/","og_site_name":"dbi Blog","article_published_time":"2020-02-25T11:11:11+00:00","author":"Middleware Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Middleware Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/"},"author":{"name":"Middleware Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"headline":"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download","datePublished":"2020-02-25T11:11:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/"},"wordCount":505,"commentCount":0,"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/","url":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/","name":"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2020-02-25T11:11:11+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/java-1-8-utility-classes-xml-zip-bufferedimage-and-download\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Java 1.8 Utility classes: XML, ZIP, BufferedImage and Download"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1","name":"Middleware Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","caption":"Middleware Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/12834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=12834"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/12834\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=12834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=12834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=12834"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=12834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}