Package com.webobjects.foundation

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


            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

   
   
   
    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

          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

    }

    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

  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

          }
          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

                    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

    @Override
    public void init(EOEditingContext ec) {
        super.init(ec);
        ERIFileContent content = ERIFileContent.clazz.createAndInsertObject(ec);
        setContent(content);
        setContentData(new NSData());
    }
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

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.