コード例 #1
0
 public override java.nio.LongBuffer put(long c)
 {
     if (_position == _limit)
     {
         throw new java.nio.BufferOverflowException();
     }
     byteBuffer.putLong(_position++ *libcore.io.SizeOf.LONG, c);
     return(this);
 }
コード例 #2
0
        /// <exception cref="System.IO.IOException"/>
        private void writeChunkHead(Chunk chunk)
        {
            long messageLength = chunk.getMessageLength();
            int  headLength    = messageLength > -1L ? ArangoDBConstants.CHUNK_MAX_HEADER_SIZE
                 : ArangoDBConstants.CHUNK_MIN_HEADER_SIZE;
            int length = chunk.getContentLength() + headLength;

            java.nio.ByteBuffer buffer = java.nio.ByteBuffer.allocate(headLength).order(java.nio.ByteOrder
                                                                                        .LITTLE_ENDIAN);
            buffer.putInt(length);
            buffer.putInt(chunk.getChunkX());
            buffer.putLong(chunk.getMessageId());
            if (messageLength > -1L)
            {
                buffer.putLong(messageLength);
            }
            this.outputStream.write((byte[])buffer.array());
        }
コード例 #3
0
        public void compressImage(java.awt.image.BufferedImage image, DXTCompressionAttributes attributes,
                                  java.nio.ByteBuffer buffer)
        {
            if (image == null)
            {
                String message = Logging.getMessage("nullValue.ImageIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (attributes == null)
            {
                String message = Logging.getMessage("nullValue.AttributesIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (buffer == null)
            {
                String message = Logging.getMessage("nullValue.BufferNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            ColorBlock4x4       colorBlock          = new ColorBlock4x4();
            ColorBlockExtractor colorBlockExtractor = this.getColorBlockExtractor(image);

            BlockDXT3           dxt3Block      = new BlockDXT3();
            BlockDXT3Compressor dxt3Compressor = new BlockDXT3Compressor();

            int width  = image.getWidth();
            int height = image.getHeight();

            for (int j = 0; j < height; j += 4)
            {
                for (int i = 0; i < width; i += 4)
                {
                    colorBlockExtractor.extractColorBlock4x4(attributes, i, j, colorBlock);
                    dxt3Compressor.compressBlockDXT3(colorBlock, attributes, dxt3Block);

                    AlphaBlockDXT3 dxtAlphaBlock = dxt3Block.getAlphaBlock();
                    buffer.putLong(dxtAlphaBlock.alphaValueMask);

                    BlockDXT1 dxtColorBlock = dxt3Block.getColorBlock();
                    buffer.putShort((short)dxtColorBlock.color0);
                    buffer.putShort((short)dxtColorBlock.color1);
                    buffer.putInt((int)dxtColorBlock.colorIndexMask);
                }
            }
        }