Package com.xuggle.xuggler.io

Examples of com.xuggle.xuggler.io.IURLProtocolHandler


    retval = handler.open(copyFile, IURLProtocolHandler.URL_WRONLY_MODE);
    assertTrue(retval >= 0);

    // Now, create and open a read handler.
    // note that without a protocol string, should default to file:
    IURLProtocolHandler reader = new FileProtocolHandler(sampleFile);
    retval = reader.open(null, IURLProtocolHandler.URL_RDONLY_MODE);

    long bytesWritten = 0;
    long totalBytes = reader.seek(0, IURLProtocolHandler.SEEK_SIZE);

    byte[] buffer = new byte[1024];
    while ((retval = reader.read(buffer, buffer.length)) > 0)
    {
      // Write the output.
      retval = handler.write(buffer, retval);
      assertTrue(retval >= 0);
      bytesWritten += retval;
    }
    assertTrue(bytesWritten == totalBytes);

    // close each file
    retval = reader.close();
    assertTrue(retval >= 0);

    retval = handler.close();
    assertTrue(retval >= 0);
View Full Code Here


    assertTrue("url_close failed: " + retval, retval >= 0);
  }

  private static long getFileSize(String filename)
  {
    IURLProtocolHandler handler = new FileProtocolHandler();

    int retval = 0;
    retval = handler.open(filename, IURLProtocolHandler.URL_RDONLY_MODE);
    assertTrue(retval >= 0);

    long totalBytes = handler.seek(0, IURLProtocolHandler.SEEK_SIZE);
    assertTrue(totalBytes >= 0);

    // and close
    retval = handler.close();
    assertTrue(retval >= 0);
    return totalBytes;
  }
View Full Code Here

  @Test
  public void testInteruptStatusPreservedAccrossJNICalls()
  {
    IContainer container = IContainer.make();
   
    IURLProtocolHandler handler = new IURLProtocolHandler(){
      public int close()
      {
        return 0;
      }
View Full Code Here

   *
   * @returns A protocol handler to use.
   */
  public IURLProtocolHandler getHandler(String url, int flags)
  {
    IURLProtocolHandler result = null;

    log.trace("looking for protocol handler for: {}", url);
    if (url == null || url.length() == 0)
      throw new IllegalArgumentException("expected valid URL");
    int colonIndex = url.indexOf(":");
View Full Code Here

    retval = handler.open(copyFile, IURLProtocolHandler.URL_WRONLY_MODE);
    assertTrue(retval >= 0);

    // Now, create and open a read handler.
    // note that without a protocol string, should default to file:
    IURLProtocolHandler reader = new FileProtocolHandler(sampleFile);
    retval = reader.open(null, IURLProtocolHandler.URL_RDONLY_MODE);

    long bytesWritten = 0;
    long totalBytes = reader.seek(0, IURLProtocolHandler.SEEK_SIZE);

    byte[] buffer = new byte[1024];
    while ((retval = reader.read(buffer, buffer.length)) > 0)
    {
      // Write the output.
      retval = handler.write(buffer, retval);
      assertTrue(retval >= 0);
      bytesWritten += retval;
    }
    assertTrue(bytesWritten == totalBytes);

    // close each file
    retval = reader.close();
    assertTrue(retval >= 0);

    retval = handler.close();
    assertTrue(retval >= 0);
View Full Code Here

    assertTrue("url_close failed: " + retval, retval >= 0);
  }

  private static long getFileSize(String filename)
  {
    IURLProtocolHandler handler = new FileProtocolHandler();

    int retval = 0;
    retval = handler.open(filename, IURLProtocolHandler.URL_RDONLY_MODE);
    assertTrue(retval >= 0);

    long totalBytes = handler.seek(0, IURLProtocolHandler.SEEK_SIZE);
    assertTrue(totalBytes >= 0);

    // and close
    retval = handler.close();
    assertTrue(retval >= 0);
    return totalBytes;
  }
View Full Code Here

TOP

Related Classes of com.xuggle.xuggler.io.IURLProtocolHandler

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.