private static byte[] getResourceImpl(SecurityToken token,
String resourceFilename) {
token.checkIfPermissionAllowed(Permissions.MIDP);
byte[] resourceBuffer = null;
RandomAccessStream stream = new RandomAccessStream(token);
try {
stream.connect(resourceFilename, Connector.READ);
resourceBuffer = new byte[stream.getSizeOf()];
stream.readBytes(resourceBuffer, 0, resourceBuffer.length);
} catch (java.io.IOException e) {
resourceBuffer = null;
} finally {
try {
stream.disconnect();
} catch (java.io.IOException ignored) {
}
}
return resourceBuffer;