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

16
LINES

< > BotCompany Repo | #1033633 // BitToByteOutputStream (use BitHead instead)

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

Libraryless. Click here for Pure Java version (9956L/55K).

srecord noeq BitToByteOutputStream(OutputStream out) > BitOutputStream {
  new BitBuffer buffer;
  
  void writeBit(bool b) {
    buffer.add(b);
    internalFlush();
  }
  
  void internalFlush ctex {
    while (buffer.hasFullByte())
      out.write(buffer.popFullByte());
  }
  

  // TODO: optimize void writeBits(int data, int nBits)
}

Author comment

Began life as a copy of #1033629

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033633
Snippet name: BitToByteOutputStream (use BitHead instead)
Eternal ID of this version: #1033633/4
Text MD5: 57096ec3e99a87a5fa266a5a48ab9305
Transpilation MD5: a16993cd2c30dd0c32f65f205418543b
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-01 03:45:50
Source code size: 353 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 90 / 161
Version history: 3 change(s)
Referenced in: [show references]