public static void main( String[] argv ) {

	try {

	    System.out.println( "Creating file and content range ..." );
	    java.io.File file = new java.io.File( "document_root/README.txt" );
	    ContentRange range = new ContentRange( ContentRange.NAME_BYTESUNIT_BYTES,
						   7L,   // skip the first 8 bytes ... (begin at index 7)
						   15L,  // ... and read up to 8 bytes from the resource (end at index 15).
						   -1    // unknown resource size
						   );
					     
	    System.out.println( "Creating RangedResource ...." );
	    Resource resource = new RangedResource( new FileResource( null,   // no handler available here
								      null,   // and also no logger
								      file,   // the input file
								      false   // no need to use fair locks here
								      ),
						    range,
						    null,     // no handler, too
						    null      // and no logger, too.
						    );

	    // Try to read the 16 bytes from the resource
	    System.out.println( "Opening resource ..." );
	    resource.open( true ); // open in read-only mode
	    

	    System.out.println( "Try to read the " + range.calculateLength() + " bytes from the resource ... ");
	    byte[] buffer = new byte[ 8 ];
	    int len;
	    int readLength = 0;
	    while( (len = resource.getInputStream().read(buffer,0,buffer.length)) != -1 ) {

		System.out.println( "\nread " + len + " more byte(s)" );

		for( int i = 0; i < len; i++ )
		    System.out.print( (char)buffer[i] );

		readLength += len;
	    }
	    System.out.println( "" );
	    System.out.println( "" + readLength + " byte(s) read." );
	    

	    System.out.println( "Closing resource ... ");
	    resource.close();


	} catch( Exception e ) {

	    e.printStackTrace();

	}

    }