Source Code

Upload a File
Upload a FileThe following tasks guide you through using the low-level Java classes to upload a file.Low-Level API File Uploading Process1Create an instance of the AmazonS3Client class, by providing your AWS credentials.2Initiate multipart upload by executing the AmazonS3Client.initiateMultipartUplo…[ More ]
Java HttpURLConnection follow redirect example
Java HttpURLConnection follow redirect exampleThe HttpURLConnection‘s follow redirect is just an indicator, in fact it won’t help you to do the “real” http redirection, you still need to handle it manually.URL obj = new URL(url);HttpURLConnection conn = (HttpURLConnection) obj.openConnection…[ More ]
iText in Action
iText in Action  import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;import java.security.GeneralSecurityException;import java.security.KeyStore;import java.security.PrivateKey;import java.security.Security;i…[ More ]
File Encryption and Decryption using PBE
File Encryption and Decryption using PBEPassword-Based Encryption (PBE) derives an encryption key from a password. In order to make the task of getting from password to key very time-consuming for an attacker, most PBE implementations (as the one shown below) will mix in a random number, known as a …[ More ]
Encryption/Decryption of files in java.
Encryption/Decryption of files in java.1.import java.io.FileInputStream;2.import java.io.FileOutputStream;3.import java.io.InputStream;4.import java.io.OutputStream;5.import java.security.Key;6.import java.security.KeyPair;7.import java.security.KeyPairGenerator;8.import java.security.NoSuchAlgorith…[ More ]
Encrypting and Decrypting a file
Encrypting and Decrypting a file Today I am going to discuss how you can encrypt any file in Java.For encryption we need a key based on which the encryption will be done. Not only that, I will also show how you can decrypt that file and get back the original one. The encryption algorithm can be chos…[ More ]
Creating and Verifying Digital Signatures Web Development
Creating and Verifying Digital Signatures Web DevelopmentinShare. Share on reddit  Permalink Creating and Verifying Digital SignaturesBy Rafael Palacios and David de la Fuente, January 08, 2009Post a Comment A straightforward method for creating and verifying digital signatures in HTML formsServer-s…[ More ]
Capture Image from Camera and Display in Activity
Capture Image from Camera and Display in Activity MyCameraActivity.javapublic class MyCameraActivity extends Activity {  private static final int CAMERA_REQUEST = 1888;   private ImageView imageView;  @Override  public void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  …[ More ]
How to get IP address of a Host in Java?
How to get IP address of a Host in Java?Description: You can get IP address of any host by using InetAddress class. By calling getByName() method with host name as parameter, it returns InetAddress object. On this object you can call getHostAddress() method to get the IP address of the given host. C…[ More ]
How to create a semantic search
How to create a semantic search  //connected to DB  foreach (array('questioncontent') as $varname) {  $questioncontent = (isset($_POST[$varname])) ? $_POST[$varname] : '';  }  ?>  Search for a previous question by entering in a phrase in the search box below and submitting the phraseSearch: …[ More ]
Java Examples - Host Specific IP Address
How to find hostname from IP Address?Solution:Following example shows how to change the host name to its specific IP address with the help of InetAddress.getByName() method of net.InetAddress class.import java.net.InetAddress;public class Main {  public static void main(String[] argv) throws Excepti…[ More ]
How to get IP address of a Host in Java?
How to get IP address of a Host in Java?Description: You can get IP address of any host by using InetAddress class. By calling getByName() method with host name as parameter, it returns InetAddress object. On this object you can call getHostAddress() method to get the IP address of the given host. C…[ More ]
How do I send an email with attachment
How do I send an email with attachmentpackage org.kodejava.example.mail;import javax.activation.DataHandler;import javax.activation.FileDataSource;import javax.mail.*;import javax.mail.internet.InternetAddress;import javax.mail.internet.MimeBodyPart;import javax.mail.internet.MimeMessage;import java…[ More ]
Download All Email With Attachment Form Gmail Using Java Mail
Download All Email With Attachment Form Gmail Using Java MailCode :-import java.io.*;import java.util.Properties;import javax.mail.*;import javax.mail.internet.*;public class DownloadEmailWithAttachment {  public static void main (String args[]) throws Exception {     // gmail pop3 host name     Str…[ More ]
A Client to Send SMTP Mail
 A Client to Send SMTP Mail   import java.awt.*;import javax.swing.*;/** * Example program from Chapter 1 Programming Spiders, Bots and Aggregators in * Java Copyright 2001 by Jeff Heaton *  * SendMail is an example of client sockets. This program presents a simple * dialog box that prompts the user…[ More ]
easy to send HTML mail with JavaMail
easy to send HTML mail with JavaMailIt's easy to send HTML mail with JavaMail. Simply set the content type to "text/html". import javax.mail.*;import javax.mail.internet.*;import java.util.Properties;class SimpleMail {  public static void main(String[] args) throws Exception{  System.out.println("Se…[ More ]
Send email using java
Send email using javaimport java.util.*;import javax.mail.*;import javax.mail.internet.*;import javax.activation.*;public class SendEmail {  public static void main(String [] args) {  // Recipient's email ID needs to be mentioned.  String to = "abcd@gmail.com";  // Sender's email ID needs to be ment…[ More ]
Send & Receive emails through a GMail account using Java
Send & Receive emails through a GMail account using JavaIntroductionAll of us have the experience of sending emails using web services such as Google mail,Yahoo mail, Hotmail, …etc. But here I’m going to mention how to send and read emails through a Java desktop application.You can Send emails, …[ More ]
Search a JavaMail mailbox for unseen messages
Search a JavaMail mailbox for unseen messagesWhile working on a Java application yesterday, I ran into a situation where I needed to search my POP3 mailbox for unseen messages, i.e., email messages I haven't read yet. (I'm adding some "You've got mail" functionality to one of my automated robots.)Ju…[ More ]
sample code for java mail api with attachment
 sample code for java mail api with attachment Any one guide me, how can i send mail with pdf attachment using java source(Java mail API). http://www.roseindia.net/javamail/ http://www.javaworld.com/jw-10-2001/jw-1026-javamail.html  Thanks for your reply. Now i can sent mail with attachment using …[ More ]