×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Question How to create large file fast?

    Hello!

    In my application I need to create large empty files (>50Mb) then fill them with data.

    My problem is that I do not find any method for creating file with a specific size. My current solution is that I create a file something like this (it is just an example code):

    conn = (FileConnection) Connector.open( "file:///"+aFilePath,
    Connector.READ_WRITE );
    conn.create();

    Then I open an outputStream to the file and I write empty data to it (just for example a basic code part):

    byte[] zeros = new byte[262144];
    out = conn.openOutputStream();

    // as many times as needed
    while(needed){
    out.write(zeros);
    }
    out.flush();

    But this solution is very slow if I have to create a large file. Is there any faster way?

    Thank you frou your help!
    Br,
    Peter

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: How to create large file fast?

    Hi Peter,

    AFAIK this is the only way to perform that, there is no way to determine its size in advance.

    Kind regards,
    Juarez Alvares Barbosa Junior - Brazil

Similar Threads

  1. Replies: 10
    Last Post: 2007-07-02, 06:28
  2. Contacts fields order??
    By timatima in forum Symbian
    Replies: 1
    Last Post: 2007-06-08, 13:51
  3. S40 Create File
    By tyrael in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2007-05-24, 01:40
  4. Can't create settings file and log file.
    By skhimsara in forum Symbian
    Replies: 1
    Last Post: 2006-05-08, 09:25
  5. Create MBM file from BMP file.
    By BugBuster in forum Symbian
    Replies: 5
    Last Post: 2003-09-04, 03:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •