1 |
package manta.runtime; |
package gnu.java.nio; |
2 |
import java.nio.*; |
import java.nio.*; |
3 |
final public class MappedByteFileBuffer |
final public class MappedByteFileBuffer |
4 |
extends MappedByteBuffer |
extends MappedByteBuffer |
5 |
{ |
{ |
6 |
|
public long address; |
7 |
boolean ro; |
boolean ro; |
8 |
boolean direct; |
boolean direct; |
9 |
FileChannelImpl ch; |
public FileChannelImpl ch; |
10 |
MappedByteFileBuffer(FileChannelImpl ch) |
public MappedByteFileBuffer(FileChannelImpl ch) |
11 |
{ |
{ |
12 |
this.ch = ch; |
this.ch = ch; |
13 |
|
address = ch.address; |
14 |
} |
} |
15 |
MappedByteFileBuffer(MappedByteFileBuffer b) |
public MappedByteFileBuffer(MappedByteFileBuffer b) |
16 |
{ |
{ |
17 |
this.ro = b.ro; |
this.ro = b.ro; |
18 |
this.ch = b.ch; |
this.ch = b.ch; |
19 |
|
address = b.address; |
20 |
} |
} |
21 |
boolean isReadOnly() |
public boolean isReadOnly() |
22 |
{ |
{ |
23 |
return ro; |
return ro; |
24 |
} |
} |
25 |
static MantaNative byte nio_read_Byte_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Byte_file_channel(FileChannelImpl ch, int index, byte value); |
public static native byte nio_read_Byte_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Byte_file_channel(FileChannelImpl ch, int index, byte value); |
26 |
static MantaNative short nio_read_Short_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Short_file_channel(FileChannelImpl ch, int index, short value); |
public static native short nio_read_Short_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Short_file_channel(FileChannelImpl ch, int index, short value); |
27 |
static MantaNative char nio_read_Char_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Char_file_channel(FileChannelImpl ch, int index, char value); |
public static native char nio_read_Char_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Char_file_channel(FileChannelImpl ch, int index, char value); |
28 |
static MantaNative int nio_read_Int_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Int_file_channel(FileChannelImpl ch, int index, int value); |
public static native int nio_read_Int_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Int_file_channel(FileChannelImpl ch, int index, int value); |
29 |
static MantaNative long nio_read_Long_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Long_file_channel(FileChannelImpl ch, int index, long value); |
public static native long nio_read_Long_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Long_file_channel(FileChannelImpl ch, int index, long value); |
30 |
static MantaNative float nio_read_Float_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Float_file_channel(FileChannelImpl ch, int index, float value); |
public static native float nio_read_Float_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Float_file_channel(FileChannelImpl ch, int index, float value); |
31 |
static MantaNative double nio_read_Double_file_channel(FileChannelImpl ch, int index); static MantaNative void nio_write_Double_file_channel(FileChannelImpl ch, int index, double value); |
public static native double nio_read_Double_file_channel(FileChannelImpl ch, int index); public static native void nio_write_Double_file_channel(FileChannelImpl ch, int index, double value); |
32 |
public byte get() |
final public byte get() |
33 |
{ |
{ |
34 |
byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, pos); |
byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, position()); |
35 |
pos += 1; |
position(position() + 1); |
36 |
return a; |
return a; |
37 |
} |
} |
38 |
public ByteBuffer put(byte b) |
final public ByteBuffer put(byte b) |
39 |
{ |
{ |
40 |
MappedByteFileBuffer.nio_write_Byte_file_channel(ch, pos, b); |
MappedByteFileBuffer.nio_write_Byte_file_channel(ch, position(), b); |
41 |
pos += 1; |
position(position() + 1); |
42 |
return this; |
return this; |
43 |
} |
} |
44 |
public byte get(int index) |
final public byte get(int index) |
45 |
{ |
{ |
46 |
byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, index); |
byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, index); |
47 |
return a; |
return a; |
48 |
} |
} |
49 |
public ByteBuffer put(int index, byte b) |
final public ByteBuffer put(int index, byte b) |
50 |
{ |
{ |
51 |
MappedByteFileBuffer.nio_write_Byte_file_channel(ch, index, b); |
MappedByteFileBuffer.nio_write_Byte_file_channel(ch, index, b); |
52 |
return this; |
return this; |
53 |
} |
} |
54 |
public ByteBuffer compact() |
final public ByteBuffer compact() |
55 |
{ |
{ |
56 |
return this; |
return this; |
57 |
} |
} |
58 |
public boolean isDirect() |
final public boolean isDirect() |
59 |
{ |
{ |
60 |
return direct; |
return direct; |
61 |
} |
} |
62 |
public ByteBuffer slice() |
final public ByteBuffer slice() |
63 |
{ |
{ |
64 |
MappedByteFileBuffer A = new MappedByteFileBuffer(this); |
MappedByteFileBuffer A = new MappedByteFileBuffer(this); |
65 |
return A; |
return A; |
74 |
b.ro = true; |
b.ro = true; |
75 |
return b; |
return b; |
76 |
} |
} |
77 |
public ByteBuffer asByteBuffer() { return new MappedByteFileBuffer(ch); } public byte getByte() { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putByte(byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, pos, value); pos += 1; return this; } public byte getByte(int index) { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, index); return a; } public ByteBuffer putByte(int index, byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, index, value); return this; }; |
final public ByteBuffer asByteBuffer() { return new MappedByteFileBuffer(ch); } final public byte getByte() { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putByte(byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, position(), value); position(position() + 1); return this; } final public byte getByte(int index) { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, index); return a; } final public ByteBuffer putByte(int index, byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, index, value); return this; }; |
78 |
public CharBuffer asCharBuffer() { return new MappedCharFileBuffer(ch); } public char getChar() { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putChar(char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, pos, value); pos += 1; return this; } public char getChar(int index) { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index); return a; } public ByteBuffer putChar(int index, char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, index, value); return this; }; |
final public CharBuffer asCharBuffer() { return new MappedCharFileBuffer(ch); } final public char getChar() { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putChar(char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, position(), value); position(position() + 1); return this; } final public char getChar(int index) { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index); return a; } final public ByteBuffer putChar(int index, char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, index, value); return this; }; |
79 |
public ShortBuffer asShortBuffer() { return new MappedShortFileBuffer(ch); } public short getShort() { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putShort(short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, pos, value); pos += 1; return this; } public short getShort(int index) { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, index); return a; } public ByteBuffer putShort(int index, short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, index, value); return this; }; |
final public ShortBuffer asShortBuffer() { return new MappedShortFileBuffer(ch); } final public short getShort() { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putShort(short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, position(), value); position(position() + 1); return this; } final public short getShort(int index) { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, index); return a; } final public ByteBuffer putShort(int index, short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, index, value); return this; }; |
80 |
public IntBuffer asIntBuffer() { return new MappedIntFileBuffer(ch); } public int getInt() { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putInt(int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, pos, value); pos += 1; return this; } public int getInt(int index) { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, index); return a; } public ByteBuffer putInt(int index, int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, index, value); return this; }; |
final public IntBuffer asIntBuffer() { return new MappedIntFileBuffer(ch); } final public int getInt() { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putInt(int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, position(), value); position(position() + 1); return this; } final public int getInt(int index) { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, index); return a; } final public ByteBuffer putInt(int index, int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, index, value); return this; }; |
81 |
public LongBuffer asLongBuffer() { return new MappedLongFileBuffer(ch); } public long getLong() { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putLong(long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, pos, value); pos += 1; return this; } public long getLong(int index) { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, index); return a; } public ByteBuffer putLong(int index, long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, index, value); return this; }; |
final public LongBuffer asLongBuffer() { return new MappedLongFileBuffer(ch); } final public long getLong() { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putLong(long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, position(), value); position(position() + 1); return this; } final public long getLong(int index) { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, index); return a; } final public ByteBuffer putLong(int index, long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, index, value); return this; }; |
82 |
public FloatBuffer asFloatBuffer() { return new MappedFloatFileBuffer(ch); } public float getFloat() { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putFloat(float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, pos, value); pos += 1; return this; } public float getFloat(int index) { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, index); return a; } public ByteBuffer putFloat(int index, float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, index, value); return this; }; |
final public FloatBuffer asFloatBuffer() { return new MappedFloatFileBuffer(ch); } final public float getFloat() { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putFloat(float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, position(), value); position(position() + 1); return this; } final public float getFloat(int index) { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, index); return a; } final public ByteBuffer putFloat(int index, float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, index, value); return this; }; |
83 |
public DoubleBuffer asDoubleBuffer() { return new MappedDoubleFileBuffer(ch); } public double getDouble() { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, pos); pos += 1; return a; } public ByteBuffer putDouble(double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, pos, value); pos += 1; return this; } public double getDouble(int index) { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, index); return a; } public ByteBuffer putDouble(int index, double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, index, value); return this; }; |
final public DoubleBuffer asDoubleBuffer() { return new MappedDoubleFileBuffer(ch); } final public double getDouble() { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, position()); position(position() + 1); return a; } final public ByteBuffer putDouble(double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, position(), value); position(position() + 1); return this; } final public double getDouble(int index) { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, index); return a; } final public ByteBuffer putDouble(int index, double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, index, value); return this; }; |
84 |
} |
} |