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

20
LINES

< > BotCompany Repo | #1033065 // JustCountingOutputStream

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

Libraryless. Click here for Pure Java version (46L/1K).

1  
sclass JustCountingOutputStream extends OutputStream {
2  
  long counter;
3  
  
4  
  @Override
5  
  public void write(int b) throws IOException {
6  
    ++counter;
7  
  }
8  
9  
  @Override
10  
  public void write(byte[] b) throws IOException {
11  
    counter += b.length;
12  
  }
13  
14  
  @Override
15  
  public void write(byte[] b, int off, int len) throws IOException {
16  
    counter += len;
17  
  }
18  
  
19  
  long getFilePointer aka get() { ret counter; }
20  
}

Author comment

Began life as a copy of #1029366

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033065
Snippet name: JustCountingOutputStream
Eternal ID of this version: #1033065/1
Text MD5: 5df1c485c0dabfd636867f9ef7272d25
Transpilation MD5: 82fac9195bf74d699322216a865ce86a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-12 22:36:14
Source code size: 424 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 157 / 265
Referenced in: [show references]