Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSData.bytes()


  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");
      }
View Full Code Here


      }
      boolean parsed = false;
      BufferedInputStream bis = new BufferedInputStream(is);

      NSData data = new NSData(bis, -1); // bigger chunk size?
      byte[] theBytes = data.bytes();

      // Parse the HEADER
      // ----------------
      // magic number ("bplist")
      // file format version ("00")
View Full Code Here

                NSData responseContent = aResponse.content();
                try {
                    instanceResponse = (NSDictionary) new _JavaMonitorDecoder().decodeRootObject(responseContent);
                } catch (WOXMLException wxe) {
                    try {
                        Object o = NSPropertyListSerialization.propertyListFromString(new String(responseContent.bytes()));
                        errorResponse.addObject(anInstance.displayName() + " is probably an older application that doesn't conform to the current Monitor Protocol. Please update and restart the instance.");
                        NSLog.err.appendln("Got old-style response from instance: " + anInstance.displayName());
                    } catch (Throwable t) {
                        NSLog.err.appendln("Wotaskd getStatisticsForInstanceArray: Error parsing: " + new String(responseContent.bytes()) + " from " + anInstance.displayName());
                    }
View Full Code Here

                    try {
                        Object o = NSPropertyListSerialization.propertyListFromString(new String(responseContent.bytes()));
                        errorResponse.addObject(anInstance.displayName() + " is probably an older application that doesn't conform to the current Monitor Protocol. Please update and restart the instance.");
                        NSLog.err.appendln("Got old-style response from instance: " + anInstance.displayName());
                    } catch (Throwable t) {
                        NSLog.err.appendln("Wotaskd getStatisticsForInstanceArray: Error parsing: " + new String(responseContent.bytes()) + " from " + anInstance.displayName());
                    }
                    continue;
                } catch (NullPointerException npe) {
                    NSLog.err.appendln("Wotaskd getStatisticsForInstanceArray: No content returned from " + anInstance.displayName());
                    continue;
View Full Code Here

    }
   
    public String storedGzippedValueForKey(String key) {
        NSData data = (NSData)storedValueForKey(key);
        String value = null;
        if (data != null && data.bytes().length > 0) {
            value = ERXCompressionUtilities.gunzipByteArrayAsString(data.bytes());
        }
        return value;
    }
View Full Code Here

   
    public String storedGzippedValueForKey(String key) {
        NSData data = (NSData)storedValueForKey(key);
        String value = null;
        if (data != null && data.bytes().length > 0) {
            value = ERXCompressionUtilities.gunzipByteArrayAsString(data.bytes());
        }
        return value;
    }

    public void takeStoredGzippedValueForKey(String aValue, String key) {
View Full Code Here

    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

        dumpDictionary(sb, (NSDictionary)value, level);
      } else if (value instanceof NSArray) {
        dumpArray(sb, (NSArray)value, level);
      } else if (value instanceof NSData) {
        NSData data = (NSData)value;
      sb.append(byteArrayToHexString(data.bytes()));
      } else if (value instanceof EODatabaseOperation) {
        dumpDictionary(sb, databaseOperationAsDictionary((EODatabaseOperation)value), level);
      } else if (value instanceof EOAdaptorOperation) {
        dumpDictionary(sb, adaptorOperationAsDictionary((EOAdaptorOperation)value), level);
       } else {
View Full Code Here

          byte[] compressedData;
          if (contentInputStream != null) {
            inputBytesLength = response.contentInputStreamLength();
            NSData compressedNSData = ERXCompressionUtilities.gzipInputStreamAsNSData(contentInputStream, (int)inputBytesLength);
            //compressedData = compressedNSData._bytesNoCopy();
            compressedData = compressedNSData.bytes();
            response.setContentStream(null, 0, 0L);
          }
          else {
            NSData input = response.content();
            inputBytesLength = input.length();
View Full Code Here

    if (element.getNodeName().equals("img")
        && element.getAttribute("src").matches(".*/wr\\?wodata=[\\-0-9]*$")) {
      String key = element.getAttribute("src").replaceFirst(".*/wr\\?wodata=(.*)", "$1");
      try {
        NSData data = cachedDataForKey(key);
        FSImage fsImage = new ITextFSImage(Image.getInstance(data.bytes()));
        if (cssWidth != -1 || cssHeight != -1) {
          fsImage.scale(cssWidth, cssHeight);
        }
        return new ITextImageElement(fsImage);
      } catch (Exception e) {
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.