Package org.rococoa.cocoa.foundation

Examples of org.rococoa.cocoa.foundation.NSError.code()


        File file = new File("NOSUCH");
        ObjCObjectByReference errorReference = new ObjCObjectByReference();
    QTMovie movie = QTMovie.movieWithFile_error(file, errorReference);
        assertNull(movie);
        NSError error = errorReference.getValueAs(NSError.class);
    assertEquals(-2000, error.code().intValue());
    }

  @Test public void testAttributeForKey() throws Exception {
        QTMovie movie = loadMovie(testMovieFile);
        NSObject attribute = movie.attributeForKey(QTMovie.QTMovieTimeScaleAttribute);
View Full Code Here


    public NSObject getProperty(SpeechProperty property) throws IllegalArgumentException {
         ObjCObjectByReference errorPtr = new ObjCObjectByReference();
         NSObject result = objectForProperty_error(property.getNativeValue(), errorPtr);
         NSError error = errorPtr.getValueAs(NSError.class);
         //objectForProperty:error isn't well documented, so be very conservative
         if ( result != null && !result.id().isNull() && (error == null || error.id().isNull() || error.code().intValue() == 0) ) {
             return result;
         } else {
             throw new IllegalArgumentException("Could not get property: " + property + ", error: " + error.localizedDescription());
         }
    }
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.