📄 fileinputstream.c
字号:
/**************************************************************************************
* FileInputStream.c
*
* This file defines all native methods that have to be implemented to support
* java/lang/FileInputStream class.
* Actual implementation is target device dependent and therefore must be
* implemented by the application developer.
*
* Application developer should use the following functions to get access to
* arrays and String object:
* vmGetStringCount
* vmGetStringArray
* vmGetArraySize
* vmGetArray
* These functions are accessible via vm_config_t structure (see Win32 demo
* application for examples on how to use them).
*
**************************************************************************************
*
* This file is covered by the GNU GPL with the following exception:
* As a special exception, the copyright holders of this library give you permission
* to link this library with independent modules to produce an executable, regardless
* of the license terms of these independent modules, and to copy and distribute the
* resulting executable under terms of your choice, provided that you also meet, for
* each linked independent module, the terms and conditions of the license of that
* module. An independent module is a module which is not derived from or based on
* this library. If you modify this library, you may extend this exception to your
* version of the library, but you are not obligated to do so. If you do not wish
* to do so, delete this exception statement from your version.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL RTJ COMPUTING BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Copyright (c) 2000-2002 RTJ Computing Pty. Ltd. All rights reserved.
**************************************************************************************/
#include "javavm.h"
/****************************************************************************
* Closes the opened file handle.
* On entry param[1] will contain native file handle.
* On return function should indicate if handle was closed via retval parameter:
* 0 - handle closed successfully
* -1 - closing has failed
*
* Java prototype:
* private native int close0(int handle);
*
****************************************************************************/
int16 java_io_FileInputStream_close0(int32 param[], int32 *retval)
{
/* Add your code here */
return NO_EXCEP;
}
/****************************************************************************
* Opens the named file.
* On entry param[1] will contain reference to String containg the name of a file.
* On return function should provide file handle via retval parameter:
* >= 0 - file handle
* -1 - opening has failed
*
* Java prototype:
* private native int open0(String name);
*
****************************************************************************/
int16 java_io_FileInputStream_open0(int32 param[], int32 *retval)
{
/* Add your code here */
return NO_EXCEP;
}
/****************************************************************************
* Reads the data from the file.
* On entry param[1] will contain native file handle.
* param[2] will contain reference to destination byte array
* param[3] will contain offset to destination array
* param[4] will contain number of bytes to read (copy to dest. array)
* On return function should provide number of bytes read via retval parameter:
* >= 0 - actual number of bytes copied into destination array
* -1 - reading has failed
*
* Java prototype:
* private native int read0(int handle, byte[] buf, int offset, int len);
*
****************************************************************************/
int16 java_io_FileInputStream_read0(int32 param[], int32 *retval)
{
/* Add your code here */
return NO_EXCEP;
}
/****************************************************************************
* Skips the specified number of bytes.
* On entry param[1] will contain native file handle.
* param[2] will contain number of bytes to skip
* On return function should provide number of bytes read via retval parameter:
* >= 0 - actual number of bytes skipped
* -1 - skipping has failed
*
* Java prototype:
* private native int skip0(int handle, int num_bytes);
*
****************************************************************************/
int16 java_io_FileInputStream_skip0(int32 param[], int32 *retval)
{
/* Add your code here */
return NO_EXCEP;
}
/****************************************************************************
* Retrieves the file length.
* On entry param[1] will contain native file handle.
* On return function should provide file length via retval parameter:
* >= 0 - length of the file
* -1 - get file length failed
*
* Java prototype:
* private native int getFileLength0(int handle);
*
****************************************************************************/
int16 java_io_FileInputStream_getFileLength0(int32 param[], int32 *retval)
{
/* Add your code here */
return NO_EXCEP;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -