Examples of NSData


Examples of com.webobjects.foundation.NSData

    // 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

Examples of com.webobjects.foundation.NSData

  }

  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

Examples of com.webobjects.foundation.NSData

    int nextSequence = store.nextSequence();
    Object pkValue;
    String className = pkAttribute.className();
    String valueType = pkAttribute.valueType();
    if ("NSData".equals(className)) {
      pkValue = new NSData(String.valueOf(nextSequence).getBytes());
    }
    else {
      if (valueType == null || "i".equals(valueType)) {
        pkValue = Integer.valueOf(nextSequence);
      }
View Full Code Here

Examples of com.webobjects.foundation.NSData

            File f = null;
            try {
                f = File.createTempFile("GVTemp", "dot");
                ERXFileUtilities.stringToFile(dot, f);
                Result result = ERXRuntimeUtilities.execute(new String[] { "/usr/local/bin/dot", "-T" + format, "", f.getAbsolutePath() }, null, null, 0);
                response.setContent(new NSData(result.getResponse()));
                if (format.equals("svg")) {
                    response.setHeader("image/svg+xml", "content-type");
                } else if (format.equals("pdf")) {
                    response.setHeader("application/pdf", "content-type");
                } else {
View Full Code Here

Examples of com.webobjects.foundation.NSData

   
   
   
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    ERPDFMerge.concatPDFs(pdfsToCombine, output, false);
    data = new NSData(output.toByteArray());
   
   
    response.setHeader("inline; filename=\"" + filename + "\"", "content-disposition");
    response.setHeader("application/pdf", "Content-Type");
    response.setHeader(String.valueOf(data.length()), "Content-Length");
View Full Code Here

Examples of com.webobjects.foundation.NSData

          String columnName = attr.attribute().columnName();
          Field field = doc.getField(columnName);
          Object value = null;
          if (field != null) {
            if (field.isBinary()) {
              value = new NSData(field.getBinaryValue());
            } else {
              String stringValue = field.stringValue();
              value = attr.asEOFValue(stringValue);
            }
            dict.setObjectForKey(value, name);
View Full Code Here

Examples of com.webobjects.foundation.NSData

    }

    public WOResponse[] sendRequest(NSDictionary monitorRequest, NSArray wotaskdArray, boolean willChange) {
        String encodedRootObjectForKey = (new _JavaMonitorCoder()).encodeRootObjectForKey(monitorRequest,
                "monitorRequest");
        NSData content = new NSData(encodedRootObjectForKey.getBytes());
        return MHost.sendRequestToWotaskdArray(content, wotaskdArray, willChange);
    }
View Full Code Here

Examples of com.webobjects.foundation.NSData

  public RemoteBrowseClient(WOContext aWocontext) {
    super(aWocontext);
  }

  static public NSDictionary _getFileListOutOfResponse(WOResponse aResponse, String thePath) throws MonitorException {
    NSData responseContent = aResponse.content();
    NSArray anArray = NSArray.EmptyArray;
    if (responseContent != null) {
      byte[] responseContentBytes = responseContent.bytes();
      String responseContentString = new String(responseContentBytes);

      if (responseContentString.startsWith("ERROR")) {
        throw new MonitorException("Path " + thePath + " does not exist");
      }

      _JavaMonitorDecoder aDecoder = new _JavaMonitorDecoder();
      try {
        byte[] evilHackCombined = new byte[responseContentBytes.length + evilHack.length];
        // System.arraycopy(src, src_pos, dst, dst_pos, length);
        System.arraycopy(evilHack, 0, evilHackCombined, 0, evilHack.length);
        System.arraycopy(responseContentBytes, 0, evilHackCombined, evilHack.length,
            responseContentBytes.length);
        anArray = (NSArray) aDecoder.decodeRootObject(new NSData(evilHackCombined));
      } catch (WOXMLException wxe) {
        NSLog.err.appendln("RemoteBrowseClient _getFileListOutOfResponse Error decoding response: "
            + responseContentString);
        throw new MonitorException("Host returned bad response for path " + thePath);
      }
View Full Code Here

Examples of com.webobjects.foundation.NSData

          }
          case DATA: {
            XMLNode lastNode = _stack.peek();
            if (aType.equals(lastNode.type())) {
              if (lastNode.value() == null) {
                lastNode.setValue(new NSData());
                lastNode.setTagOpen(false);
              }
            } else {
              throw new SAXException("Ending <" + qName + "> tag does not match starting <" + lastNode.type() + "> tag.");
            }
View Full Code Here

Examples of com.webobjects.foundation.NSData

                    stringbuffer.append(_curChars.charAt(i));

                byte abyte0[] = stringbuffer.toString().getBytes(CharEncoding.US_ASCII);
                byte abyte64[] = _NSBase64.decode(abyte0);
                if (abyte64 != null && abyte64.length > 0) {
                  lastNode.setValue(new NSData(abyte64));
                } else {
                  lastNode.setValue(new NSData()); // assume empty data
                }
                lastNode.setTagOpen(false);
              } catch (UnsupportedEncodingException unsupportedencodingexception) {
                throw new SAXException(unsupportedencodingexception.getMessage());
              }
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.