2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 package com
.sun
.star
.sdbcx
.comp
.hsqldb
;
20 public class NativeStorageAccess
{
21 static { NativeLibraries
.load(); }
23 public static final int READ
= 1;
24 private static final int SEEKABLE
= 2;
25 private static final int SEEKABLEREAD
= 3;
26 public static final int WRITE
= 4;
27 private static final int READWRITE
= 7;
28 public static final int TRUNCATE
= 8;
30 /** Creates a new instance of StorageAccess */
31 public NativeStorageAccess(String name
,String _mode
,Object key
) throws java
.io
.IOException
{
33 int mode
= NativeStorageAccess
.SEEKABLEREAD
;
34 if ( _mode
.equals("rw") )
35 mode
= NativeStorageAccess
.READWRITE
| NativeStorageAccess
.SEEKABLE
;
37 openStream(name
, (String
)key
, mode
);
38 } catch(Exception ex1
){
39 java
.io
.IOException ex2
= new java
.io
.IOException();
44 private native void openStream(String name
,String key
, int mode
);
45 public native void close(String name
,String key
) throws java
.io
.IOException
;
47 public native long getFilePointer(String name
,String key
) throws java
.io
.IOException
;
49 public native long length(String name
,String key
) throws java
.io
.IOException
;
51 public native int read(String name
,String key
) throws java
.io
.IOException
;
53 public native int read(String name
,String key
,byte[] b
, int off
, int len
) throws java
.io
.IOException
;
57 public native void seek(String name
,String key
,long position
) throws java
.io
.IOException
;
59 public native void write(String name
,String key
,byte[] b
, int offset
, int length
) throws java
.io
.IOException
;