StaticConfig(final ID id, final boolean littleEndian, final int[] sizes, final int[] alignments) { this.id = id; int i=0, j=0; this.md = new MachineDescription(false, littleEndian, sizes[i++], sizes[i++], sizes[i++], sizes[i++], sizes[i++], sizes[i++], sizes[i++], alignments[j++], alignments[j++], alignments[j++], alignments[j++], alignments[j++], alignments[j++], alignments[j++], alignments[j++], alignments[j++], alignments[j++]); }
/** * Checks whether two size objects are equal. Two instances * of <code>MachineDescription</code> are considered equal if all components * match but {@link #runtimeValidated}, {@link #isRuntimeValidated()}. * @return <code>true</code> if the two MachineDescription are equal; * otherwise <code>false</code>. */ @Override public final boolean equals(final Object obj) { if (this == obj) { return true; } if ( !(obj instanceof MachineDescription) ) { return false; } final MachineDescription md = (MachineDescription) obj; return pageSizeInBytes == md.pageSizeInBytes && compatible(md); }
public StringBuilder toString(StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); } sb.append("MachineDescription: runtimeValidated ").append(isRuntimeValidated()).append(", littleEndian ").append(isLittleEndian()).append(", 32Bit ").append(is32Bit()).append(", primitive size / alignment:").append(PlatformPropsImpl.NEWLINE); sb.append(" int8 ").append(int8SizeInBytes) .append(" / ").append(int8AlignmentInBytes); sb.append(", int16 ").append(int16SizeInBytes) .append(" / ").append(int16AlignmentInBytes).append(Platform.getNewline()); sb.append(" int ").append(intSizeInBytes) .append(" / ").append(intAlignmentInBytes); sb.append(", long ").append(longSizeInBytes) .append(" / ").append(longAlignmentInBytes).append(Platform.getNewline()); sb.append(" int32 ").append(int32SizeInBytes) .append(" / ").append(int32AlignmentInBytes); sb.append(", int64 ").append(int64SizeInBytes) .append(" / ").append(int64AlignmentInBytes).append(Platform.getNewline()); sb.append(" float ").append(floatSizeInBytes) .append(" / ").append(floatAlignmentInBytes); sb.append(", double ").append(doubleSizeInBytes) .append(" / ").append(doubleAlignmentInBytes); sb.append(", ldouble ").append(ldoubleSizeInBytes).append(" / ").append(ldoubleAlignmentInBytes).append(Platform.getNewline()); sb.append(" pointer ").append(pointerSizeInBytes).append(" / ").append(pointerAlignmentInBytes); sb.append(", page ").append(pageSizeInBytes); return sb; }
ByteBuffer data = Buffers.newDirectByteBuffer( machine.pageAlignedSize( initialCapacity ) ); final byte[] chunk = new byte[machine.pageSizeInBytes()]; int chunk2Read = Math.min(machine.pageSizeInBytes(), avail); int numRead = 0; do { if (avail > data.remaining()) { final ByteBuffer newData = Buffers.newDirectByteBuffer( machine.pageAlignedSize(data.position() + avail) ); newData.put(data); data = newData; chunk2Read = Math.min(machine.pageSizeInBytes(), avail); } while ( numRead > 0 ); // EOS: -1 == numRead, EOF maybe reached earlier w/ 0 == numRead
/** Setter for native field: CType['int', size [fixed false, lnx64 4], [int]] */ public XVisualInfo setC_class(int val) { accessor.setIntAt(c_class_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes()); return this; }
/** Setter for native field: CType['VisualID' (typedef), size [fixed false, lnx64 8], [int]] */ public JAWT_X11DrawingSurfaceInfo setVisualID(long val) { accessor.setLongAt(visualID_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; }
/** * Copy the specified input stream to the specified output stream. The total * number of bytes written is returned. * * @param in the source * @param out the destination * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown * @return * @throws IOException */ public static int copyStream2Stream(final InputStream in, final OutputStream out, final int totalNumBytes) throws IOException { return copyStream2Stream(Platform.getMachineDescription().pageSizeInBytes(), in, out, totalNumBytes); }
/** * @return page aligned size in bytes */ public int pageAlignedSize(final int size) { return pageCount(size) * pageSizeInBytes; }
/** Setter for native field: CType['jint' (typedef), size [fixed false, lnx64 4], [int]] */ public JAWT_DrawingSurfaceInfo setClipSize(int val) { accessor.setIntAt(clipSize_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes()); return this; }
/** Setter for native field: CType['VisualID' (typedef), size [fixed false, lnx64 8], [int]] */ public XVisualInfo setVisualid(long val) { accessor.setLongAt(visualid_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; }
this.tElems=0; this.pageSize = Platform.getMachineDescription().pageSizeInBytes();
/** Setter for native field: CType['int', size [fixed false, lnx64 4], [int]] */ public DWM_BLURBEHIND setFTransitionOnMaximized(int val) { accessor.setIntAt(fTransitionOnMaximized_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes()); return this; }
/** Setter for native field: CType['long', size [fixed false, lnx64 8], [int]] */ public XVisualInfo setRed_mask(long val) { accessor.setLongAt(red_mask_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; }
private static MachineDescription getRuntimeImpl() { try { Platform.initSingleton(); // loads native gluegen-rt library } catch (final UnsatisfiedLinkError err) { return null; } final int pointerSizeInBytes = getPointerSizeInBytesImpl(); switch(pointerSizeInBytes) { case 4: case 8: break; default: throw new RuntimeException("Unsupported pointer size "+pointerSizeInBytes+"bytes, please implement."); } final long pageSizeL = getPageSizeInBytesImpl(); if(Integer.MAX_VALUE < pageSizeL) { throw new InternalError("PageSize exceeds integer value: " + pageSizeL); } // size: int, long, float, double, pointer, pageSize // alignment: int8, int16, int32, int64, int, long, float, double, pointer return new MachineDescription( true /* runtime validated */, PlatformPropsImpl.LITTLE_ENDIAN, getSizeOfIntImpl(), getSizeOfLongImpl(), getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(), pointerSizeInBytes, (int)pageSizeL, getAlignmentInt8Impl(), getAlignmentInt16Impl(), getAlignmentInt32Impl(), getAlignmentInt64Impl(), getAlignmentIntImpl(), getAlignmentLongImpl(), getAlignmentFloatImpl(), getAlignmentDoubleImpl(), getAlignmentLongDoubleImpl(), getAlignmentPointerImpl()); }
/** Setter for native field: CType['jint' (typedef), size [fixed false, lnx64 4], [int]] */ public JAWT_Rectangle setX(int val) { accessor.setIntAt(x_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes()); return this; }
/** Setter for native field: CType['long', size [fixed false, lnx64 8], [int]] */ public XVisualInfo setGreen_mask(long val) { accessor.setLongAt(green_mask_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; }
/** Setter for native field: CType['int', size [fixed false, lnx64 4], [int]] */ public XRenderPictFormat setDepth(int val) { accessor.setIntAt(depth_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes()); return this; }
/** Setter for native field: CType['long', size [fixed false, lnx64 8], [int]] */ public XVisualInfo setBlue_mask(long val) { accessor.setLongAt(blue_mask_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; }
/** Setter for native field: CType['int', size [fixed false, lnx64 4], [int]] */ public XVisualInfo setScreen(int val) { accessor.setIntAt(screen_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes()); return this; }
/** Getter for native field: CType['VisualID' (typedef), size [fixed false, lnx64 8], [int]] */ public long getVisualid() { return accessor.getLongAt(visualid_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); }