Skip to content

Utility for decoding uuencoded contents. Extract text and attachments from an uuencoded mail.

License

Notifications You must be signed in to change notification settings

biagioT/java-uudecoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JAVA UUDecoder

Utility for decoding uuencoded contents. Extract text and attachments from an uuencoded mail.

Usage

<dependency>
	<groupId>app.tozzi</groupId>
	<artifactId>uudecoder</artifactId>
	<version>4.0.0</version>
</dependency>

Simple example of use:

String uuencodedContent = ...;
UUDecodedBean decodedBean = UUDecodedBean decode(content); 		 
String content = decodedBean.getContent(); 
List<UUDecodedAttachment> attachments = decodedBean.getAttachments();

Advanced example:

//  MimePart part = ...
if (part.isMimeType("text/plain")) {
	
   Object partContent = part.getContent();
   String txtContent = partContent.toString();

   if (UUDecoder.containsUUEncodedAttachments(txtContent)) {
        txtContent = txtContent.substring(0, UUDecoder.getNextBeginIndex(txtContent));

        for (UUDecodedAttachment uda : UUDecoder.getUUDecodedAttachments(partContent.toString())) {
	         String fileName = uda.getFileName();
	         DataSource dataSource = uda.getDataSource();
	         // ...
        }
   }
	
 // ...
 String txtBody = MimeUtility.decodeText(txtContent);
}
// ...

Requirements

  • >= Java 8

License

  • The project license file is available here.