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).

1  
srecord noeq BitToByteOutputStream(OutputStream out) > BitOutputStream {
2  
  new BitBuffer buffer;
3  
  
4  
  void writeBit(bool b) {
5  
    buffer.add(b);
6  
    internalFlush();
7  
  }
8  
  
9  
  void internalFlush ctex {
10  
    while (buffer.hasFullByte())
11  
      out.write(buffer.popFullByte());
12  
  }
13  
  
14  
15  
  // TODO: optimize void writeBits(int data, int nBits)
16  
}

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: 183 / 277
Version history: 3 change(s)
Referenced in: [show references]