List of usage examples for java.nio ByteOrder BIG_ENDIAN
ByteOrder BIG_ENDIAN
To view the source code for java.nio ByteOrder BIG_ENDIAN.
Click Source Link
From source file:Main.java
public static AdvertiseData createAllOffAdvertiseData() { byte[] manufacturerData = new byte[23]; ByteBuffer bb = ByteBuffer.wrap(manufacturerData); bb.order(ByteOrder.BIG_ENDIAN); bb.put((byte) 0x41); bb.put((byte) 0x6c); bb.put((byte) 0x6c); bb.put((byte) 0x4f); bb.put((byte) 0x66); bb.put((byte) 0x66); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); AdvertiseData.Builder builder = new AdvertiseData.Builder(); builder.addManufacturerData(0x006d, manufacturerData); AdvertiseData adv = builder.build(); return adv;//from w w w . j a v a 2 s . co m }
From source file:Main.java
/** create AdvertiseDate for iBeacon */ public static AdvertiseData createEmployeeIDAdvertiseData(byte[] data, int length) { byte[] manufacturerData = new byte[23]; ByteBuffer bb = ByteBuffer.wrap(manufacturerData); bb.order(ByteOrder.BIG_ENDIAN); bb.put((byte) 0x4d); bb.put((byte) 0x44); bb.put((byte) 0x43); bb.put(data);//from www . ja va2s . com for (int i = 0; i < length; i++) { bb.put((byte) 0x00); } AdvertiseData.Builder builder = new AdvertiseData.Builder(); builder.addManufacturerData(0x006d, manufacturerData); AdvertiseData adv = builder.build(); return adv; }
From source file:Main.java
/** create AdvertiseDate for iBeacon */ public static AdvertiseData createAllOnAdvertiseData() { byte[] manufacturerData = new byte[23]; ByteBuffer bb = ByteBuffer.wrap(manufacturerData); bb.order(ByteOrder.BIG_ENDIAN); bb.put((byte) 0x41); bb.put((byte) 0x6c); bb.put((byte) 0x6c); bb.put((byte) 0x4f); bb.put((byte) 0x6e); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); AdvertiseData.Builder builder = new AdvertiseData.Builder(); builder.addManufacturerData(0x006d, manufacturerData); AdvertiseData adv = builder.build(); return adv;//from w ww . j a v a 2s .c o m }
From source file:Main.java
/** create AdvertiseDate for iBeacon */ public static AdvertiseData createLightOnAdvertiseData() { byte[] manufacturerData = new byte[23]; ByteBuffer bb = ByteBuffer.wrap(manufacturerData); bb.order(ByteOrder.BIG_ENDIAN); bb.put((byte) 0x4c); bb.put((byte) 0x69); bb.put((byte) 0x67); bb.put((byte) 0x68); bb.put((byte) 0x74); bb.put((byte) 0x4f); bb.put((byte) 0x6e); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); bb.put((byte) 0x00); AdvertiseData.Builder builder = new AdvertiseData.Builder(); builder.addManufacturerData(0x006d, manufacturerData); AdvertiseData adv = builder.build(); return adv;// w w w. j av a2 s . c om }
From source file:Main.java
public static long Uint64FromBuffer(byte[] buffer, int offset) { ByteBuffer bb = ByteBuffer.wrap(buffer, offset, 8); bb.order(ByteOrder.BIG_ENDIAN); long result = bb.getLong(); return result; }
From source file:Main.java
public static boolean testCPU() { if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { return true; } else {//from w ww. j a va 2s. com return false; } }
From source file:Main.java
/** * Finds next Nth MPEG bitstream marker 0x000001xx and returns the data that * preceeds it as a ByteBuffer slice//www.java 2s . co m * * Segment byte order is always little endian * * @param buf * @return */ public static final ByteBuffer gotoMarker(ByteBuffer buf, int n, int mmin, int mmax) { if (!buf.hasRemaining()) return null; int from = buf.position(); ByteBuffer result = buf.slice(); result.order(ByteOrder.BIG_ENDIAN); int val = 0xffffffff; while (buf.hasRemaining()) { val = (val << 8) | (buf.get() & 0xff); if (val >= mmin && val <= mmax) { if (n == 0) { buf.position(buf.position() - 4); result.limit(buf.position() - from); break; } --n; } } return result; }
From source file:Main.java
public static boolean AV_HAVE_BIGENDIAN() { return ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; }
From source file:io.druid.segment.data.CompressedIntsIndexedWriterTest.java
@Parameterized.Parameters(name = "{index}: compression={0}, byteOrder={1}") public static Iterable<Object[]> compressionStrategiesAndByteOrders() { Set<List<Object>> combinations = Sets.cartesianProduct( Sets.newHashSet(CompressedObjectStrategy.CompressionStrategy.noNoneValues()), Sets.newHashSet(ByteOrder.BIG_ENDIAN, ByteOrder.LITTLE_ENDIAN)); return Iterables.transform(combinations, new Function<List, Object[]>() { @Override// ww w .jav a2s . c om public Object[] apply(List input) { return new Object[] { input.get(0), input.get(1) }; } }); }
From source file:interactivespaces.service.comm.network.server.internal.netty.NettyUdpServerNetworkCommunicationEndpointService.java
@Override public UdpServerNetworkCommunicationEndpoint newServer(int serverPort, Log log) { return newServer(serverPort, ByteOrder.BIG_ENDIAN, log); }