PDA

View Full Version : [Java] mappare un file in memoria


DarkSun84
26-07-2009, 17:38
Ciao, sto scrivendo un'applicazione che deve mappare in memoria un file video, e poi leggerlo tramite le librerie jmf. Il problema è che il player che ho, vuole come parametro il descrittore del file mentre io ho l'area di memoria da passare e non sò come fare. Ecco il codice:


String nameFile;
nameFile = list2.getSelectedItem();
FileChannel rwCh = null;
rwCh = (new RandomAccessFile(nameFile, "rw")).getChannel();
long fileSize = 0;
fileSize = rwCh.size();
MappedByteBuffer mapFile = rwCh.map(FileChannel.MapMode.READ_WRITE, 0, fileSize);
rwCh.close();
URL mediaURL = mapFile.toURL(); // il problema è qui, dove vuole il descrittore di un file!


Allego l'errore del compilatore:

C:\Documents and Settings\DarkSun\Documenti\NetBeansProjects\DRM\src\my\drm\drmGUI.java:462: cannot find symbol
symbol : variable mapFile
location: class my.drm.drmGUI
mediaURL = mapFile.toURL();
Note: C:\Documents and Settings\DarkSun\Documenti\NetBeansProjects\DRM\src\my\drm\drmGUI.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
C:\Documents and Settings\DarkSun\Documenti\NetBeansProjects\DRM\nbproject\build-impl.xml:363: The following error occurred while executing this line:
C:\Documents and Settings\DarkSun\Documenti\NetBeansProjects\DRM\nbproject\build-impl.xml:168: Compile failed; see the compiler error output for details.