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

sclass JustCountingOutputStream extends OutputStream {
  long counter;
  
  @Override
  public void write(int b) throws IOException {
    ++counter;
  }

  @Override
  public void write(byte[] b) throws IOException {
    counter += b.length;
  }

  @Override
  public void write(byte[] b, int off, int len) throws IOException {
    counter += len;
  }
  
  long getFilePointer aka get() { ret counter; }
}

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: 3 / 21
Referenced in: [show references]