1 40 package com.mvnforum.impl; 41 42 import java.io.*; 43 44 import net.myvietnam.mvncore.service.BinaryStorage; 45 import net.myvietnam.mvncore.service.BinaryStorageHandle; 46 import net.myvietnam.mvncore.util.FileUtil; 47 48 public abstract class BinaryStorageBase implements BinaryStorage { 49 50 public BinaryStorageHandle storeData(String category, String nameId, String fileName, byte[] data, 51 int attachDataFileSize, int attachOption, int attachStatus, String contentType, String storageIP) 52 throws IOException { 53 54 return storeData(category, nameId, fileName, new ByteArrayInputStream(data, 0, attachDataFileSize), 55 attachDataFileSize, attachOption, attachStatus, contentType, storageIP); 56 } 57 58 public byte[] loadData(String category, String nameId, BinaryStorageHandle handle) 59 throws IOException { 60 61 InputStream inputStream = getInputStream(category, nameId, handle); 62 return FileUtil.getBytes(inputStream); 63 } 64 65 public void updateData(String category, String nameId, BinaryStorageHandle handle) 66 throws IOException { 67 68 throw new RuntimeException ("Not emplemented yet."); 69 } 70 } 71 | Popular Tags |