Libraryless. Click here for Pure Java version (4695L/26K).
1 | sclass PrintingBitOutputStream > BitOutputStream { |
2 | void writeBit(bool b) { |
3 | print(b ? 1 : 0); |
4 | } |
5 | |
6 | // little-endian (starts with lowest bit) |
7 | void writeBits(int data, int nBits) { |
8 | print("[" + n2_lpad(3, nBits) + "] " + littleEndianBitsToString(data, nBits)); |
9 | } |
10 | } |
Began life as a copy of #1033627
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033629 |
Snippet name: | PrintingBitOutputStream |
Eternal ID of this version: | #1033629/1 |
Text MD5: | 6bf1a471d6e31d86f59cab508807ad52 |
Transpilation MD5: | cdc2e259dfd2b8d700dd8bb1f406bf01 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-12-22 14:37:02 |
Source code size: | 287 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 147 / 227 |
Referenced in: | [show references] |