如何从字符串中删除奇怪和不需要的Unicode字符(例如带问号的黑色菱形)?
更新:
请告诉我对应于"带有问号的黑色钻石"的Unicode字符串或正则表达式.
我尝试了以下代码来完成读写tiff图像的任务:
// Define the source and destination file names.
String inputFile = /images/FarmHouse.tif
String outputFile = /images/FarmHouse.bmp
// Load the input image.
RenderedOp src = JAI.create("fileload", inputFile);
// Encode the file as a BMP image.
FileOutputStream stream =
new FileOutputStream(outputFile);
JAI.create("encode", src, stream, BMP, null);
// Store the image in the BMP format.
JAI.create("filestore", src, outputFile, BMP, null);
Run Code Online (Sandbox Code Playgroud)
但是,当我运行代码时,我收到以下错误消息:
Caused by: java.lang.IllegalArgumentException: Only images with either 1 or 3 bands
can be written out as BMP files.
at com.sun.media.jai.codecimpl.BMPImageEncoder.encode(BMPImageEncoder.java:123)
at …Run Code Online (Sandbox Code Playgroud) 我无法弄清楚如何解决这个问题.我有一个名为"urlrewrite.xml"的文件,它是在ROO Shell中运行"controller"命令后由spring ROO自动生成的.
但是,我仍然收到以下错误:
"Referenced file contains errors (http://tuckey.org/res/dtds/urlrewrite3.0.dtd). For more information, right click on the message in the Problems View and select "Show Details..."
Run Code Online (Sandbox Code Playgroud)
这是urlrewrite.xml文件的内容:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<urlrewrite default-match-type="wildcard">
<rule>
<from>/resources/**</from>
<to last="true">/resources/$1</to>
</rule>
<rule>
<from>/static/WEB-INF/**</from>
<set type="status">403</set>
<to last="true">/static/WEB-INF/$1</to>
</rule>
<rule>
<from>/static/**</from>
<to last="true">/$1</to>
</rule>
<rule>
<from>/</from>
<to last="true">/app/index</to>
</rule>
<rule>
<from>/app/**</from>
<to last="true">/app/$1</to>
</rule>
<rule>
<from>/**</from>
<to>/app/$1</to>
</rule>
<outbound-rule>
<from>/app/**</from>
<to>/$1</to>
</outbound-rule>
</urlrewrite>
Run Code Online (Sandbox Code Playgroud)
有关如何摆脱这个错误的任何想法?