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

25
LINES

< > BotCompany Repo | #1032127 // doPostBinaryToFile

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

Libraryless. Click here for Pure Java version (3893L/22K).

1  
svoid doPostBinaryToFile(Map urlParameters, S url, File file) {
2  
  doPostBinaryToFile(makePostData(urlParameters), url, file);
3  
}
4  
5  
svoid doPostBinaryToFile(S urlParameters, S url, File file) ctex {
6  
  URL _url = new URL(url);
7  
  ping();
8  
  doPostBinaryToFile(urlParameters, _url.openConnection(), file);
9  
}
10  
11  
svoid doPostBinaryToFile(String urlParameters, URLConnection conn, File file) throws IOException {
12  
  // connect and do POST
13  
  setHeaders(conn);
14  
  conn.setDoOutput(true);
15  
16  
  OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
17  
  writer.write(urlParameters);
18  
  writer.flush();
19  
20  
  try {
21  
    loadBinaryPageToFile_noHeaders(conn, file);
22  
  } finally {
23  
    writer.close();
24  
  }
25  
}

Author comment

Began life as a copy of #1005869

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1032127
Snippet name: doPostBinaryToFile
Eternal ID of this version: #1032127/3
Text MD5: 259df1bd73d4b97cf89d4bfb02c11dc8
Transpilation MD5: ee1db5ae9adcd366ae20a803a65a5e75
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-14 03:44:05
Source code size: 720 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 170 / 254
Version history: 2 change(s)
Referenced in: [show references]