Here you can find the source of getStream(final String string, final String codePage)
Parameter | Description |
---|---|
string | the string to convert |
codePage | the codepage of string |
Parameter | Description |
---|---|
UnsupportedEncodingException | an exception |
public static InputStream getStream(final String string, final String codePage) throws UnsupportedEncodingException
//package com.java2s; /*/*from www . jav a 2s . com*/ * This work is Open Source and licensed by the European Commission under the * conditions of the European Public License v1.1 * * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1); * * any use of this file implies acceptance of the conditions of this license. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; public class Main { /** * Get inputstream from string * @param string the string to convert * @param codePage the codepage of string * @return an inputstream * @throws UnsupportedEncodingException */ public static InputStream getStream(final String string, final String codePage) throws UnsupportedEncodingException { return new ByteArrayInputStream(string.getBytes(codePage)); } }