View Javadoc

1   
2   package example.filestorage;
3   
4   import java.io.*;
5   
6   /***
7    * 
8    * 
9    * 
10   * @author Sean C. Sullivan
11   * 
12   * 
13   */
14  public class CreateFiles
15  {
16  	public static void main(String[] args) throws Exception
17  	{
18  		FileStorageDAO dao = DAOFactory.getFileStorageDAO();
19  		
20  		long now = System.currentTimeMillis();
21  		
22  		for (int i = 0; i < 5; i ++)
23  		{
24  			byte[] sourceData = "hello".getBytes();
25  			ByteArrayInputStream input = new ByteArrayInputStream(sourceData);
26  			String filename = "foobar_" + now + "_" + i + ".txt";
27  			long id = dao.saveFile(filename, input, sourceData.length);
28  			System.out.println("Saved file: " + filename + " (id = " + id + ")");
29  		}
30  
31  	}
32  }