示例#1
0
        /// <summary>
        /// Gets the bytes from a string using the current process engine's default charset
        /// </summary>
        /// <param name="string"> the string to get the bytes form </param>
        /// <returns> the byte array </returns>
        public static sbyte[] toByteArray(string @string)
        {
            EnsureUtil.ensureActiveCommandContext("StringUtil.toByteArray");
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            return(toByteArray(@string, processEngineConfiguration.ProcessEngine));
        }
示例#2
0
        public static Writer writerForStream(Stream outStream)
        {
            EnsureUtil.ensureActiveCommandContext("StringUtil.readerFromBytes");
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            return(new StreamWriter(outStream, processEngineConfiguration.DefaultCharset));
        }
示例#3
0
        /// <summary>
        /// converts a byte array into a string using the current process engines default charset as
        /// returned by <seealso cref="ProcessEngineConfigurationImpl.getDefaultCharset()"/>
        /// </summary>
        /// <param name="bytes"> the byte array </param>
        /// <returns> a string representing the bytes </returns>
        public static string fromBytes(sbyte[] bytes)
        {
            EnsureUtil.ensureActiveCommandContext("StringUtil.fromBytes");
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            return(fromBytes(bytes, processEngineConfiguration.ProcessEngine));
        }
示例#4
0
        public static Reader readerFromBytes(sbyte[] bytes)
        {
            EnsureUtil.ensureActiveCommandContext("StringUtil.readerFromBytes");
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            MemoryStream inputStream = new MemoryStream(bytes);

            return(new StreamReader(inputStream, processEngineConfiguration.DefaultCharset));
        }