Package rabbit.io

Examples of rabbit.io.Range


      rh.webHeader.removeHeader ("Content-Length");
      String CT =
    "multipart/byteranges; boundary=THIS_STRING_SEPARATES";
      rh.webHeader.setHeader ("Content-Type", CT);
  } else {
      Range r = ranges.get (0);
      rh.webHeader.setHeader ("Content-Range",
            "bytes " + r.getStart () + "-" +
            r.getEnd () + "/" + totalSize);
      rh.size = (r.getEnd () - r.getStart () + 1);
      rh.webHeader.setHeader ("Content-Length", "" + rh.size);
  }   
    }
View Full Code Here


    if (j == -1)
        return null;
    rs = rs.substring (j + 1);
    String[] st = rs.split (",");
    for (String r : st) {
        Range range = parseRange (r);
        if (range == null)
      return null;
        ret.add (range);
    }
      }
View Full Code Here

    throw new IllegalArgumentException (SBTZ);
      if (start > end// ignore this...
    return null;
      if (start < 0 || end < 0)
    throw new IllegalArgumentException (SAELTZ);
      return new Range (start, end);
  } else if (e.length () > 0) {
      // no start so this many bytes from the end...
      start = Integer.parseInt (e);
      if (start < 0)
    throw new IllegalArgumentException (SLTZ);
      start = size - start;
      end = size;
      return new Range (start, end);
  } else {
      // "-"
      throw new NumberFormatException (FR);
  }
    }
View Full Code Here

  if (cr == null)   // TODO check if its ok to return true here..
      // if we do not have a content range we ought to have full resource.
      return false;
 
  for (int i = 0; i < ranges.size (); i++) {
      Range r = ranges.get (i);
      long start = r.getStart ();
      long end = r.getEnd ();
      String t = "bytes " + start + "-" + end + "/" + totalSize;
      if (!t.equals (cr)) {
    ContentRangeParser crp =
        new ContentRangeParser (cr, getLogger ());
    if (crp.isValid ()) {
View Full Code Here

    }

    private boolean getNextSingleBufferBlock () throws IOException {
  if (currentRange > 0)
      return false;
  Range r = ranges.get (currentRange);
  updateBufferAndPosition (r);
  return true;
    }
View Full Code Here

      currentRange++;
      return true;
  }
 
  int r1 = currentRange;
  Range r = ranges.get (currentRange);
  if (state == State.SEND_HEADER) {
      buffer.clear ();
      writeHeader ();
      startBlock = true;
      state = State.SEND_DATA;
View Full Code Here

    /** Write the current MultipartHeader to the buffer.
     */
    private void writeHeader () {
  MultipartHeader h =
      new MultipartHeader (Header.CRLF + "--" + separator);
  Range r = ranges.get (currentRange);
  if (contentType != null)
      h.setHeader ("Content-Type", contentType);
  h.setHeader ("Content-Range", "bytes " + r.getStart () + "-" +
         r.getEnd () + "/" + totalSize);
  buffer.put (h.toString ().getBytes ());
    }
View Full Code Here

TOP

Related Classes of rabbit.io.Range

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.