Java Doc for Encoder.java in  » Portal » Open-Portal » com » sun » portal » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.portal.util.Encoder

Encoder
public class Encoder extends Object (Code)
Static utility class for Base64 encoding/decoding a byte array or Serializable object with support for compression and escaped HTTP strings using a variant of Base64 encoding. The Base64 implementation relies on the sun.misc.* package included with Sun's implementation of the Java Platform; there is no guarantee that this implementation will be used in future versions of this class. The compression features use the java.util.zip package. This class provides static methods only and the default constructor is hidden. Base64 encoding essentially transforms binary data into ASCII; very helpful in cases where binary data needs to be stored in documents. In support of Html documents, a variant of Base64 encoding is used which ensures that encoded Strings can be stored in HTTP/HTML constructs; these strings are referred to as Http64 strings in this API.
See Also:   Http64Decoder
See Also:    Decoding Http64 strings
See Also:   Http64Encoder
See Also:    Encoding Http64 strings
author:
   Todd Fast, todd.fast@sun.com
author:
   Mike Frisino, michael.frisino@sun.com
version:
   JATO/1.2.2 $Id: Encoder.java,v 1.1 2005/06/15 22:23:15 rt94277 Exp $
version:
   This class is copied from JATO 1.2.2 util package




Method Summary
public static  byte[]compress(byte[] in)
     Compresses array of bytes.
public static  byte[]decode(String s)
     Decodes an Http64 string to an array of bytes using a variant of Base64 encoding.
public static  byte[]decodeBase64(String s)
     Decodes a string using Base64 decoding into an array of bytes without compression.
public static  byte[]decodeHttp64(String s)
     Decode an Http64 string to an array of bytes using a variant of Base64 encoding.
public static  byte[]decompress(byte[] in)
     Decompressed array of bytes using ZLIB.
public static  Objectdeserialize(byte[] b, boolean compressed)
     Deserialize or 'reconstitute' an object from an array of bytes, which may be have been previously compressed.
public static  Stringencode(byte[] bytes)
     Encodes an array of bytes into a Http64 string without compression using a variant of Base64 encoding.
public static  StringencodeBase64(byte[] bytes)
     Encodes an array of bytes into a Base64 string, without compression.
public static  StringencodeHttp64(byte[] bytes, int compressThreshold)
     Encodes an array of bytes into a compressed Http64 string using a variant of Base64 encoding, performing compression if the byte array exceeds the length specified by the threshold parameter.
public static  byte[]serialize(Serializable o, boolean compress)
     Serialize or 'flatten' an object to an array of bytes with optional compression.



Method Detail
compress
public static byte[] compress(byte[] in)(Code)
Compresses array of bytes. Handles cases where compression is counterproductive or when there is no compression yield.
Parameters:
  in - array of bytes to be compressed (should not be null) array of bytes in ZLIB compression format



decode
public static byte[] decode(String s)(Code)
Decodes an Http64 string to an array of bytes using a variant of Base64 encoding. Shortcut for calling Encoder.decodeHttp64(String) decodeHttp64(String)
Parameters:
  s - Http64 string to be decoded decoded array of bytes or s.getBytes() on exception during execution



decodeBase64
public static byte[] decodeBase64(String s)(Code)
Decodes a string using Base64 decoding into an array of bytes without compression. Strings not previously Base64 encoded will succeed.
Parameters:
  s - string to be decoded (assumed to be Base64 encoded string) decoded array of bytes or s.getBytes() on exception during execution



decodeHttp64
public static byte[] decodeHttp64(String s)(Code)
Decode an Http64 string to an array of bytes using a variant of Base64 encoding.
Parameters:
  s - Http64 string to be decoded decoded array of bytes or s.getBytes() on exception during execution



decompress
public static byte[] decompress(byte[] in)(Code)
Decompressed array of bytes using ZLIB.
Parameters:
  in - array of bytes to be decompressed (should not be null) decompressed array of bytes



deserialize
public static Object deserialize(byte[] b, boolean compressed) throws IOException, ClassNotFoundException(Code)
Deserialize or 'reconstitute' an object from an array of bytes, which may be have been previously compressed.
Parameters:
  b - array of bytes representing previously serialized object
Parameters:
  compressed - flag indicating need to decompress bytes first reconstituted object



encode
public static String encode(byte[] bytes)(Code)
Encodes an array of bytes into a Http64 string without compression using a variant of Base64 encoding. Shortcut for calling Encoder.encodeHttp64(byte[],int) encodeHttp64(byte[],int)
Parameters:
  bytes - binary data to be encoded, should not be null encoded Http64 string



encodeBase64
public static String encodeBase64(byte[] bytes)(Code)
Encodes an array of bytes into a Base64 string, without compression. Resulting string is uniform with no carriage returns.
Parameters:
  bytes - binary data to be encoded Base64 encoded string



encodeHttp64
public static String encodeHttp64(byte[] bytes, int compressThreshold)(Code)
Encodes an array of bytes into a compressed Http64 string using a variant of Base64 encoding, performing compression if the byte array exceeds the length specified by the threshold parameter.
Parameters:
  bytes - binary data to be encoded, should not be null
Parameters:
  compressThreshold - compression peformed when byte array exceeds this value encoded Http64 string



serialize
public static byte[] serialize(Serializable o, boolean compress) throws IOException(Code)
Serialize or 'flatten' an object to an array of bytes with optional compression.
Parameters:
  o - object to be flattened (should be Serializable)
Parameters:
  compress - flag indicating need to compress results serialized array of bytes from input object , optionally compressed,



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.