Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6031081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:07:52+00:00 2026-05-23T05:07:52+00:00

To Anybody that uses the javolution, please guide me on how to use it.

  • 0

To Anybody that uses the javolution, please guide me on how to use it.
Any snippet code helps me a lot.

here’s my current code:

public static void mergeAllFilesJavolution2()throws FileNotFoundException, IOException {
    String fileDir = "C:\\TestData\\w12";
    File dirSrc = new File(fileDir);
    File[] list = dirSrc.listFiles();
    long start = System.currentTimeMillis();

    String outFile = fileDir + "\\..\\merged.txt";
    File file2 = new File(outFile);
    //file2.createNewFile();
    FileChannel fc2 = (new RandomAccessFile(file2, "rw")).getChannel(); 

    for(int j=0; j<list.length; j++){
        int chr;
        String srcFile = list[j].getPath();

        File file = new File(srcFile);
        FileChannel fc = (new FileInputStream(file)).getChannel(); 
        MappedByteBuffer buf = fc.map(MapMode.READ_ONLY, 0, file.length());
        UTF8ByteBufferReader inFile= new UTF8ByteBufferReader().setInput(buf);

        MappedByteBuffer buf2 = fc2.map(MapMode.READ_WRITE, file2.length(), file.length());
        UTF8ByteBufferWriter outPut= new UTF8ByteBufferWriter().setOutput(buf2);

        while((chr=inFile.read()) != -1) {
            outPut.write(chr);
        }
        outPut.close();
        inFile.close();
    }
    System.out.println(System.currentTimeMillis()-start);
}

but it gives me an exception:

Exception in thread “main”
java.nio.channels.NonReadableChannelException
at
sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:716)
at
abc.filedivision.FileMergeTest.mergeAllFilesJavolution2(FileMergeTest.java:100)
at
abc.filedivision.FileMergeTest.main(FileMergeTest.java:27)

Any guidance on the right direction is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:07:53+00:00Added an answer on May 23, 2026 at 5:07 am

    My guess is it is complaining here (thats why its important to look at the line of code which has the error)

    FileChannel fc2 = (new FileOutputStream(file2, true)).getChannel(); 
    MappedByteBuffer buf2 = fc2.map(MapMode.READ_WRITE, 0, file2.length());
    

    This exception is thrown if you are trying to use the channel to read but it is not readable.

    You can only open a channel in READ_WRITE mode if you use RandomAccessFile in “rw”, “rws”, or “rwd” modes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hoping that anybody here knows about a good one: I'm looking for a (free
I'm having problems compiling a CUDA program that uses GLUT on MacOsX. Here is
Ive just seen a piece of code that uses a generic list class to
Has anybody used or seen a website that uses FlapJax to function, rather than
I have some c# code that uses the Microsoft Scripting Control to evaluate some
I'm getting errors while compiling a program that uses threads. Here is the part
Has anybody successfully used Report Builder 3.0 on a company network (that uses a
I have recently been tasked to working on code that uses Java CUP. Does
Anybody aware of a best practices or example project out there that uses ASP.NET
Has anybody ever had issues with a Java application that uses Jacob to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.