- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.twelvemonkeys.imageio.metadata.xmp.XMPReader.read()
方法的一些代码示例,展示了XMPReader.read()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMPReader.read()
方法的具体详情如下:
包路径:com.twelvemonkeys.imageio.metadata.xmp.XMPReader
类名称:XMPReader
方法名:read
暂无
代码示例来源:origin: haraldk/TwelveMonkeys
Directory parseDirectory() throws IOException {
// Chop off potential trailing null-termination/padding that SAX parsers don't like...
int len = data.length;
for (; len > 0; len--) {
if (data[len - 1] != 0) {
break;
}
}
return new XMPReader().read(new ByteArrayImageInputStream(data, 0, len));
}
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFSeq() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-seq-example.xml"));
assertEquals(1, directory.size());
assertThat(directory.getEntryById("http://purl.org/dc/elements/1.1/subject"), hasValue(Arrays.asList("XMP", "metadata", "ISO standard")));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFBag() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-bag-example.xml"));
assertEquals(1, directory.size());
assertThat(directory.getEntryById("http://purl.org/dc/elements/1.1/subject"), hasValue(Arrays.asList("XMP", "metadata", "ISO standard"))); // Order does not matter
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectoryContentDC() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// dc|http://purl.org/dc/elements/1.1/
Directory dc = compound.getDirectory(2);
assertEquals(2, dc.size());
assertThat(dc.getEntryById("http://purl.org/dc/elements/1.1/description"), hasValue(Collections.singletonMap("x-default", "Picture 71146")));
assertThat(dc.getEntryById("http://purl.org/dc/elements/1.1/format"), hasValue("image/jpeg"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompoundDirectoryContentDC() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// dc|http://purl.org/dc/elements/1.1/
Directory dc = getDirectoryByNS(compound, XMP.NS_DC);
assertEquals(1, dc.size());
assertThat(dc.getEntryById("http://purl.org/dc/elements/1.1/format"), hasValue("image/jpeg"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectory() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
assertEquals(6, compound.directoryCount());
int size = 0;
for (int i = 0; i < compound.directoryCount(); i++) {
Directory sub = compound.getDirectory(i);
assertNotNull(sub);
size += sub.size();
}
assertEquals(directory.size(), size);
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompound() throws IOException {
// Alternate RDF syntax, using attribute values instead of nested tags
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
assertEquals(6, compound.directoryCount());
int size = 0;
for (int i = 0; i < compound.directoryCount(); i++) {
Directory sub = compound.getDirectory(i);
assertNotNull(sub);
size += sub.size();
}
assertEquals(directory.size(), size);
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompoundDirectoryContentPhotoshop() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// photoshop|http://ns.adobe.com/photoshop/1.0/
Directory photoshop = getDirectoryByNS(compound, XMP.NS_PHOTOSHOP);
assertEquals(3, photoshop.size());
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/ColorMode"), hasValue("1"));
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/ICCProfile"), hasValue("Dot Gain 20%"));
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/History"), hasValue(""));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAlt() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-alt-example.xml"));
assertEquals(1, directory.size());
assertThat(directory.getEntryById("http://purl.org/dc/elements/1.1/subject"), hasValue(new HashMap<String, String>() {{
put("x-default", "One");
put("en-us", "One");
put("de", "Ein");
put("no-nb", "En");
}}));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectoryContentEXIF() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// exif|http://ns.adobe.com/exif/1.0/
Directory exif = compound.getDirectory(5);
assertEquals(4, exif.size());
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/ColorSpace"), hasValue("-1")); // SIC. Same as unsigned short 65535, meaning "uncalibrated"?
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/PixelXDimension"), hasValue("3601"));
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/PixelYDimension"), hasValue("4176"));
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/NativeDigest"), hasValue("36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;297AD344CC15F29D5283460ED026368F"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompoundDirectoryContentXAP() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// xap|http://ns.adobe.com/xap/1.0/
Directory xap = getDirectoryByNS(compound, XMP.NS_XAP);
assertEquals(4, xap.size());
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/ModifyDate"), hasValue("2008-07-16T14:44:49-07:00"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/CreatorTool"), hasValue("Adobe Photoshop CS3 Windows"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/CreateDate"), hasValue("2008-07-16T14:44:49-07:00"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/MetadataDate"), hasValue("2008-07-16T14:44:49-07:00"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectoryContentMM() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// xapMM|http://ns.adobe.com/xap/1.0/mm/
Directory mm = compound.getDirectory(1);
assertEquals(3, mm.size());
assertThat(mm.getEntryById("http://ns.adobe.com/xap/1.0/mm/DocumentID"), hasValue("uuid:54A8D5F8654711DD9226A85E1241887A"));
assertThat(mm.getEntryById("http://ns.adobe.com/xap/1.0/mm/InstanceID"), hasValue("uuid:54A8D5F9654711DD9226A85E1241887A"));
assertThat(mm.getEntryById("http://ns.adobe.com/xap/1.0/mm/DerivedFrom"), hasValue(
new RDFDescription(Arrays.asList(
// stRef|http://ns.adobe.com/xap/1.0/sType/ResourceRef#
new XMPEntry("http://ns.adobe.com/xap/1.0/sType/ResourceRef#instanceID", "instanceID", "uuid:3B52F3610F49DD118831FCA29C13B8DE"),
new XMPEntry("http://ns.adobe.com/xap/1.0/sType/ResourceRef#documentID", "documentID", "uuid:3A52F3610F49DD118831FCA29C13B8DE")
))
));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectoryContentPhotoshop() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// photoshop|http://ns.adobe.com/photoshop/1.0/
Directory photoshop = compound.getDirectory(0);
assertEquals(4, photoshop.size());
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/DateCreated"), hasValue("2008-07-01"));
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/ColorMode"), hasValue("4"));
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/ICCProfile"), hasValue("U.S. Web Coated (SWOP) v2"));
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/History"), hasValue(""));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectoryContentXAP() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// xap|http://ns.adobe.com/xap/1.0/
Directory xap = compound.getDirectory(4);
assertEquals(4, xap.size());
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/ModifyDate"), hasValue("2008-08-06T12:43:05+10:00"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/CreatorTool"), hasValue("Adobe Photoshop CS2 Macintosh"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/CreateDate"), hasValue("2008-08-06T12:43:05+10:00"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/MetadataDate"), hasValue("2008-08-06T12:43:05+10:00"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompoundDirectoryContentEXIF() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// exif|http://ns.adobe.com/exif/1.0/
Directory exif = getDirectoryByNS(compound, XMP.NS_EXIF);
assertEquals(4, exif.size());
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/ColorSpace"), hasValue("-1")); // SIC. Same as unsigned short 65535, meaning "uncalibrated"?
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/PixelXDimension"), hasValue("426"));
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/PixelYDimension"), hasValue("550"));
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/NativeDigest"), hasValue("36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;A7F21D25E2C562F152B2C4ECC9E534DA"));
}
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompoundDirectoryContentMM() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// xapMM|http://ns.adobe.com/xap/1.0/mm/
Directory mm = getDirectoryByNS(compound, XMP.NS_XAP_MM);
assertEquals(3, mm.size());
assertThat(directory.getEntryById("http://ns.adobe.com/xap/1.0/mm/DocumentID"), hasValue("uuid:6DCA50CC7D53DD119F20F5A7EA4C9BEC"));
assertThat(directory.getEntryById("http://ns.adobe.com/xap/1.0/mm/InstanceID"), hasValue("uuid:6ECA50CC7D53DD119F20F5A7EA4C9BEC"));
// Custom test, as NamedNodeMap does not preserve order (tests can't rely on XML impl specifics)
Entry derivedFrom = directory.getEntryById("http://ns.adobe.com/xap/1.0/mm/DerivedFrom");
assertNotNull(derivedFrom);
assertThat(derivedFrom.getValue(), instanceOf(RDFDescription.class));
// stRef|http://ns.adobe.com/xap/1.0/sType/ResourceRef#
RDFDescription stRef = (RDFDescription) derivedFrom.getValue();
assertThat(stRef.getEntryById("http://ns.adobe.com/xap/1.0/sType/ResourceRef#instanceID"), hasValue("uuid:74E1C905B405DD119306A1902BA5AA28"));
assertThat(stRef.getEntryById("http://ns.adobe.com/xap/1.0/sType/ResourceRef#documentID"), hasValue("uuid:7A6C79768005DD119306A1902BA5AA28"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntaxCompoundDirectoryContentTIFF() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// tiff|http://ns.adobe.com/tiff/1.0/
Directory tiff = getDirectoryByNS(compound, XMP.NS_TIFF);
assertEquals(5, tiff.size());
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/Orientation"), hasValue("1"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/XResolution"), hasValue("720000/10000"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/YResolution"), hasValue("720000/10000"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/ResolutionUnit"), hasValue("2"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/NativeDigest"), hasValue("256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;C08D8E93274C4BEE83E86CF999955A87"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testCompoundDirectoryContentTIFF() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
assertThat(directory, instanceOf(CompoundDirectory.class));
CompoundDirectory compound = (CompoundDirectory) directory;
// tiff|http://ns.adobe.com/tiff/1.0/
Directory tiff = compound.getDirectory(3);
assertEquals(12, tiff.size());
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/ImageWidth"), hasValue("3601"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/ImageLength"), hasValue("4176"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/BitsPerSample"), hasValue(Arrays.asList("8", "8", "8")));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/Compression"), hasValue("1"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/PhotometricInterpretation"), hasValue("2"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/SamplesPerPixel"), hasValue("3"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/PlanarConfiguration"), hasValue("1"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/XResolution"), hasValue("3000000/10000"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/YResolution"), hasValue("3000000/10000"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/ResolutionUnit"), hasValue("2"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/Orientation"), hasValue("1"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/NativeDigest"), hasValue("256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;C21EE6D33E4CCA3712ECB1F5E9031A49"));
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testDirectoryContent() throws IOException {
Directory directory = createReader().read(getDataAsIIS());
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testRDFAttributeSyntax() throws IOException {
Directory directory = createReader().read(getResourceAsIIS("/xmp/rdf-attribute-shorthand.xml"));
在javax.imageio.ImageIO中,有一个方法#write(RenderedImage im, String formatName, OutputStream output),它接受开发人
我对此问题感到非常困惑。我在jai-imageio-core上使用的是1.3.0版本,请检查下面的依赖关系,我完全不知道如何从jar中找出如何在JVM中加载一个类文件(RawImageReaderSp
我的应用程序正在将图像保存到文件夹中。同时另一个软件监视该文件夹并打印粘贴的图像。 我遇到的问题是打印应用程序可以在打印机上发送一半渲染的图像,或者根本不对保存的图像使用react。 我正在使用 ja
在下面的代码片段中,我尝试使用 javax.imageio.ImageIO 设置我的 JFrame 实例的图标,但出现以下异常。你能告诉我我缺少什么吗? import javax.imagei
我正在尝试将 Spring Web 应用程序部署到在 Windows Azure 上的生产环境中运行的 Tomcat 7(尝试过 Ubuntu 和 Windows Datacenter VM)。遗憾的
在使用套接字通过网络传输图像时,我遇到了一个奇怪的问题: 当我使用 ImageIO.write() 将图像写入一个套接字的 OutputStream 并使用 ImageIO.write() 从另一个套
下面您将看到一张来自土耳其的名为“simit”的精美糕点图片。它取自 iPad 2,因此它是尺寸为 720*960 的 JPEG。 问题是,当我使用 javax.imageio.ImageIO.rea
我在 Tomcat 5.5 中有一个 Servlet,它读取文件夹中的本地镜像。然后将图像发送回 Applet。 我收到此消息“javax.imageio.IIOException:无法创建 Imag
我有一张图片,称之为 grayscale.jpg。现在我在 The Gimp 中打开该图像并将颜色模式更改为 RGB 并将其保存为 color.jpg。如果我在任何图像查看器中查看 grayscale
这个问题在这里已经有了答案: Can't import javax.imageio.ImageIO in Android application (1 个回答) 关闭 9 年前。 当我试图做的时候,
我想将 Canvas 对象保存为图像,为此我想使用 ImageIO 类。我正在使用 Eclipse,但是当我尝试导入此库时(导入 javax.imageio.ImageIO;)Eclipse 向我显示
protected void doGet(HttpServletRequest req, HttpServletResponse response) throws IOExceptio
我正在尝试通过套接字发送图像,但我遇到了一个奇怪的问题。ImageIO.write 发送的数据比 ImageIO.read 接收的数据多。例如,如果我在循环中有以下代码: (客户端) out.writ
我在 python 中处理一些图像,我正在尝试将一系列大小为 961x509 的图像转换为 MP4 电影文件。我已经这样做了并且它正在工作但是我有一个非常烦人的问题,警告说是这样的: WARNING:
Apple 的图像 I/O 编程指南说道: Image I/O resides in the Application Services framework in Mac OS X, and in th
我一直在开发一个程序,其中使用来自此 API (musicg) 的代码:http://code.google.com/p/musicg/ 但是,我的代码中仍有一部分给我带来了麻烦(GraphicRen
我无法加载 JAI 1.3.0 的 ImageIO 类。 Java 6 和 Web 应用程序服务器 (WAS) 8.5。我的代码适用于 Java 6 和 WAS(7.0.19)。 我已经在 pom.x
我一直在使用 javax.imageio.ImageIO 中的 ImageIO.read() 和 ImageIO.write() 方法来读取和写入图像,我发现有些图像的颜色发生了奇怪的变化。 即使我将
如果图像不是RGB颜色,如何解码图像。它应该通过支持所有格式(Jpg、Png、Gif来解码图像) code>..etc) 任何 api 都可以解码。 这是失败的代码行。那么可以使用哪种方法来解决该问题
以下测试在 Java 9 上失败,而在 Java 8 中通过: @Test public void getImage_SetValueUsingConstructor_ShouldReturnCorr
我是一名优秀的程序员,十分优秀!