当前位置: 首页>>代码示例>>Java>>正文


Java NSData.read方法代码示例

本文整理汇总了Java中org.robovm.apple.foundation.NSData.read方法的典型用法代码示例。如果您正苦于以下问题:Java NSData.read方法的具体用法?Java NSData.read怎么用?Java NSData.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robovm.apple.foundation.NSData的用法示例。


在下文中一共展示了NSData.read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setContentOfCell

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
public static UITableViewCell setContentOfCell(String name, NSURL url, String adresse, String email) {
	UITableViewCell cell = new UITableViewCell(new CGRect(0, 0, 300, 60));
	UIImageView img = new UIImageView(new CGRect(20, 10, 70, 70));
	NSData data = (NSData)NSData.read(url);
	img.setImage(new UIImage(data));		
	cell.getContentView().addSubview(img);
	
	UILabel label1 = new UILabel(new CGRect(100, 10, cell.getContentView().getFrame().getWidth(), 20));
	label1.setText(name);
	label1.setTextColor(UIColor.colorBrown());
	cell.getContentView().addSubview(label1);
	
	UILabel label2 = new UILabel(new CGRect(100, 35, cell.getContentView().getFrame().getWidth(), 20));
	label2.setText(adresse);
	cell.getContentView().addSubview(label2);
	
	UILabel label3 = new UILabel(new CGRect(100, 55, cell.getContentView().getFrame().getWidth(), 20));
	label3.setText(email);
	cell.getContentView().addSubview(label3);
	return cell;
}
 
开发者ID:Kourtessia,项目名称:RoboVM-for-iOS,代码行数:22,代码来源:AddressbookUtils.java

示例2: displayMailComposerSheet

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
/**
 * Displays an email composition interface inside the application. Populates
 * all the Mail fields.
 */
private void displayMailComposerSheet() {
    MFMailComposeViewController picker = new MFMailComposeViewController();
    picker.setMailComposeDelegate(this);
    picker.setSubject("Hello from California!");

    // Set up recipients
    picker.setToRecipients(Arrays.asList("[email protected]"));
    picker.setCcRecipients(Arrays.asList("[email protected]", "[email protected]"));
    picker.setBccRecipients(Arrays.asList("[email protected]"));

    // Attach an image to the email
    String path = NSBundle.getMainBundle().findResourcePath("rainy", "jpg");
    NSData myData = NSData.read(new File(path));
    picker.addAttachmentData(myData, "image/jpeg", "rainy");

    // Fill out the email body text
    String emailBody = "It is raining in sunny California!";
    picker.setMessageBody(emailBody, false);

    presentViewController(picker, true, null);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:26,代码来源:MessageComposerViewController.java

示例3: load

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
public static void load(File path, int bufferId) {
  NSData data = null;
  try {
    // mmap (if possible) the audio file for efficient reading/uploading
    data = NSData.read(path, RoboAssets.READ_OPTS);
    load(data.asByteBuffer(), path.getName(), bufferId);
  } catch (NSErrorException e) {
    throw new RuntimeException(e.toString());
  } finally {
    // now dispose the mmap'd file to free up resources
    if (data != null) {
      data.dispose();
    }
  }
}
 
开发者ID:playn,项目名称:playn,代码行数:16,代码来源:CAFLoader.java

示例4: getXML

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
public Document getXML(NSURL url) throws IOException {
    Document document = null;

    NSData nsData = (NSData) cache.get(url.getAbsoluteString());

    try {
        if(nsData == null) { // trying to fetch (does not exist in cache)
            nsData = NSData.read(url);

            if(nsData == null) {
                if(url.isFileURL())
                    throw new FileNotFoundException(url.getAbsoluteString());
            } else {
                cache.put(url.getAbsoluteString(), nsData);
            }
        }

        if(nsData != null) {
            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();

            byte[] bytes = nsData.getBytes();
            if(bytes != null) {
                ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);

                DocumentBuilder db = dfactory.newDocumentBuilder();
                InputSource inputSource = new InputSource(inputStream);
                document = db.parse(inputSource);
            }
        }
    } catch (SAXException | ParserConfigurationException e) {
        e.printStackTrace();
    }

    return document;
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:36,代码来源:XMLCache.java

示例5: getXML

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
public static Document getXML(NSURL url) throws IOException {
    Document document = null;
    NSData nsData = NSData.read(url);

    if(nsData == null) {
        if(url.isFileURL())
            throw new FileNotFoundException(url.getAbsoluteString());
    }

    if(nsData != null) {
        document = getXML(nsData);
    }
    return document;
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:15,代码来源:XMLUtil.java

示例6: setContentOfCell

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
public void setContentOfCell(UITableViewCell cell, String txt, NSURL url) {
	UIImageView img = new UIImageView(new CGRect(25, 5, 80, 80));
   	NSData data = (NSData) NSData.read(url);
	img.setImage(new UIImage(data));
	cell.getContentView().addSubview(img);

	UILabel label = new UILabel(new CGRect(120, 30, cell.getContentView()
			.getFrame().getWidth(), 20));
	label.setText(txt);
	cell.getContentView().addSubview(label);
}
 
开发者ID:Kourtessia,项目名称:RoboVM-for-iOS,代码行数:12,代码来源:GenderListTableViewController.java

示例7: getImageData

import org.robovm.apple.foundation.NSData; //导入方法依赖的package包/类
private static NSArray<?> getImageData() {
    if (imageData == null) {
        String path = NSBundle.getMainBundle().findResourcePath("ImageData", "plist");
        NSData plistData = NSData.read(new File(path));
        try {
            imageData = (NSArray<?>) NSPropertyListSerialization.getPropertyListFromData(plistData,
                    NSPropertyListMutabilityOptions.None);
        } catch (NSErrorException e) {
            System.err.println("Unable to read image data: " + e.getError());
        }
    }
    return imageData;
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:14,代码来源:ImageScrollView.java


注:本文中的org.robovm.apple.foundation.NSData.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。