public static void writeRawFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToRawIntBits(v)); }
public static void writeFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToIntBits(v)); }
@Override protected void doCompress() throws IOException { compressed = true; ByteSequence bytes = getContent(); if (bytes != null) { int length = bytes.getLength(); ByteArrayOutputStream compressed = new ByteArrayOutputStream(); compressed.write(new byte[4]); Deflater deflater = new Deflater(); try { deflater.setInput(bytes.data); deflater.finish(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int count = deflater.deflate(buffer); compressed.write(buffer, 0, count); } bytes = compressed.toByteSequence(); ByteSequenceData.writeIntBig(bytes, length); bytes.offset = 0; setContent(bytes); } finally { deflater.end(); compressed.close(); } } } }
size = sequence.getLength() - 4; int pos = sequence.offset; ByteSequenceData.writeIntBig(sequence, size); sequence.offset = pos;
public static void writeFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToIntBits(v)); }
public static void writeRawFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToRawIntBits(v)); }
public static void writeFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToIntBits(v)); }
public static void writeRawFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToRawIntBits(v)); }
public static void writeRawFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToRawIntBits(v)); }
public static void writeFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToIntBits(v)); }
public static void writeFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToIntBits(v)); }
public static void writeRawFloatBig(ByteSequence packet, float v) throws IOException { writeIntBig(packet, Float.floatToRawIntBits(v)); }
private void storeContent() { try { if (dataOut != null) { dataOut.close(); ByteSequence bs = bytesOut.toByteSequence(); if (compressed) { int pos = bs.offset; ByteSequenceData.writeIntBig(bs, length); bs.offset = pos; } setContent(bs); bytesOut = null; dataOut = null; } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); // TODO verify // RuntimeException } }
private static byte[] toAMQMessageCompressedBytesType(final byte[] bytes) throws IOException { int length = bytes.length; Deflater deflater = new Deflater(); try (org.apache.activemq.util.ByteArrayOutputStream compressed = new org.apache.activemq.util.ByteArrayOutputStream()) { compressed.write(new byte[4]); deflater.setInput(bytes); deflater.finish(); byte[] bytesBuf = new byte[1024]; while (!deflater.finished()) { int count = deflater.deflate(bytesBuf); compressed.write(bytesBuf, 0, count); } compressed.flush(); ByteSequence byteSeq = compressed.toByteSequence(); ByteSequenceData.writeIntBig(byteSeq, length); return Arrays.copyOfRange(byteSeq.data, 0, byteSeq.length); } finally { deflater.end(); } }
@Override protected void doCompress() throws IOException { compressed = true; ByteSequence bytes = getContent(); if (bytes != null) { int length = bytes.getLength(); ByteArrayOutputStream compressed = new ByteArrayOutputStream(); compressed.write(new byte[4]); Deflater deflater = new Deflater(); try { deflater.setInput(bytes.data); deflater.finish(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int count = deflater.deflate(buffer); compressed.write(buffer, 0, count); } bytes = compressed.toByteSequence(); ByteSequenceData.writeIntBig(bytes, length); bytes.offset = 0; setContent(bytes); } finally { deflater.end(); compressed.close(); } } } }
@Override protected void doCompress() throws IOException { compressed = true; ByteSequence bytes = getContent(); if (bytes != null) { int length = bytes.getLength(); ByteArrayOutputStream compressed = new ByteArrayOutputStream(); compressed.write(new byte[4]); Deflater deflater = new Deflater(); try { deflater.setInput(bytes.data); deflater.finish(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int count = deflater.deflate(buffer); compressed.write(buffer, 0, count); } bytes = compressed.toByteSequence(); ByteSequenceData.writeIntBig(bytes, length); bytes.offset = 0; setContent(bytes); } finally { deflater.end(); compressed.close(); } } } }
@Override protected void doCompress() throws IOException { compressed = true; ByteSequence bytes = getContent(); if (bytes != null) { int length = bytes.getLength(); ByteArrayOutputStream compressed = new ByteArrayOutputStream(); compressed.write(new byte[4]); Deflater deflater = new Deflater(); try { deflater.setInput(bytes.data); deflater.finish(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int count = deflater.deflate(buffer); compressed.write(buffer, 0, count); } bytes = compressed.toByteSequence(); ByteSequenceData.writeIntBig(bytes, length); bytes.offset = 0; setContent(bytes); } finally { deflater.end(); compressed.close(); } } } }
size = sequence.getLength() - 4; int pos = sequence.offset; ByteSequenceData.writeIntBig(sequence, size); sequence.offset = pos;
size = sequence.getLength() - 4; int pos = sequence.offset; ByteSequenceData.writeIntBig(sequence, size); sequence.offset = pos;
size = sequence.getLength() - 4; int pos = sequence.offset; ByteSequenceData.writeIntBig(sequence, size); sequence.offset = pos;