KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > nio > charset > Charset

java.nio.charset
Class Charset

java.lang.Object
  extended by java.nio.charset.Charset
All Implemented Interfaces:
Comparable<Charset>
See Also:
Top Examples, Source Code, OutputStreamWriter, InputStreamReader, CharsetDecoder, CharsetEncoder, CharsetProvider, Character

public final Set<String> aliases()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static SortedMap<String,Charset> availableCharsets()
See Also:
forName
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean canEncode()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected Charset(String canonicalName,
                  String[] aliases)
See Also:
IllegalCharsetNameException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final int compareTo(Charset that)
See Also:
Comparable, compareTo
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract boolean contains(Charset cs)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final CharBuffer decode(ByteBuffer bb)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Charset defaultCharset()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String displayName()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String displayName(Locale locale)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final ByteBuffer encode(String str)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final ByteBuffer encode(CharBuffer cb)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final boolean equals(Object ob)
See Also:
Hashtable, Object.hashCode()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Charset forName(String charsetName)
See Also:
UnsupportedCharsetException, IllegalCharsetNameException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final int hashCode()
See Also:
Hashtable, Object.equals(java.lang.Object)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final boolean isRegistered()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static boolean isSupported(String charsetName)
See Also:
IllegalCharsetNameException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final String name()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract CharsetDecoder newDecoder()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract CharsetEncoder newEncoder()
See Also:
UnsupportedOperationException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1232]Prints out the comments found in a .java file
By Anonymous on 2004/12/27 19:54:05  Rate
/* 
 * Prints out the comments found in a .java file. 
 */
 
 // Create a pattern to match comments 
 Pattern p =  
     Pattern.compile ( "//.*$", Pattern.MULTILINE ) ; 
  
  
 // Get a Channel for the source file 
 File f = new File ( "Replacement.java" ) ; 
 FileInputStream fis = new FileInputStream ( f ) ; 
 FileChannel fc = fis.getChannel (  ) ; 
  
  
 // Get a CharBuffer from the source file 
 ByteBuffer bb =  
     fc.map ( FileChannel.MAP_RO, 0,  ( int ) fc.size (  )  ) ; 
 Charset cs = Charset.forName ( "8859_1" ) ; 
 CharsetDecoder cd = cs.newDecoder (  ) ; 
 CharBuffer cb = cd.decode ( bb ) ; 
  
  
 // Run some matches 
 Matcher m = p.matcher ( cb ) ; 
 while  ( m.find (  )  )  
     System.out.println ( "Found comment: "+m.group (  )  ) ; 
 


public final String toString()
See Also:
Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags