Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1033629 // PrintingBitOutputStream

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4695L/26K).

sclass PrintingBitOutputStream > BitOutputStream {
  void writeBit(bool b) {
    print(b ? 1 : 0);
  }
  
  // little-endian (starts with lowest bit)
  void writeBits(int data, int nBits) {
    print("[" + n2_lpad(3, nBits) + "] " + littleEndianBitsToString(data, nBits));
  }
}

Author comment

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: 146 / 224
Referenced in: #1033633 - BitToByteOutputStream (use BitHead instead)
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)