Results 1 to 3 of 3

Thread: Byte Ranges

  1. #1
    alessandro_ is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default Byte Ranges

    Hi

    with this code, I can read some bytes in a position of the remote file.

    Java Code:
    HttpURLConnection connection = (HttpURLConnection) new URL( "http://abc.it/file.txt").openConnection();
    
    connection.setRequestProperty( "Range", "bytes=1000-1049" );
    		    
    BufferedReader source = new BufferedReader( new InputStreamReader( connection.getInputStream()) );
    
    System.out.println( source.readLine() );
    My problem is that i wanna read more ranges of bytes,
    How can I do?

  2. #2
    senorbum is offline Member
    Join Date
    Aug 2009
    Posts
    76
    Rep Power
    0

    Default

    What do you mean?

    If

    connection.setRequestProperty( "Range", "bytes=1000-1049" );

    works as you say, then why not just change the 2nd parameter to the desired range??? I'm so confused.

  3. #3
    alessandro_ is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default

    problem solved,

    my problem was that if i write something like

    connection.setRequestProperty( "Range", "bytes=1000-1049,3000-3800" );

    the bytes that i read are multipart/byteranges

Similar Threads

  1. TCP send byte
    By Koren3 in forum Networking
    Replies: 4
    Last Post: 05-25-2009, 08:08 AM
  2. Printing ranges of numbers using if/else statements
    By russbuss106 in forum New To Java
    Replies: 8
    Last Post: 03-05-2009, 06:03 AM
  3. Byte Array
    By sandor in forum New To Java
    Replies: 12
    Last Post: 01-15-2009, 04:31 AM
  4. using Byte arrays
    By mew in forum New To Java
    Replies: 2
    Last Post: 01-30-2008, 04:54 AM
  5. int to byte
    By ravian in forum New To Java
    Replies: 1
    Last Post: 01-13-2008, 08:22 PM

Posting Permissions

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