Examples of handleData()


Examples of org.mozilla.universalchardet.UniversalDetector.handleData()

        UniversalDetector detector = new UniversalDetector(null);

        // (2)
        int nread;
        while ((nread = fis.read(buf)) > 0 && !detector.isDone()) {
            detector.handleData(buf, 0, nread);
        }
        // (3)
        detector.dataEnd();

        // (4)
View Full Code Here

Examples of org.mozilla.universalchardet.UniversalDetector.handleData()

   * Detect encoding by analyzing characters in the array
   */
  public static String detectEncoding(byte[] bytes) {
    String DEFAULT_ENCODING = "UTF-8";
    UniversalDetector detector = new UniversalDetector(null);
    detector.handleData(bytes, 0, bytes.length);
    detector.dataEnd();
    String encoding = detector.getDetectedCharset();
    detector.reset();
    if (encoding == null) {
      encoding = DEFAULT_ENCODING;
View Full Code Here

Examples of org.mozilla.universalchardet.UniversalDetector.handleData()

      UniversalDetector detector = new UniversalDetector(null);
      ReadableByteChannel bc = Channels.newChannel(stream);
      ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
      int read = 0;
      while ((read = bc.read(buffer)) != -1) {
        detector.handleData(buffer.array(), buffer.position() - read, read);
        buffer = resizeBuffer(buffer);
      }
      detector.dataEnd();
      // copy the result back to a byte array
      String encoding = detector.getDetectedCharset();
View Full Code Here

Examples of org.mozilla.universalchardet.UniversalDetector.handleData()

    BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
    final UniversalDetector universalDetector = new UniversalDetector(null);

    int numberOfBytesRead;
    while ((numberOfBytesRead = bufferedInputStream.read(buf)) > 0 && !universalDetector.isDone()) {
      universalDetector.handleData(buf, 0, numberOfBytesRead);
    }

    universalDetector.dataEnd();
    bufferedInputStream.close();
    String encoding = universalDetector.getDetectedCharset();
View Full Code Here

Examples of org.mozilla.universalchardet.UniversalDetector.handleData()

    // (2)
    resource.mark(MAX_CHARSET_READAHEAD);
    int len = resource.read(bbuffer, 0, MAX_CHARSET_READAHEAD);
    resource.reset();
    detector.handleData(bbuffer, 0, len);
    // (3)
    detector.dataEnd();
    // (4)
    charsetName = detector.getDetectedCharset();
View Full Code Here

Examples of rdpclient.rdp.ServerBitmapUpdate.handleData()

                verbose = true;
            }
        };
        pipeline.addAndLink(bitmap, adapter);

        bitmap.handleData(packet, null);

    }

}
View Full Code Here

Examples of streamer.Element.handleData()

        // BufferedImageCanvas canvas = new BufferedImageCanvas(1024, 768);
        // Element adapter = new AwtRdpAdapter("test",canvas );
        // pipeline.addAndLink(bitmap, adapter);
        pipeline.addAndLink(bitmap, fakeSink);

        bitmap.handleData(packet, null);

    }

}
View Full Code Here

Examples of streamer.Element.handleData()

        buf.putMetadata(TARGET_Y, 0);
        buf.putMetadata(WIDTH, 4);
        buf.putMetadata(HEIGHT, 4);
        buf.putMetadata(PIXEL_FORMAT, RGB888LE32);

        renderer.handleData(buf, null);

        String actualData = Arrays.toString(((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData());
        String expectedData = Arrays.toString(pixelsLE);
        if (!actualData.equals(expectedData))
            System.err.println("Actual image:   " + actualData + "\nExpected image: " + expectedData + ".");
View Full Code Here

Examples of streamer.Element.handleData()

        buf.putMetadata(WIDTH, 2);
        buf.putMetadata(HEIGHT, 2);
        buf.putMetadata(SRC_X, 2);
        buf.putMetadata(SRC_Y, 2);

        renderer.handleData(buf, null);

        data = ((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData();
        String actualData = Arrays.toString(data);
        String expectedData = Arrays.toString(pixelsAfterCopy);
        if (!actualData.equals(expectedData))
View Full Code Here

Examples of streamer.Element.handleData()

        buf.putMetadata(TARGET_Y, 0);
        buf.putMetadata(WIDTH, 4);
        buf.putMetadata(HEIGHT, 4);
        buf.putMetadata(PIXEL_FORMAT, RGB888LE32);

        renderer.handleData(buf, null);

        String actualData = Arrays.toString(((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData());
        String expectedData = Arrays.toString(pixelsLE);
        if (!actualData.equals(expectedData))
            System.err.println("Actual image:   " + actualData + "\nExpected image: " + expectedData + ".");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.