0 Replies Latest reply on Aug 23, 2006 5:30 AM by cédric charpentier

    Blob Tutorial

    cédric charpentier Newbie

      I try to use the blob tutorial and modify it.

      I want to test with fileInput
      in the bean to create from file, it 's working

      public long create()
       BlobEntity blob = new BlobEntity();
       File file = new File("D:\\data.dat");
       int fileLength = (int) file.length();
      try {
       FileInputStream fileinp = new FileInputStream(file);
       catch (IOException e)
       throw new RuntimeException(e);

      but Ican not manage to get my file from the blob

      I try lot of thing, I get some Serialisation error
      here the code to find blob

      public InputStream findBlob(long id) throws Exception
       BlobEntity blob = manager.find(BlobEntity.class, id);
       ObjectInputStream ois = new ObjectInputStream(blob.getBlobby().getBinaryStream());
       return (InputStream) ois.readObject();

      how I can get the file stream?