protected void sendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) throws IOException { byte[] data = writeBuffer.toByteArray(); sendWriteBuffer(commandId, address, data, false); }
protected byte[] decompress(ByteSequence dataSequence) throws IOException { Inflater inflater = new Inflater(); ByteArrayOutputStream decompressed = new ByteArrayOutputStream(); try { length = ByteSequenceData.readIntBig(dataSequence); dataSequence.offset = 0; byte[] data = Arrays.copyOfRange(dataSequence.getData(), 4, dataSequence.getLength()); inflater.setInput(data); byte[] buffer = new byte[length]; int count = inflater.inflate(buffer); decompressed.write(buffer, 0, count); return decompressed.toByteArray(); } catch (Exception e) { throw new IOException(e); } finally { inflater.end(); decompressed.close(); } }
@Override public byte[] doGetMessage(TransactionContext c, MessageId id) throws SQLException, IOException { PreparedStatement s = null; ResultSet rs = null; try { s = c.getConnection().prepareStatement(statements.getFindMessageStatement()); s.setString(1, id.getProducerId().toString()); s.setLong(2, id.getProducerSequenceId()); rs = s.executeQuery(); if (!rs.next()) { return null; } Blob blob = rs.getBlob(1); try(InputStream is = blob.getBinaryStream(); ByteArrayOutputStream os = new ByteArrayOutputStream((int)blob.length())) { int ch; while ((ch = is.read()) >= 0) { os.write(ch); } return os.toByteArray(); } } finally { close(rs); close(s); } }
byte[] data = largeBuffer.toByteArray(); int size = data.length;
} else { byte[] data = writeBuffer.toByteArray(); boolean lastFragment = false; int length = data.length;
cacheEntries.put(signalId, new AtomicCacheEntry<>(signalId, new String(bos.toByteArray(), StandardCharsets.UTF_8), 0L));
protected void sendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) throws IOException { byte[] data = writeBuffer.toByteArray(); sendWriteBuffer(commandId, address, data, false); }
private static byte[] getSerializedBytes(Serializable value) throws IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(value); oos.flush(); oos.close(); return baos.toByteArray(); } }
private static byte[] getSerializedBytes(Serializable value) throws IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(value); oos.flush(); oos.close(); return baos.toByteArray(); } }
protected void sendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) throws IOException { byte[] data = writeBuffer.toByteArray(); sendWriteBuffer(commandId, address, data, false); }
protected void sendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) throws IOException { byte[] data = writeBuffer.toByteArray(); sendWriteBuffer(commandId, address, data, false); }
protected void sendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) throws IOException { byte[] data = writeBuffer.toByteArray(); sendWriteBuffer(commandId, address, data, false); }
protected void processCommand() throws Exception { StompFrame frame = new StompFrame(action, headers, currentCommand.toByteArray()); transport.doConsume(frame); processedHeaders = false; awaitingCommandStart = true; currentCommand.reset(); contentLength = -1; frameSize.set(0); }
protected void processCommand() throws Exception { StompFrame frame = new StompFrame(action, headers, currentCommand.toByteArray()); transport.doConsume(frame); processedHeaders = false; awaitingCommandStart = true; currentCommand.reset(); contentLength = -1; frameSize.set(0); }
protected void processCommand() throws Exception { StompFrame frame = new StompFrame(action, headers, currentCommand.toByteArray()); transport.doConsume(frame); processedHeaders = false; awaitingCommandStart = true; currentCommand.reset(); contentLength = -1; frameSize.set(0); }
protected byte[] decompress(ByteSequence dataSequence) throws IOException { Inflater inflater = new Inflater(); ByteArrayOutputStream decompressed = new ByteArrayOutputStream(); try { length = ByteSequenceData.readIntBig(dataSequence); dataSequence.offset = 0; byte[] data = Arrays.copyOfRange(dataSequence.getData(), 4, dataSequence.getLength()); inflater.setInput(data); byte[] buffer = new byte[length]; int count = inflater.inflate(buffer); decompressed.write(buffer, 0, count); return decompressed.toByteArray(); } catch (Exception e) { throw new IOException(e); } finally { inflater.end(); decompressed.close(); } }
protected byte[] decompress(ByteSequence dataSequence) throws IOException { Inflater inflater = new Inflater(); ByteArrayOutputStream decompressed = new ByteArrayOutputStream(); try { length = ByteSequenceData.readIntBig(dataSequence); dataSequence.offset = 0; byte[] data = Arrays.copyOfRange(dataSequence.getData(), 4, dataSequence.getLength()); inflater.setInput(data); byte[] buffer = new byte[length]; int count = inflater.inflate(buffer); decompressed.write(buffer, 0, count); return decompressed.toByteArray(); } catch (Exception e) { throw new IOException(e); } finally { inflater.end(); decompressed.close(); } }
protected void processCommand() throws Exception { StompFrame frame = new StompFrame(action, headers, currentCommand.toByteArray()); writeStream.consume(frame); processedHeaders = false; awaitingCommandStart = true; currentCommand.reset(); contentLength = -1; } }
protected void processCommand() throws Exception { StompFrame frame = new StompFrame(action, headers, currentCommand.toByteArray()); writeStream.consume(frame); processedHeaders = false; awaitingCommandStart = true; currentCommand.reset(); contentLength = -1; } }
private void processCommand() throws Exception { StompFrame frame = new StompFrame(action, headers, currentCommand.toByteArray()); doConsume(frame); processedHeaders = false; currentCommand.reset(); contentLength = -1; }