• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PlatformAddress类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.harmony.luni.platform.PlatformAddress的典型用法代码示例。如果您正苦于以下问题:Java PlatformAddress类的具体用法?Java PlatformAddress怎么用?Java PlatformAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlatformAddress类属于org.apache.harmony.luni.platform包,在下文中一共展示了PlatformAddress类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: mapImpl

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
protected final MappedByteBuffer mapImpl(int mapMode, long position,
        long size) throws IOException {
    if (position + size > size()) {
        fileSystem.truncate(handle, position + size);
    }
    long alignment = position - position % ALLOC_GRANULARITY;
    int offset = (int) (position - alignment);
    PlatformAddress address = PlatformAddressFactory.allocMap(handle,
            alignment, size + offset, mapMode);
    MappedByteBuffer buffer = null;
    try {
        buffer = MappedByteBufferFactory.getBuffer(address, mapMode, size,
                offset);
    } catch (Exception e) {
        throw new IOException(e.getMessage());
    }
    return buffer;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:FileChannelImpl.java


示例2: getBuffer

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
static MappedByteBuffer getBuffer(PlatformAddress addr, int mapmode,
                                  long size, int offset) throws Exception {
    /*
     * Spec points out explicitly that the size of map should be no greater
     * than Integer.MAX_VALUE, so long to int cast is safe here.
     */
    switch (mapmode) {
        case IMemorySystem.MMAP_READ_ONLY:
            return (MappedByteBuffer) readOnlyConstructor.newInstance(new Object[] { addr,
                                                                     Integer.valueOf((int)size), Integer.valueOf(offset),
                                                                     Integer.valueOf(mapmode) });
        case IMemorySystem.MMAP_READ_WRITE:
        case IMemorySystem.MMAP_WRITE_COPY:
            return (MappedByteBuffer) readWriteConstructor.newInstance(new Object[] { addr,
                                                                     Integer.valueOf((int)size), Integer.valueOf(offset),
                                                                     Integer.valueOf(mapmode) });
        default:
            throw new IllegalArgumentException();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:MappedByteBufferFactory.java


示例3: MappedByteBuffer

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
MappedByteBuffer(PlatformAddress addr, int capa, int offset, int mode) {
    super(capa);
    mapMode = mode;
    switch (mapMode) {
    case IMemorySystem.MMAP_READ_ONLY:
        wrapped = new ReadOnlyDirectByteBuffer(addr, capa, offset);
        break;
    case IMemorySystem.MMAP_READ_WRITE:
    case IMemorySystem.MMAP_WRITE_COPY:
        wrapped = new ReadWriteDirectByteBuffer(addr, capa, offset);
        break;
    default:
        throw new IllegalArgumentException();
    }
    addr.autoFree();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:MappedByteBuffer.java


示例4: mapImpl

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
protected final MappedByteBuffer mapImpl(int mapMode, long position,
           long size) throws IOException {
       if (position + size > size()) {
           fileSystem.truncate(handle, position + size);
       }
       long alignment = position - position % ALLOC_GRANULARITY;
       int offset = (int) (position - alignment);
       PlatformAddress address = PlatformAddressFactory.allocMap(handle, alignment, size
               + offset, mapMode);
       MappedByteBuffer buffer = null;
       try {
           buffer = MappedByteBufferFactory.getBuffer(address, mapMode, size,
                   offset);
       } catch (Exception e) {
           throw new IOException(e.getMessage());
       }
       return buffer;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:19,代码来源:FileChannelImpl.java


示例5: MappedByteBuffer

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
MappedByteBuffer(PlatformAddress addr, int capacity, int offset, MapMode mapMode) {
    super(capacity);
    this.mapMode = mapMode;
    if (mapMode == MapMode.READ_ONLY) {
        wrapped = new ReadOnlyDirectByteBuffer(addr, capacity, offset);
    } else {
        wrapped = new ReadWriteDirectByteBuffer(addr, capacity, offset);
    }
    addr.autoFree();
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:11,代码来源:MappedByteBuffer.java


示例6: compact

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
@Override
public ByteBuffer compact() {
    PlatformAddress effectiveAddress = getEffectiveAddress();
    effectiveAddress.offsetBytes(position).moveTo(effectiveAddress, remaining());
    position = limit - position;
    limit = capacity;
    mark = UNSET_MARK;
    return this;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:ReadWriteDirectByteBuffer.java


示例7: getEffectiveAddress

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public PlatformAddress getEffectiveAddress() {
    if (byteBuffer instanceof DirectBuffer) {
        // BEGIN android-changed
        PlatformAddress addr = ((DirectBuffer)byteBuffer).getEffectiveAddress();
        effectiveDirectAddress = addr.toInt();
        return addr;
        // END android-changed
    }
    assert false : byteBuffer;
    return null;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:IntToByteBufferAdapter.java


示例8: getBaseAddress

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public PlatformAddress getBaseAddress() {
    if (byteBuffer instanceof DirectBuffer) {
        return ((DirectBuffer) byteBuffer).getBaseAddress();
    }
    assert false : byteBuffer;
    return null;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:8,代码来源:IntToByteBufferAdapter.java


示例9: DirectByteBuffer

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
DirectByteBuffer(SafeAddress address, int capacity, int offset) {
    super(capacity);

    // BEGIN android-added
    PlatformAddress baseAddress = address.address;
    long baseSize = baseAddress.getSize();

    if ((baseSize >= 0) && ((offset + capacity) > baseSize)) {
        throw new IllegalArgumentException("slice out of range");
    }
    // END android-added

    this.safeAddress = address;
    this.offset = offset;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:16,代码来源:DirectByteBuffer.java


示例10: getEffectiveAddress

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public PlatformAddress getEffectiveAddress() {
    // BEGIN android-changed
    PlatformAddress addr = ((DirectBuffer) this.wrapped).getEffectiveAddress();
    effectiveDirectAddress = addr.toInt();
    return addr;
    // END android-changed
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:8,代码来源:MappedByteBufferAdapter.java


示例11: mapImpl

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
protected final MappedByteBuffer mapImpl(MapMode mapMode, long position, long size)
        throws IOException {
    if (position + size > size()) {
        fileSystem.truncate(handle, position + size);
    }
    long alignment = position - position % ALLOC_GRANULARITY;
    int offset = (int) (position - alignment);
    PlatformAddress address = PlatformAddressFactory.allocMap(handle,
            alignment, size + offset, mapMode);
    return new MappedByteBufferAdapter(address, (int) size, offset, mapMode);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:FileChannelImpl.java


示例12: compact

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
@Override
public ByteBuffer compact() {
    PlatformAddress effectiveAddress = getEffectiveAddress();
    effectiveAddress.offsetBytes(position).moveTo(effectiveAddress,
            remaining());
    position = limit - position;
    limit = capacity;
    mark = UNSET_MARK;
    return this;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:ReadWriteDirectByteBuffer.java


示例13: getEffectiveAddress

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public PlatformAddress getEffectiveAddress() {
    if (byteBuffer instanceof DirectBuffer) {
        return ((DirectBuffer) byteBuffer).getEffectiveAddress();
    }
    assert false : byteBuffer;
    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:IntToByteBufferAdapter.java


示例14: run

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public Constructor<?> run() {
    try {
        Class<?> wrapperClazz = ClassLoader
                .getSystemClassLoader().loadClass(
                        "java.nio.ReadOnlyDirectByteBuffer"); //$NON-NLS-1$
        Constructor<?> result = wrapperClazz
                .getDeclaredConstructor(new Class[] {
                        PlatformAddress.class, int.class,
                        int.class, int.class });
        result.setAccessible(true);
        return result;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:MappedByteBufferFactory.java


示例15: compact

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public ByteBuffer compact() {
	PlatformAddress effectiveAddress = getEffectiveAddress();
	effectiveAddress.offsetBytes(position).moveTo(effectiveAddress,
			remaining());
	position = limit - position;
	limit = capacity;
	mark = UNSET_MARK;
	return this;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:10,代码来源:ReadWriteDirectByteBuffer.java


示例16: getEffectiveAddress

import org.apache.harmony.luni.platform.PlatformAddress; //导入依赖的package包/类
public PlatformAddress getEffectiveAddress() {
    if (byteBuffer instanceof DirectBuffer) {
        return ((DirectBuffer)byteBuffer).getEffectiveAddress();
    } else {
        assert false : byteBuffer;
        return null;
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:9,代码来源:IntToByteBufferAdapter.java



注:本文中的org.apache.harmony.luni.platform.PlatformAddress类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RelationshipIndex类代码示例发布时间:2022-05-22
下一篇:
Java CompressionMethod类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap