file « connection « Java Network Q&A

Home
Java Network Q&A
1.API
2.bluetooth
3.Client
4.connection
5.Cookie
6.Development
7.Email
8.File
9.ftp
10.http
11.HttpClient
12.https
13.ip
14.Network
15.OS
16.RMI
17.Security
18.Server
19.Socket
20.tcp
21.UDP
22.url
Java Network Q&A » connection » file 

1. Java URLConnection : how could I find out a file's size?    stackoverflow.com

I'm working on a project for school , and I'm implementing a tool which can be used to download files from the web ( with a throttling option ) . The ...

2. Unexpected result from HttpURLConnection - reading remote binary file    stackoverflow.com

I'm trying to read a remote binary file (say, image) from internet like this:

HttpURLConnection connection = (HttpURLConnection) myUrl.openConnection(); //myUrl - URL object pointing for some location
if(connection.getResponseCode() == 200){
    ...

3. Disconnect URL connection based on file size or time - Java    stackoverflow.com

We have a requirement to download multiple documents, zip them and allow user to download zip file. The documents are downloaded sequentially and the number of documents can be upto 30 ...

4. Java Sockets - Files transfered simulatanously with other data over one connection    stackoverflow.com

I have a multi-threaded server that handles client requests, and makes new threads for each one that is connected. This is working great and I am able to send "text" messages ...

5. Reading binary file from URLConnection    stackoverflow.com

I'm trying to read a binary file from a URLConnection. When I test it with a text file it seems to work fine but for binary files it doesn't. I'm using ...

6. Unexpected end of file from server    stackoverflow.com

Here is my code

invoke(String url){
HttpURLConnection urlCon = null;
urlCon = (HttpURLConnection) new URL(url).openConnection();
urlCon.connect();
return urlCon.getResponseCode();
}
**"Unexpected end of file from server"**
I got error message like this when i try to pass the url ...

7. Java urlConnection, saving audio file to server?    stackoverflow.com

I've seen examples with text files but is saving an audio file directly to a server done the same way with URLConnection?

8. How do I download part of a file using Java?    stackoverflow.com

I'm using this Java code to download a file from the Internet:

String address = "http://melody.syr.edu/pzhang/publications/AMCIS99_vonDran_Zhang.pdf";
URL url = new URL(address);
System.out.println("Opening connection to " + address + "...");
URLConnection urlC = url.openConnection();
urlC.setRequestProperty("User-Agent", "");
urlC.connect();
InputStream is ...

9. How to get the result of executing an html file in your local hard disk from a java program?    stackoverflow.com

I'm trying to get the result of executing an html file on my hard disk as a string (thats the type of whats displayed in running the file) form a java ...

10. HttpUrlConnection chunk size and video files    stackoverflow.com

I am using HttpUrlConnection to upload files with servlet... The problem is I can upload files max 10000*4096 length only :( Even the chunk mode method doesn't help... I looked all ...

11. Java's URLConnection not receiving entire binary file    stackoverflow.com

I am currently working on a school that encompasses creating a P2P client for a standard we came up with in class that uses HTTP to request chunks of a binary ...

12. Unable to upload file using HttpURLConnection    stackoverflow.com

I've been using HttpURLConnection to upload a file but on execution I get an error like "request was rejected because no multipart boundary was found" Following is my code snippet

File importFile = new ...

13. Download file from X to Y bytes    stackoverflow.com

I have couple of doubts regarding downloading of file using Java

  1. Is it possible to get the size of file before start downloading ?
  2. Also is it possible to download only x to ...

14. Java URLConnection content length is null    stackoverflow.com

I am using the two lines below to retrieve the file size of a data file. For most ftp servers, it works except for one. Is this platform based? Does this ...

15. Can I get an URLConnection for a file within a JAR within a non-exploded WAR?    stackoverflow.com

I have some resource files that are in the classpath of my web application (inside a JAR, if that matters). I know I can access the contents of those resources by ...

16. Importing a 30GB flat text file over internet to local file system using multiple connection to that flat file?    stackoverflow.com

Lets say, I have a flat text file in a server. I need to download/import/copy to my local file system over internet. Is there any way I could import the ...

17. Java app with URLConnection leads "Too many open files"    stackoverflow.com

I wrote a small pieces of java program as following:

package com.ny.utils.pub;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class NetWriter {
private static String link = "http://xxx.yyyyyy.com:4444";

public String getLink() {
   ...

18. Uploading a file from java using HTTP connection    stackoverflow.com

I am trying to upload a file(log file) from an applet, running in a browser. I am reading the file in a String. Following function, given a String data and a ...

19. How to reduce the time to download file from server using HTTP connection    bytes.com

You only showed us the preamble of the entire process; your connection speed is the most important factor for the downloading time here. Try to read 4KB or so blocks every ...

20. How to write to a file in remote machine Using URLConnection    coderanch.com

Hello, I am writing some network programming. I have to edit a file which is available in the server machine in a remote location. In the server there is an apache webserver running. The editing has to be done through the GUI from a remote client. So I'm using URL and URLConnection classes with http protocol. With this I'm able to ...

21. Posting large files using HttpURLConnection    coderanch.com

Hi Peter. Thanks a lot for your reply. I have established connection with remote debugger to the remote servlet. The breakpoint has been set in doPost method. I have another session with the debugger in the code which posts using HttpURLConnection. I can see that remote sites trips the breakpoint only after I am done with the loop and call "getResponseCode" ...

22. HttpURLConnection hangs downloading big files    coderanch.com

Hello everybody, I am having problems with downloading big files (over 150MB) from a servlet using POST method. Even for files over 125MB I had to use -Xms and -Xmx options to make it work. The connection is https, but I do not think that matters. Below is a relevant part of my program. The process hangs on the line conn.getResponseCode(), ...

23. Downloading a file using URL, URLConnection classes    coderanch.com

Look for a way to set "follow redirect" to false on URL or HttpUrlConnection or one of those classes. I don't recall if it's an explicit method or a property but it should be in the Javadoc somewhere. If the server sends back an actual HTML page with a redirect instruction in the page you should be able to capture the ...

24. Attach a file to HttpURLConnection    coderanch.com

Thanks for the quick reply Joe If I'm not mistaken, the fileupload package if for use in handling the upload on the server side. My problem is handling things on the applet/client side. Am I missing something?? Unfortunately I gotta use ASP on the server side (insert tearful smile here) So I've got something like this URL url = new URL("http://www.foobar.com/send.asp"); ...

25. Connection using JAR file, but not using JAVA command?    coderanch.com

I made a little chat server that clients connect to and are then able to chat with the other clients. I am using sockets to do so and it works when I run the server on my computer and start a client on a different virtual machince and connect to either the loopback(127.0.0.1) or my public ip address. Now I had ...

26. Sending one file over mutiple TCP/Socket connections.    coderanch.com

Hello masters, I've heard when trying to send a big file over sockets, it is common practice to 'break up' the file into smaller parts and then send those over _multiple_ sockets/TCP connection simultaneously. Does this really speed things up? I must mention that the kind of architecture I have in mind does not involve the server running multiple threads. I ...

27. problem in download zip file using URLConnection class    coderanch.com

hi, in my application, client is sending request, and then server is creating one zip file (which contains four files). whose size is around 2 kb. after that server is sending that zip file to client, then there is problem. client is getting that zip file. but size gets change and size is 1 kb. my code is : servlet code ...

28. httpurlconnection for uploading a file    coderanch.com

29. Reading file from remote server using SFTP connection    coderanch.com

ChannelSftp sftp = null; try{ //connect to my server here //I use some utility method to connect to it //Check to see if we are connected if(!channel.isConnected()){ return false; } //Change directory to the remote folder sftp.cd(remoteFolder); //Check that we have changed directories if(!sftp.pwd().equals(remoteFolder)){ return false; } //Get the remote file File localFile = new File(localFileName); FileOutputStream fos = new FileOutputStream(localFile); ...

30. Upload large text files via URLConnection    coderanch.com

Hi! I'm using the following method to upload a text file to a server: public static String HTTP_POST(final String url, Map params) throws MalformedURLException, IOException { String response = null; String data = ""; try { int i = 0; for (String key : params.keySet()) { i++; String value = params.get(key); data += URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8"); ...

32. Wrting file from URLConnection stream    forums.oracle.com

If you don't handle text or you don't care about the content of the data you move around, then never use a Reader/Writer for reading/writing and don't use a String/char[] to keep your data. Those are reserved exclusively for textual data. To handle that correctly, you'd have to check the encoding of the file you're downloading. Since you don't seem to ...

33. URLconnection.getLastModified cannot identify file changes after connection    forums.oracle.com

In my code, I am using URLconnection.getLastModified to watch for file changes. Unfortunately, when the file changes after the URLconnection is made, it does not recognize the file changes. Any ideas on how to make this work? Thanks public FileChangeMonitor(URL fileURL) throws IOException { targetURLconnection = fileURL.openConnection(); targetURLconnection.setUseCaches(false);// This didn't seem to help - can be deleted. } public static void ...

34. downloading PNG via HttpURLConnection - corrupt file    forums.oracle.com

but i have to download a lot of images, and when the complete size is 60MB, this would mean, that i have to execute the lines in the while-loop 60 million times. i think, this cannot be the fastest and best way. so i would be happy, if anyone knows a better way to solve my problem.

36. urlConnection and large files    forums.oracle.com

Hey all, a week or so ago I posted a little something (http://forum.java.sun.com/thread.jspa?forumID=536&threadID=5205481) in the networking forums here in regards to OutOfMemory errors when writing large files (by large, let's say anywhere in the large range between 300 MB and 2 GB) to a DataOutputStream. My question is if anyone has ever had success writing large files to a web page ...

37. Problem writing to a file using a URLConnection...    forums.oracle.com

Hi all... I've been reading throught the sun's toturial on networking that you can find here: http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html this toturial provides a java program that uses a servelet to write some text. First, I don't know what a servelet is. Second, I can't understand to what is this program writing. That is, where does it store it's output. what I am trying ...

38. URLConnection does not create file    forums.oracle.com

You can only create a file if the server lets you. What's on the other side of that URL? Is it a servlet (or other server-side code) that receives content and writes it to a file? Are you sure it's working? If the URL is to a plain file...you can do that, but you'd have to set the HTTP method to ...

39. Appending to a file accessed using a URLConnection    forums.oracle.com

Hello, I have a server hosting a text file, and I want to write a program that connects to the server and appends data to the end of this file. The problem is that URLConnection does not support appending data to the file, but just overwriting it. Is there another way to append data to the file? Thanks.

40. Upload a file using FTPS connection    forums.oracle.com

I have to develop an application which has to be able to send a file through FTPS. I found FTPSClient class from Apache commons but the problem is that it is done java 1.5 and the device were I have to run the application only supports java 1.4 (and there's no option to upgrade it). Is there another option?

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.