javacommons/gcfbase/src/streamsjni.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Contains all JNI calls made by StreamConnectionBase
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "nativestreambase.h"
       
    20 #include "com_nokia_mj_impl_gcf_utils_StreamConnectionBase.h"
       
    21 
       
    22 
       
    23 using namespace java;
       
    24 
       
    25 JNIEXPORT jint JNICALL
       
    26 Java_com_nokia_mj_impl_gcf_utils_StreamConnectionBase__1readbytes
       
    27 (JNIEnv *aJni, jobject /*peer*/, jint nativePeer, jbyteArray aBytes)
       
    28 {
       
    29     NativeStreamBase* nativeConn =
       
    30         reinterpret_cast<NativeStreamBase* >(nativePeer);
       
    31 
       
    32     return nativeConn->readBytes(*aJni, aBytes);
       
    33 }
       
    34 
       
    35 
       
    36 JNIEXPORT jint JNICALL
       
    37 Java_com_nokia_mj_impl_gcf_utils_StreamConnectionBase__1writebytes
       
    38 (JNIEnv *aJni, jobject /*peer*/, jint nativePeer, jbyteArray aBytes,
       
    39  int aOffset, int aLength)
       
    40 {
       
    41     NativeStreamBase* nativeConn =
       
    42         reinterpret_cast<NativeStreamBase* >(nativePeer);
       
    43 
       
    44     return nativeConn->writeBytes(*aJni, aBytes, aOffset , aLength);
       
    45 }
       
    46 
       
    47 
       
    48 JNIEXPORT void JNICALL
       
    49 Java_com_nokia_mj_impl_gcf_utils_StreamConnectionBase__1stopreading
       
    50 (JNIEnv* /*aJni*/, jobject /*peer*/, jint nativePeer)
       
    51 {
       
    52     NativeStreamBase* nativeConn =
       
    53         reinterpret_cast<NativeStreamBase* >(nativePeer);
       
    54 
       
    55     nativeConn->stopReading();
       
    56 }
       
    57 
       
    58 JNIEXPORT void JNICALL
       
    59 Java_com_nokia_mj_impl_gcf_utils_StreamConnectionBase__1stopwriting
       
    60 (JNIEnv* /*aJni*/, jobject /*peer*/, jint nativePeer)
       
    61 {
       
    62     NativeStreamBase* nativeConn =
       
    63         reinterpret_cast<NativeStreamBase* >(nativePeer);
       
    64 
       
    65     nativeConn->stopWriting();
       
    66 }
       
    67 
       
    68 JNIEXPORT void JNICALL
       
    69 Java_com_nokia_mj_impl_gcf_utils_StreamConnectionBase__1setNativeBufferSize
       
    70 (JNIEnv* /*aJni*/, jobject /*peer*/, jint nativePeer, jint size)
       
    71 {
       
    72     NativeStreamBase* nativeConn =
       
    73         reinterpret_cast<NativeStreamBase* >(nativePeer);
       
    74 
       
    75     nativeConn->setBufferSize(size);
       
    76 }
       
    77 
       
    78 JNIEXPORT jint JNICALL
       
    79 Java_com_nokia_mj_impl_gcf_utils_StreamConnectionBase__1available
       
    80 (JNIEnv* /*aJni*/, jobject /*peer*/, jint nativePeer)
       
    81 {
       
    82     NativeStreamBase* nativeConn =
       
    83         reinterpret_cast<NativeStreamBase* >(nativePeer);
       
    84 
       
    85     return nativeConn->available();
       
    86 }
       
    87