• Post Reply Bookmark Topic Watch Topic
  • New Topic

UUDecoder and UUEncoder classes in sun.misc

 
Chris Chaney
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, first of all I know the huge warning that comes with using anything in sun.misc, but....
I'm trying to write a simple newsgroup binary decoder, but the files the UUDecoder class generates are corrupt.
Are there any alternatives for UUDecoding / Encoding in java that aren't commercial packages?
Thanks!
Here's a code sample...
package jnewshound;
import sun.misc.UUEncoder;
import sun.misc.UUDecoder;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
public class test {
public test(){}
public static void main(String args[]){
FileInputStream fileinputstream;
FileOutputStream fileoutputstream;
UUEncoder encoder = new UUEncoder();
UUDecoder decoder = new UUDecoder();
try{
fileinputstream = new FileInputStream("input.jpg");
fileoutputstream = new FileOutputStream("output.txt");
encoder.encodeBuffer(fileinputstream,fileoutputstream);
fileinputstream.close();
fileoutputstream.close();
fileinputstream = new FileInputStream("output.txt");
fileoutputstream = new FileOutputStream("output.jpg");
fileoutputstream.write(decoder.decodeBuffer(fileinputstream));

fileinputstream.close();
fileoutputstream.close();
}
catch(FileNotFoundException fnfe){
System.err.println(fnfe.getMessage());
return;
}
catch(IOException ioe){
System.err.println(ioe.getMessage());
return;
}
System.out.println("THE END!");
return;
}
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!