Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: base64 to file in java6 with data longer than 65000

  1. #1
    Junior Member
    Join Date
    Feb 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default base64 to file in java6 with data longer than 65000

    Hi ,

    I've Base64 code that i need to open it as file , i used DatatypeConverter.parseBase64Binary which is working fine with data less than 65000 , but the issue that i receive codes which is longer than that how can i manage this in JAVA6 ???

    Below is the working Code
    CREATE OR REPLACE JAVA SOURCE NAMED "BlobHandler" AS
    import java.lang.*;
    import java.sql.*;
    import oracle.sql.*;
    import java.io.*;
    import javax.xml.bind.DatatypeConverter;

    public class BlobHandler
    {
    public static void ExportBlob(String CONTFILE, BLOB CONTBLOB) throws Exception
    {
    try
    {
    File file = new File("/u01/oracle/jam_export/contract1");
    FileOutputStream fos = new FileOutputStream(file);
    //Decoding
    byte[] decoded = DatatypeConverter.parseBase64Binary("JVBERi0xLjcNC iW1");
    System.out.println("PDF File Saved");
    fos.write(decoded);
    fos.flush();
    fos.close();
    }
    catch (Exception e)
    {
    System.out.println(e);
    }
    }
    };
    Note DatatypeConverter.parseBase64Binary("JVBERi0xLjcNC iW1"); is a part of the BASE64 code for the post character limitation
    Last edited by marwa.abdelhamid; February 2nd, 2020 at 03:57 AM.

Similar Threads

  1. Replies: 0
    Last Post: October 4th, 2017, 12:24 PM
  2. Unzip base64 encoding
    By elie in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 26th, 2017, 08:52 AM
  3. Base64 encoding is not working.
    By samjna in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 28th, 2012, 11:50 PM
  4. Base64 problem
    By FelicianoX in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 16th, 2011, 03:56 AM
  5. Replies: 8
    Last Post: March 25th, 2011, 02:34 PM