Coverage Report - org.webslinger.vfs.StringVFSDelegate
 
Classes in this File Line Coverage Branch Coverage Complexity
StringVFSDelegate
6%
1/16
N/A
0
 
 1  
 package org.webslinger.vfs;
 2  
 
 3  
 import java.io.ByteArrayInputStream;
 4  
 import java.io.InputStream;
 5  
 import java.io.IOException;
 6  
 import java.io.OutputStream;
 7  
 import java.util.Collection;
 8  
 
 9  
 import org.webslinger.io.Charsets;
 10  
 import org.webslinger.io.IOUtil;
 11  
 
 12  27
 public class StringVFSDelegate extends VFSDelegate<String, String, Void> {
 13  
     public String getId(String id) {
 14  0
         return id;
 15  
     }
 16  
 
 17  
     public Type getType(String id) {
 18  0
         return Type.FILE;
 19  
     }
 20  
 
 21  
     public long getLastModifiedTime(String id) {
 22  0
         return 0;
 23  
     }
 24  
 
 25  
     public Collection<Permission> getPermissions(String id) throws IOException {
 26  0
         return Permission.READABLE_SET;
 27  
     }
 28  
 
 29  
     public Void getParent(String id) throws IOException {
 30  0
         return null;
 31  
     }
 32  
 
 33  
     public String getContentType(String id) throws IOException {
 34  0
         return "text/plain";
 35  
     }
 36  
 
 37  
     public long getLength(String id) throws IOException {
 38  0
         return id.length();
 39  
     }
 40  
 
 41  
     public String getString(String id) {
 42  0
         return id;
 43  
     }
 44  
 
 45  
     public InputStream openInput(String id) throws IOException {
 46  
         try {
 47  0
             return new ByteArrayInputStream(IOUtil.getBytes(id, Charsets.UTF8));
 48  0
         } catch (RuntimeException e) {
 49  0
             throw e;
 50  0
         } catch (Error e) {
 51  0
             throw e;
 52  0
         } catch (Exception e) {
 53  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 54  
         }
 55  
     }
 56  
 }