36 #if defined(ENABLE_JNI_HEADERS)
37 # include "native/include/com_sun_cldc_io_ResourceInputStream.h"
65 uint8_t *data =
MNEW(
u1, size);
76 com_sun_cldchi_jvm_FileDescriptor fd(h, (int64_t) data, 0, size);
78 return fd.get_handle();
85 struct stat statBuffer;
90 fd = open(path, O_RDONLY);
94 if (fstat(fd, &statBuffer) != -1) {
95 len = statBuffer.st_size;
101 filep = (
u1*) mmap(0, len, PROT_READ, MAP_PRIVATE, fd, 0);
110 com_sun_cldchi_jvm_FileDescriptor fd(h, (int64_t) filep, 0, len);
112 return fd.get_handle();
144 filename.
write(name);
148 for (SuckClasspath::iterator it = suckclasspath.begin(); it != suckclasspath.end(); it++) {
151 #if defined(ENABLE_ZLIB)
159 if (descriptor != NULL) {
171 if (descriptor != NULL) {
174 #if defined(ENABLE_ZLIB)
190 com_sun_cldchi_jvm_FileDescriptor fd(jobj);
191 int32_t
length = fd.get_position();
192 int32_t position = fd.get_length();
194 return length - position;
205 com_sun_cldchi_jvm_FileDescriptor fd(jobj);
207 int64_t filep = fd.get_pointer();
208 int32_t position = fd.get_position();
209 int32_t
length = fd.get_length();
213 if (position < length) {
214 byte = ((uint8_t*) filep)[position];
222 fd.set_position(position);
224 return (byte & 0xFF);
240 com_sun_cldchi_jvm_FileDescriptor fd(jobj);
242 int64_t filep = fd.get_pointer();
243 int32_t position = fd.get_position();
244 int32_t fileLength = fd.get_length();
246 int32_t readBytes = -1;
248 if (position < fileLength) {
249 int32_t available = fileLength - position;
251 if (available < len) {
252 readBytes = available;
257 os::memcpy(buf, ((uint8_t*) filep) + position, readBytes *
sizeof(uint8_t));
258 position += readBytes;
265 fd.set_position(position);
278 com_sun_cldchi_jvm_FileDescriptor fd(jobj);
286 com_sun_cldchi_jvm_FileDescriptor clonefd(h, fd);
288 return (
jobject) clonefd.get_handle();
Table containing all native methods registered with the VM.
NativeMethods & get_nativemethods()
void register_methods(Utf8String classname, const JNINativeMethod *methods, size_t count)
Register native methods with the VM.
#define NATIVE_METHODS_COUNT
int8_t * get_raw_data_ptr()
classinfo * load_class_bootstrap(Utf8String name)
JNIEnv jclass jobject const char * name
JNIEnv jthread jobject jclass jlong size
void get(uint8_t *dst) const
static Utf8String from_utf8(const char *, size_t)
static void * memcpy(void *dest, const void *src, size_t n)
EntryRef find(Utf8String filename)
Find file in zip archive.
java_handle_t * native_new_and_init(classinfo *c)
Registers a new native agent by specified by it's library name and with an optional options string...
SuckClasspath & get_suckclasspath()
const char const void jint length
AnyObjLocker< Mutex > MutexLocker
static VM * get_current()