List of usage examples for java.nio ByteBuffer allocate
public static ByteBuffer allocate(int capacity)
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putShort((short) 123); System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putShort(2, (short) 123); System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putFloat(2, 123F);/*from www .ja v a2 s .c o m*/ System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putFloat(123F);/* w ww .j a v a 2 s . com*/ System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer buf = ByteBuffer.allocate(15); DoubleBuffer dbuf = buf.asDoubleBuffer(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putChar(5, 'a'); System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putInt(2, 123);/*from w w w. j a v a 2 s .com*/ System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putDouble(123);//from w ww . ja v a2 s . c o m System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putDouble(2, 123);//from ww w.ja v a 2 s. co m System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.putLong(123);/*from w w w . j a v a 2 s . co m*/ System.out.println(Arrays.toString(bbuf.array())); }