Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSData


      if (jdbcInfoStream == null) {
        throw new IllegalStateException("Unable to find 'JDBCInfo.plist' in this plugin jar.");
      }

      try {
        jdbcInfo = (NSDictionary) NSPropertyListSerialization.propertyListFromData(new NSData(jdbcInfoStream, 2048), "US-ASCII");
      }
      catch (IOException e) {
        throw new RuntimeException("Failed to load 'JDBCInfo.plist' from this plugin jar: " + e, e);
      } finally {
        try { jdbcInfoStream.close(); } catch (IOException e) {}
View Full Code Here


      if (hasBinding("filePath")) {
        setValueForBinding(progress.fileName(), "filePath");
      }

      if (hasBinding("data")) {
        NSData data = new NSData(progress.tempFile().toURI().toURL());
        setValueForBinding(data, "data");
      }
     
      if (hasBinding("mimeType")) {
        String contentType = progress.contentType();
View Full Code Here

        if (value != null) {
          config.setObjectForKey(value, entry.getKey());
        }
      }
    String xml2fopxsl = stringValueForBinding("xml2fopXsl", component);
    NSData data = null;

    try {
      data = ERPDFUtilities.xml2Fop2Pdf(response.contentString(), xml2fopxsl, config);
      data = appendPDFs(data, context);
    } catch (Throwable e) {
View Full Code Here

         Object value = association.valueInComponent(component);
         if(value != null) {
           String stringValue;
           if("background-image".equals(key)) {
             if (value instanceof NSData) {
               NSData data = (NSData) value;
               WOResourceManager rm = WOApplication.application().resourceManager();
               String mimeType = (String) (_mimeType != null ? _mimeType.valueInComponent(component) : "image/jpeg");
               WOURLValuedElementData uve = new WOURLValuedElementData(data, mimeType, null);
               rm._cacheData(uve);
               stringValue = uve.dataURL(wocontext);
View Full Code Here

    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    try {
      ObjectOutputStream oos = new ObjectOutputStream(bout);
      oos.writeObject(d);
      oos.close();
      NSData sp = new NSData(bout.toByteArray());
      return sp;
    }
    catch (IOException e) {
      // shouldn't ever happen, as we only write to memory
      throw NSForwardException._runtimeExceptionForThrowable(e);
View Full Code Here

      return null;
    }
  }

  public static NSData gzipNSDataAsNSData(NSData data) {
    NSData gzippedData = null;
    if (data != null) {
      gzippedData = ERXCompressionUtilities.gzipByteArrayAsNSData(data._bytesNoCopy(), 0, data.length());
    }
    return gzippedData;
  }
View Full Code Here

      if (java_class == null) {
        throw new UnmarshallException("no type hint");
      }

      String string = jso.getString("bytes");
      NSData data = (NSData) NSPropertyListSerialization.propertyListFromString(string);
      if (NSData.class.isAssignableFrom(clazz)) {
        return ObjectMatch.OKAY;
      }
      throw new UnmarshallException("invalid class " + clazz);
    }
View Full Code Here

      if (java_class == null) {
        throw new UnmarshallException("no type hint");
      }

      String string = jso.getString("bytes");
      NSData data = (NSData) NSPropertyListSerialization.propertyListFromString(string);
      if (NSMutableData.class.equals(clazz)) {
        NSMutableData mutableData = new NSMutableData(data);
        state.setSerialized(o, mutableData);
        return mutableData;
      }
View Full Code Here

    // the page first renders
    displayGroup().setNumberOfObjectsPerBatch(Integer.parseInt((String) configData().valueForKey("batchSize")));
  }

  private NSMutableArray sampleData() {
    NSData data = new NSData(application().resourceManager().bytesForResourceNamed("AjaxGridExampleTestData.plist", null, NSArray.EmptyArray));
    NSMutableArray sampleData = new NSMutableArray((NSArray) NSPropertyListSerialization.propertyListFromData(data, CharEncoding.UTF_8));
    Random random = new Random(new NSTimestamp().getNanos());
    for (int i = 0; i < sampleData.count(); i++) {
      NSMutableDictionary<String,Object> row = (NSMutableDictionary<String,Object>) sampleData.objectAtIndex(i);
      row.setObjectForKey(Integer.valueOf(random.nextInt()), "number");
View Full Code Here

  }

  public NSMutableDictionary configData() {
    if (configData == null) {
      NSData data = new NSData(application().resourceManager().bytesForResourceNamed("AjaxGridExampleConfiguration.plist", null, NSArray.EmptyArray));
      configData = new NSMutableDictionary((NSDictionary) NSPropertyListSerialization.propertyListFromData(data, CharEncoding.UTF_8));
    }

    return configData;
  }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSData

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.