Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSData


      //AK: making a lot of assumptions here... the value is a <hex data>, the result is a valid NSData
      this((NSData)NSPropertyListSerialization.propertyListFromString(value.toString()),name);
    }
   
    public ByteConstant(byte value[], String name) {
      this(new NSData(value),name);
    }
View Full Code Here


         * if either class or value isn't found.
         * @param value
         * @param clazzName
         */
        public static ByteConstant constantForClassNamed(byte value[], String clazzName) {
            return (ByteConstant) ERXConstant.constantForClassNamed(new NSData(value), clazzName);
        }
View Full Code Here

        String contentString = newResponse.contentString();
        log.debug("Converting content string:\n" + contentString);
      }

      try {
        NSData data = transform(transformer(), newResponse.content());
        if(hasBinding("data") && canSetValueForBinding("data")) {
          setValueForBinding(data, "data");
        }
        if(hasBinding("stream") && canSetValueForBinding("stream")) {
          setValueForBinding(data.stream(), "stream");
        }
        response.appendContentData(data);
      } catch (TransformerException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      }
View Full Code Here

    saxSource.setXMLReader(xmlReader);
    saxSource.setInputSource(new InputSource(bis));
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    Result r = new StreamResult(os);
    transformer.transform(saxSource, r);
    NSData result = new NSData(os.toByteArray());
    return result;
  }
View Full Code Here

    @Override
    public boolean synchronizesVariablesWithBindings() { return false; }

    public String string() {
        if (_string==null) {
            NSData d=(NSData)valueForBinding("data");
            if (d!=null) _string=new String(d.bytes(0,d.length()));
        }
        return _string;
    }
View Full Code Here

         */
        public static XMLData dataForString(String string, String mappingUrl) {
            WOXMLDecoder decoder = WOXMLDecoder.decoderWithMapping(mappingUrl);
            XMLData data;
            try {
              data = (XMLData) decoder.decodeRootObject(new NSData(string.getBytes(CharEncoding.UTF_8)));
            } catch (UnsupportedEncodingException e) {
                throw NSForwardException._runtimeExceptionForThrowable(e);
            }
            data.completeDecoding();
            return data;
View Full Code Here

      int last = 0;
      for (Map.Entry<String, Integer> entry : marks.entrySet()) {
        String key = entry.getKey();
        Integer offset = entry.getValue();
        NSRange range = new NSRange(last, offset - last);
        NSData data = content().subdataWithRange(range);
        content.appendData(data);
        ERXResponse partial = context.partials.get(key);
        if (partial != null) {
          NSData partialData = partial.content();
          content.appendData(partialData);
        }
        last = offset;
      }
      NSRange range = new NSRange(last, _contentLength() - last);
      NSData data = content().subdataWithRange(range);
      content.appendData(data);
      setContent(content);
    }
  }
View Full Code Here

   * Returns a no-copy NSData of the byte buffer for this stream.
   *
   * @return a no-copy NSData of the byte buffer for this stream
   */
  public synchronized NSData toNSData() {
    return new NSData(buf, new NSRange(0, count), true);
  }
View Full Code Here

          headers.setObjectForKey(new NSArray<String>(header.getValue().split(",")), header.getKey());
        }
       
        // content
        ChannelBuffer _content = request.getContent();
    NSData contentData = (_content.readable()) ? new WOInputStreamData(new NSData(new ChannelBufferInputStream(_content), 4096)) : NSData.EmptyData;         
   
    // create request
    WORequest _worequest = WOApplication.application().createRequest(
        request.getMethod().getName(),
        request.getUri(),
View Full Code Here

      if (cachedFile.mimeType == null) {
        throw new RuntimeException("Can't determine resource mime type ('" + filePath + "')");
      }
     
      try {
        cachedFile.data = new NSData(ERXFileUtilities.bytesFromInputStream(fileUrl.openStream()));
      } catch (Exception e) {
        throw new RuntimeException("Error reading file '" + fileUrl.getPath() + "'", e);
      }
     
      synchronized (_cache) {
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.