1 17 18 package org.alfresco.filesys.smb.server.repo.pseudo; 19 20 import org.alfresco.filesys.server.filesys.FileInfo; 21 import org.alfresco.filesys.server.filesys.NetworkFile; 22 23 30 public class MemoryPseudoFile extends PseudoFile 31 { 32 34 private byte[] m_data; 35 36 42 public MemoryPseudoFile(String name, byte[] data) 43 { 44 super( name); 45 46 m_data = data; 47 } 48 49 54 public FileInfo getFileInfo() 55 { 56 58 if ( m_fileInfo == null) { 59 60 62 m_fileInfo = new FileInfo( getFileName(), m_data != null ? m_data.length : 0, getAttributes()); 63 64 66 m_fileInfo.setCreationDateTime( _creationDateTime); 67 m_fileInfo.setModifyDateTime( _creationDateTime); 68 m_fileInfo.setChangeDateTime( _creationDateTime); 69 70 72 m_fileInfo.setAllocationSize(( m_fileInfo.getSize() + 512L) & 0xFFFFFFFFFFFFFE00L); 73 } 74 75 77 return m_fileInfo; 78 } 79 80 86 public NetworkFile getFile(String netPath) 87 { 88 90 FileInfo finfo = getFileInfo(); 91 finfo.setPath( netPath); 92 93 return new MemoryNetworkFile( getFileName(), m_data, finfo); 94 } 95 } 96 | Popular Tags |