atitit.验证码识别step2------剪贴板ClipBoardcopyimage图像attilax总结
剪贴板(ClipBoard)是内存中的一块区域,是Windows内置的一个非常有用的工具,通过小小的剪贴板,架起了一座彩桥,使得在各种应用程序之间,传递和共享信息成为可
系统剪切板一般支持String文本类型和Image图像类型:支持自定义剪切板数据类型
常见的剪切板数据类型
作者::老哇的爪子Attilax艾龙,EMAIL:1466519819@
转载请注明来源:/attilax
/**
*The<code>DataFlavor</code>representingaJavaUnicodeStringclass,
*where:
*<pre>
*representationClass=java.lang.String
*mimeType="application/x-java-serialized-object"
*</pre>
*/
publicstaticfinalDataFlavorstringFlavor=createConstant(java.lang.String.class,"UnicodeString");
/**
*The<code>DataFlavor</code>representingaJavaImageclass,
*where:
*<pre>
*representationClass=java.awt.Image
*mimeType="image/x-java-image"
*</pre>
*/
publicstaticfinalDataFlavorimageFlavor=createConstant("image/x-java-image;class=java.awt.Image","Image");
/**
*The<code>DataFlavor</code>representingplaintextwithUnicode
*encoding,where:
*<pre>
*representationClass=InputStream
*mimeType="text/plain;charset=unicode"
*</pre>
*This<code>DataFlavor</code>hasbeen<b>deprecated</b>because
*(1)ItsrepresentationisanInputStream,an8-bitbasedrepresentation,
*whileUnicodeisa16-bitcharacterset;and(2)Thecharset"unicode"
*isnotwell-defined."unicode"impliesaparticularplatform's
*implementationofUnicode,notacross-platformimplementation.
*
*@deprecatedasof1.3.Use<code>DataFlavor.getReaderForText(Transferable)</code>
*insteadof<code>Transferable.getTransferData(DataFlavor.plainTextFlavor)</code>.
*/
@Deprecated
publicstaticfinalDataFlavorplainTextFlavor=createConstant("text/plain;charset=unicode;class=java.io.InputStream","PlainText");
/**
*AMIMEContent-Typeofapplication/x-java-serialized-objectrepresents
*agraphofJavaobject(s)thathavebeenmadepersistent.
*
*Therepresentationclassassociatedwiththis<code>DataFlavor</code>
*identifiestheJavatypeofanobjectreturnedasareference
*fromaninvocation<code>java.awt.datatransfer.getTransferData</code>.
*/
publicstaticfinalStringjavaSerializedObjectMimeType="application/x-java-serialized-object";
/**
*Totransferalistoffilesto/fromJava(andtheunderlying
*platform)a<code>DataFlavor</code>ofthistype/subtypeand
*representationclassof<code>java.util.List</code>isused.
*Eachelementofthelistisrequired/guaranteedtobeoftype
*<code>java.io.File</code>.
*/
publicstaticfinalDataFlavorjavaFileListFlavor=createConstant("application/x-java-file-list;class=java.util.List",null);
/**
*TotransferareferencetoanarbitraryJavaobjectreferencethat
*hasnoassociatedMIMEContent-type,acrossa<code>Transferable</code>
*interfaceWITHINTHESAMEJVM,a<code>DataFlavor</code>
*withthistype/subtypeisused,witha<code>representationClass</code>
*equaltothetypeoftheclass/interfacebeingpassedacrossthe
*<code>Transferable</code>.
*<p>
*Theobjectreferencereturnedfrom
*<code>Transferable.getTransferData</code>fora<code>DataFlavor</code>
*withthisMIMEContent-Typeisrequiredtobe
*aninstanceoftherepresentationClassofthe<code>DataFlavor</code>.
*/
publicstaticfinalStringjavaJVMLocalObjectMimeType="application/x-java-jvm-local-objectref";
/**
*InordertopassalivelinktoaRemoteobjectviaaDragandDrop
*<code>ACTION_LINK</code>operationaMimeContentTypeof
*application/x-java-remote-objectshouldbeused,
*wheretherepresentationclassofthe<code>DataFlavor</code>
*representsthetypeofthe<code>Remote</code>interfacetobe
*transferred.
*/
publicstaticfinalStringjavaRemoteObjectMimeType="application/x-java-remote-object";
/**
prj.atibrow
//获取粘贴板图片
Imageimage=null;
try{
image=ClipboardUtil.getImageFromClipboard();
}catch(Exceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}
/**
*从剪切板获得图片。
*/
publicstaticImagegetImageFromClipboard()throwsException{
Clipboardsysc=Toolkit.getDefaultToolkit().getSystemClipboard();
Transferablecc=sysc.getContents(null);
if(cc==null)
returnnull;
elseif(cc.isDataFlavorSupported(DataFlavor.imageFlavor))
return(Image)cc.getTransferData(DataFlavor.imageFlavor);
returnnull;
}
java操作系统剪切板Clipboard及自定义剪切板--ITeye技术网站.htm
关于java.awt.datatransfer.Clipboard的复制图片等等_小组_ThinkSAAS.htm
java读取粘贴板内容——将图片转成png或者jpg格式--博客频道-.htm
如果觉得《atitit.验证码识别step2------剪贴板ClipBoard copy image图像 attilax总结》对你有帮助,请点赞、收藏,并留下你的观点哦!