private static byte[] createEmptyBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); os.writeInt(0); os.writeLong(0l); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create empty batch control record header.", e); } }
public synchronized byte[] getEncodedXidBytes() { if (encodedXidBytes == null) { outputStream = new DataByteArrayOutputStream(XID_PREFIX_SIZE + globalTransactionId.length + branchQualifier.length); outputStream.position(10); outputStream.writeInt(formatId); // global length outputStream.writeShort(globalTransactionId.length); try { outputStream.write(globalTransactionId); outputStream.write(branchQualifier); } catch (IOException fatal) { throw new RuntimeException(this + ", failed to encode:", fatal); } encodedXidBytes = outputStream.getData(); } return encodedXidBytes; }
private static byte[] createBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create batch control record header.", e); } }
private static byte[] createEmptyBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); os.writeInt(0); os.writeLong(0l); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create empty batch control record header.", e); } }
private static byte[] createBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create batch control record header.", e); } }
public synchronized byte[] getEncodedXidBytes() { if (encodedXidBytes == null) { outputStream = new DataByteArrayOutputStream(XID_PREFIX_SIZE + globalTransactionId.length + branchQualifier.length); outputStream.position(10); outputStream.writeInt(formatId); // global length outputStream.writeShort(globalTransactionId.length); try { outputStream.write(globalTransactionId); outputStream.write(branchQualifier); } catch (IOException fatal) { throw new RuntimeException(this + ", failed to encode:", fatal); } encodedXidBytes = outputStream.getData(); } return encodedXidBytes; }
public void writeBytes(String s) { int length = s.length(); for (int i = 0; i < length; i++) { write((byte)s.charAt(i)); } }
private static byte[] createEmptyBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); os.writeInt(0); os.writeLong(0l); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create empty batch control record header.", e); } }
private static byte[] createBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create batch control record header.", e); } }
private static byte[] createEmptyBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); os.writeInt(0); os.writeLong(0l); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create empty batch control record header.", e); } }
private static byte[] createBatchControlRecordHeader() { try (DataByteArrayOutputStream os = new DataByteArrayOutputStream();) { os.writeInt(BATCH_CONTROL_RECORD_SIZE); os.writeByte(BATCH_CONTROL_RECORD_TYPE); os.write(BATCH_CONTROL_RECORD_MAGIC); ByteSequence sequence = os.toByteSequence(); sequence.compact(); return sequence.getData(); } catch (IOException e) { throw new RuntimeException("Could not create batch control record header.", e); } }
public void writeBytes(String s) { int length = s.length(); for (int i = 0; i < length; i++) { write((byte)s.charAt(i)); } }
public void writeBytes(String s) { int length = s.length(); for (int i = 0; i < length; i++) { write((byte)s.charAt(i)); } }
public void writeBytes(String s) { int length = s.length(); for (int i = 0; i < length; i++) { write((byte)s.charAt(i)); } }
public void writeBytes(String s) { int length = s.length(); for (int i = 0; i < length; i++) { write((byte)s.charAt(i)); } }