You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by hc...@apache.org on 2005/01/27 11:58:43 UTC

cvs commit: jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/file CacheFileContent.java

hchar       2005/01/27 02:58:43

  Modified:    sandbox/yajcache/src/org/apache/jcs/yajcache/file
                        CacheFileContent.java
  Log:
  add deserialize method; add CORRUTPED file content
  
  Revision  Changes    Path
  1.2       +8 -3      jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileContent.java
  
  Index: CacheFileContent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileContent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CacheFileContent.java	24 Jan 2005 10:29:45 -0000	1.1
  +++ CacheFileContent.java	27 Jan 2005 10:58:43 -0000	1.2
  @@ -21,7 +21,7 @@
   import java.io.RandomAccessFile;
   import java.util.Arrays;
   
  -import org.apache.jcs.yajcache.annotate.*;
  +import org.apache.jcs.yajcache.lang.annotation.*;
   
   /**
    * Cache File Content which represents the file persistence format 
  @@ -38,7 +38,8 @@
    * @author Hanson Char
    */
   @CopyRightApache
  -class CacheFileContent {
  +public class CacheFileContent {
  +    public static final CacheFileContent CORRUPTED = CacheFileContentCorrupted.inst;
       /**
        * Minimum File Length =
        * contentType (1 byte) + contentLength (4 bytes) + contentHashCode (4 bytes)
  @@ -50,7 +51,7 @@
       
       private byte[] content;
       
  -    private CacheFileContent() {}
  +    protected CacheFileContent() {}
       
       /**
        * Constructs an instance of CacheFileContent from the given content type
  @@ -148,4 +149,8 @@
           cfc.setContent(ba);
           return cfc;
       }
  +    /** Returns the deserialized content. */
  +    public @NonNullable Object deserialize() {
  +        return CacheFileContentType.fromByte(this.contentType).deserialize(this.content);
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org