1 | import java.nio.channels.FileChannel; |
2 | |
3 | svoid truncateFile(S path, long size) { |
4 | truncateFile(newFile(path), size); |
5 | } |
6 | |
7 | svoid truncateFile(File f, long size) ctex { |
8 | FileChannel outChan = newFileOutputStream(f, true).getChannel(); |
9 | try { |
10 | outChan.truncate(size); |
11 | } finally { |
12 | outChan.close(); |
13 | } |
14 | } |
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020611 |
Snippet name: | truncateFile (also creates file) |
Eternal ID of this version: | #1020611/5 |
Text MD5: | ae9d85e4385e53a88f6694c5632a562c |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-03 19:01:24 |
Source code size: | 320 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 307 / 355 |
Version history: | 4 change(s) |
Referenced in: | [show references] |