Package rabbit.http

Examples of rabbit.http.ContentRangeParser


    public PartialCacher (Logger logger, String fileName, HttpHeader response)
  throws IOException {
  //Content-Range: 0-4/25\r\n
  String cr = response.getHeader ("Content-Range");
  if (cr != null)
      crp = new ContentRangeParser (cr, logger);
  if (!crp.isValid ())
      throw new IllegalArgumentException ("bad range: " + cr);
  RandomAccessFile raf = new RandomAccessFile (fileName, "rw");
  FileChannel fc = raf.getChannel ();
  fc.position (crp.getStart ());
View Full Code Here


      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 ()) {
        if (crp.getStart () > start || crp.getEnd () < end)
      return false;
    }
      }
  }
  return true;
View Full Code Here

      if (cl != null) {
    long size = Long.parseLong (cl);
    cr = "bytes 0-" + (size - 1) + "/" + size;
      }
  }
  ContentRangeParser crp = new ContentRangeParser (cr, getLogger ());
  if (crp.isValid ()) {
      long start = crp.getStart ();
      long end = crp.getEnd ();
      long total = crp.getTotal ();
      String t = total < 0 ? "*" : Long.toString (total);
      if (end == pc.getStart () - 1) {
    oldRequest.setHeader ("Range",
              "bytes=" + start + "-" + end);
    oldResponse.setHeader ("Content-Range",
View Full Code Here

TOP

Related Classes of rabbit.http.ContentRangeParser

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.