Package com.jbidwatcher.util

Examples of com.jbidwatcher.util.ByteBuffer


    String thumbnail = ai.getThumbnailURL();
    //  eBay has started including a 64x64 image instead of the 96x96 ones they used to have,
    //  but it's named '*6464.jpg' instead of '*.jpg'.
    if(thumbnail == null) thumbnail = ai.getAlternateSiteThumbnail();

    ByteBuffer thumbnailImage = getThumbnailByURL(thumbnail);

    //  If we retrieved 'something', but it was 0 bytes long, it's not a thumbnail.
    if(thumbnailImage != null && thumbnailImage.getLength() == 0) thumbnailImage = null;

    String imgPath = Thumbnail.getValidImagePath(ai.getIdentifier(), thumbnailImage);

    ai.setThumbnail(imgPath);
    MQFactory.getConcrete("redraw").enqueue(ai.getIdentifier());
View Full Code Here


    ai.setThumbnail(imgPath);
    MQFactory.getConcrete("redraw").enqueue(ai.getIdentifier());
  }

  private ByteBuffer getThumbnailByURL(String url) {
    ByteBuffer tmpThumb;
    try {
      tmpThumb = downloadThumbnail(JConfig.getURL(url));
    } catch (Exception ignored) {
      tmpThumb = null;
    }
View Full Code Here

    }
    return tmpThumb;
  }

  public static ByteBuffer downloadThumbnail(URL img) {
    ByteBuffer tmpThumb = Http.net().getURL(img);
    //  There's a specific image which is just 'click here to
    //  view item'.  Boring, and misleading.
    if(tmpThumb.getCRC() == 0xAEF9E727 ||
       tmpThumb.getCRC() == 0x3D7BF54E ||
       tmpThumb.getCRC() == 0x076AE9FB ||
       tmpThumb.getCRC() == 0x0E1AE309 ||
       tmpThumb.getCRC() == Long.parseLong(JConfig.queryConfiguration("thumbnail.crc", "0"), 16) ||
       tmpThumb.getCRC() == 0x5DAB591F) {
      tmpThumb = null;
    }
    return tmpThumb;
  }
View Full Code Here

   * @param inCookie - Any cookie needed to be passed along.
   *
   * @return - A result with raw data and the length.
   */
  private ByteBuffer getURL(URL url, String inCookie) {
    ByteBuffer rval;

    try {
      URLConnection uc = makeRequest(url, inCookie);
      rval = receiveData(uc);
    } catch(FileNotFoundException fnfe) {
View Full Code Here

        JConfig.log().logDebug("Got a bad end of compressed input stream.");
        count = -1;
      }
    }
    is.close();
    return new ByteBuffer(mainBuf, offset);
  }
View Full Code Here

      HttpURLConnection huc = (HttpURLConnection)getPage(url);
      InputStream is = getStream(huc);
      if("gzip".equals(huc.getContentEncoding())) {
        is = new GZIPInputStream(is);
      }
      ByteBuffer results = receiveStream(is);
      StringBuffer sb = convertByteBufferToStringBuffer(huc, results);
      if((huc.getResponseCode() / 100) > 3) {
        JConfig.log().logMessage("Failed to get " + url + ": " + sb);
        return null;
      }
View Full Code Here

    }
  }

  public StringBuffer receivePage(URLConnection uc) throws IOException {
    if(uc == null) return null;
    ByteBuffer buff = receiveData(uc);

    return convertByteBufferToStringBuffer(uc, buff);
  }
View Full Code Here

TOP

Related Classes of com.jbidwatcher.util.ByteBuffer

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.