2

I'm currently trying to developp a simple software which retrieves articles on a nntp server. I'm using NNTPClient from apache.commons.net.

When I retrieve all the segments of an article, segments are longer than expected and I cannot decode them (and merrge them) with an yDec soft (like this one).

Here's my code which downloads segments and write them on the HDD :

BufferedReader br;
String line;
List<File> files = new ArrayList<File>();

for(NzbSegment s : segments) {
    String str = s.getMessageID();
    br = (BufferedReader) client.retrieveArticleBody("<" + str + ">");
    String filePath = fileName + "-" + s.getSegmentNumber() +"body.yenc";
    File f = new File(filePath);
    f.delete(); //Make sure we have a new clean file
    f = new File(filePath);


    int bytes = 0;
    while ((line = br.readLine()) != null) {
        FileUtils.writeStringToFile(f,line + "\n",true);
        bytes += line.getBytes().length;
    }
    System.out.println("size : " + s.getBytes() + " compare to : " + bytes);
    br.close();
    files.add(f);
}

with a POJO NzbSegment :

public class NzbSegment {

private int bytes;
private int segmentNumber;
private String messageID;}

Do you know where am I mistaken ?

Airy
  • 748
  • 2
  • 10
  • 27

0 Answers0