void OnlineUnlockStatus::save() { MemoryOutputStream mo; { GZIPCompressorOutputStream gzipStream (&mo, 9); status.writeToStream (gzipStream); } saveState (mo.getMemoryBlock().toBase64Encoding()); }
//============================================================================== static String encryptXML (const XmlElement& xml, RSAKey privateKey) { MemoryOutputStream text; text << xml.createDocument (StringRef(), true); BigInteger val; val.loadFromMemoryBlock (text.getMemoryBlock()); privateKey.applyToValue (val); return val.toString (16); }
static MemoryBlock createRequestHeader (const String& hostName, const int hostPort, const String& proxyName, const int proxyPort, const String& hostPath, const String& originalURL, const String& userHeaders, const MemoryBlock& postData, const bool isPost) { MemoryOutputStream header; if (proxyName.isEmpty()) writeHost (header, isPost, hostPath, hostName, hostPort); else writeHost (header, isPost, originalURL, proxyName, proxyPort); writeValueIfNotPresent (header, userHeaders, "User-Agent:", "JUCE/" JUCE_STRINGIFY(JUCE_MAJOR_VERSION) "." JUCE_STRINGIFY(JUCE_MINOR_VERSION) "." JUCE_STRINGIFY(JUCE_BUILDNUMBER)); writeValueIfNotPresent (header, userHeaders, "Connection:", "Close"); writeValueIfNotPresent (header, userHeaders, "Content-Length:", String ((int) postData.getSize())); header << "\r\n" << userHeaders << "\r\n" << postData; return header.getMemoryBlock(); }
static MemoryBlock valueTreeToMemoryBlock (const ValueTree& v) { MemoryOutputStream mo; v.writeToStream (mo); return mo.getMemoryBlock(); }