com.liferay.faces.util.application
Class ResourceUtil

java.lang.Object
  extended by com.liferay.faces.util.application.ResourceUtil

public final class ResourceUtil
extends Object

Author:
Neil Griffin

Method Summary
static String getResourceId(String library, String name)
           
static String getResourceId(javax.faces.component.UIComponent componentResource)
           
static InputStream toInputStream(String string, String encoding)
          Converts a String to an InputStream.
static String toString(InputStream inputStream, String encoding, int bufferSize)
          Converts an InputStream to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResourceId

public static String getResourceId(javax.faces.component.UIComponent componentResource)

getResourceId

public static String getResourceId(String library,
                                   String name)

toInputStream

public static InputStream toInputStream(String string,
                                        String encoding)
                                 throws UnsupportedEncodingException
Converts a String to an InputStream.

Parameters:
string - The string that is to be encoded and converted into an InputStream.
encoding - The character set that is to be used for encoding the string prior to conversion.
Returns:
The InputStream representation of the specified string, after having first been encoded according to the specified character set.
Throws:
UnsupportedEncodingException - If the specified encoding character set is not supported.

toString

public static String toString(InputStream inputStream,
                              String encoding,
                              int bufferSize)
                       throws IOException
Converts an InputStream to a String.

Parameters:
inputStream - The InputStream which contains some text.
encoding - The encoding of the text of the InputStream.
bufferSize - The size of the character buffer to be used when reading the file. If you do not want to specify this value, use toInputStream(java.lang.String, java.lang.String) which provides a default of 1024.
Returns:
The string content of the InputStream.
Throws:
IOException - If an error occurs while reading the specified input stream.


Copyright © 2019 Liferay, Inc.. All rights reserved.