Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [geclipse-dev] EFS openInputStream

Hi Harald,

Unfortunately I have no sources available. But let me try to reconstruct them from memory ;-)

The CachedInputStream is used by the gecl-FS internally to allow opening remote files in a standard Eclipse editor which requires the whole content of a file to be immediately available at opening time. Therefore it fetches the whole file content before the Open Action itself actually takes place. A HeapByteBuffer is used internally to store the file content. In order to correctly allocate this HeapByteBuffer the CachedInputStream needs to know the size of the file. The size of the file is retrieved via the IFileStore's IFileInfo-Object.

Now it is far too often the case that developer's are too lazy to fully implement their EFS-Implementation before they're trying to do fancy things with it :-P So if they are implementing IFileStore correctly but are forgetting about parts of IFileInfo ... then things like what you described are happening.

So just a guess, but is it possible that your IFileInfo#getLength() does return 0 or at least a number that is smaller than the actual length of your String (which is your file content)?!

Cheers, Mathias


-----Ursprüngliche Nachricht-----
Von: geclipse-dev-bounces@xxxxxxxxxxx im Auftrag von Harald Kornmayer
Gesendet: Do 05.11.2009 11:08
An: Developer mailing list
Betreff: [geclipse-dev] EFS openInputStream
 
Hi all 
 
I try to connect to another Cloud file system. So I started to implement the Cloud file system using EFS. 
The first draft works partly: 
1. I can create the connection
2. I can browser through the hierarchy of the File System. The file system is in fact like AWS S3 or GRIA. 
ONe has a bucket/container and a list of files under the container. 
 
3. When I try to (over-) write the openInputStream the file, I can get the content as a String. There is not getInputStream method available from the API. Then I do the following: 
 
 
InputStream value = null ; 
Inp....
Inputt Stream value = null ; 
...
String result = (use API used to get the String. I can dump it to the screen!!) 
value = new ByteArrayInputStream(result.getBytes()); 
 
return value ; 
 
When doing so, I can not open the editor, as I got the following message: 
 
java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(Unknown Source)
at eu.geclipse.core.filesystem.internal.filesystem.CachedInputStream.cache(CachedInputStream.java:123)
at eu.geclipse.core.filesystem.internal.filesystem.GEclipseFileStore.cacheInputStream(GEclipseFileStore.java:208)
at eu.geclipse.core.filesystem.internal.filesystem.ConnectionElement.getCachedConnectionFileStore(ConnectionElement.java:165)
at eu.geclipse.ui.internal.actions.OpenFileAction$1.run(OpenFileAction.java:171)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

 
Any idea?? 
Matheusz, Mathias, Thomas, ...
 
Harald 
 



Back to the top