Atitit. Verification code recognition Step 2 ------ ClipBoard copy image attilax summary, atititstep2 ------

Source: Internet
Author: User

Atitit. Verification code recognition Step 2 ------ ClipBoard copy image attilax summary, atititstep2 ------

Atitit. Verification code recognition Step 2 ------ ClipBoard copy image attilax Summary

 

ClipBoard is an area in memory and a very useful tool built into Windows. It uses a small ClipBoard to build a color bridge between various applications, transfer and share information

 

The system clipboard generally supports String text and Image types: Custom Clipboard data types are supported.

 

Common Clipboard data types

 

Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com

Reprinted please indicate Source: http://blog.csdn.net/attilax

 

 

/**

* The <code> DataFlavor </code> representing a Java Unicode String class,

* Where:

* <Pre>

* RepresentationClass = java. lang. String

* MimeType = "application/x-java-serialized-object"

* </Pre>

*/

Public static final DataFlavor stringFlavor = createConstant (java. lang. String. class, "Unicode String ");

 

/**

* The <code> DataFlavor </code> representing a Java Image class,

* Where:

* <Pre>

* RepresentationClass = java. awt. Image

* MimeType = "image/x-java-image"

* </Pre>

*/

Public static final DataFlavor imageFlavor = createConstant ("image/x-java-image; class = java. awt. Image", "Image ");

 

/**

* The <code> DataFlavor </code> representing plain text with Unicode

* Encoding, where:

* <Pre>

* RepresentationClass = InputStream

* MimeType = "text/plain; charset = unicode"

* </Pre>

* This <code> DataFlavor </code> has been <B> deprecated </B> because

* (1) Its representation is an InputStream, an 8-bit based representation,

* While Unicode is a 16-bit character set; and (2) The charset "unicode"

* Is not well-defined. "unicode" implies a participant platform's

* Implementation of Unicode, not a cross-platform implementation.

*

* @ Deprecated as of 1.3. Use <code> DataFlavor. getReaderForText (Transferable) </code>

* Instead of <code> Transferable. getTransferData (DataFlavor. plainTextFlavor) </code>.

*/

@ Deprecated

Public static final DataFlavor plainTextFlavor = createConstant ("text/plain; charset = unicode; class = java. io. InputStream", "Plain Text ");

 

/**

* A mime Content-Type of application/x-java-serialized-object represents

* A graph of Java object (s) that have been made persistent.

*

* The representation class associated with this <code> DataFlavor </code>

* Identifies the Java type of an object returned as a reference

* From an invocation <code> java. awt. datatransfer. getTransferData </code>.

*/

Public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object ";

 

/**

* To transfer a list of files to/from Java (and the underlying

* Platform) a <code> DataFlavor </code> of this type/subtype and

* Representation class of <code> java. util. List </code> is used.

* Each element of the list is required/guaranteed to be of type

* <Code> java. io. File </code>.

*/

Public static final DataFlavor javaFileListFlavor = createConstant ("application/x-java-file-list; class = java. util. List", null );

 

/**

* To transfer a reference to an arbitrary Java object reference that

* Has no associated MIME Content-type, authentication ss a <code> Transferable </code>

* Interface within the same jvm, a <code> DataFlavor </code>

* With this type/subtype is used, with a <code> representationClass </code>

* Equal to the type of the class/interface being passed transmission ss

* <Code> Transferable </code>.

* <P>

* The object reference returned from

* <Code> Transferable. getTransferData </code> for a <code> DataFlavor </code>

* With this MIME Content-Type is required to be

* An instance of the representation Class of the <code> DataFlavor </code>.

*/

Public static final String javaJVMLocalObjectMimeType = "application/x-java-jvm-local-objectref ";

 

/**

* In order to pass a live link to a Remote object via a Drag and Drop

* <Code> ACTION_LINK </code> operation a Mime Content Type

* Application/x-java-remote-object shoshould be used,

* Where the representation class of the <code> DataFlavor </code>

* Represents the type of the <code> Remote </code> interface to be

* Transferred.

*/

Public static final String javaRemoteObjectMimeType = "application/x-java-remote-object ";

 

/**

 

 

Prj. atibrow

// Obtain the clipboard image

Image image = null;

Try {

Image = ClipboardUtil. getImageFromClipboard ();

} Catch (Exception e ){

// TODO Auto-generated catch block

E. printStackTrace ();

}

 

 

 

/**

* Obtain the image from the clipboard.

*/

Public static Image getImageFromClipboard () throws Exception {

Clipboard sysc = Toolkit. getdefatooltoolkit (). getSystemClipboard ();

Transferable cc = sysc. getContents (null );

If (cc = null)

Return null;

Else if (cc. isDataFlavorSupported (DataFlavor. imageFlavor ))

Return (Image) cc. getTransferData (DataFlavor. imageFlavor );

Return null;

}

 

 

Java operating system Clipboard and custom Clipboard-iteyetechnical website .htm

Related to the copying image of java.awt.ranransfer.clipboard_ _thinksaas.htm

Java reads clipboard content-convert images to png or jpg-blog channel-CSDN.NET.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.