Questions tagged [java-io]

The java.io package provides blocking input and output through data streams, serialization, and the file system.

Most applications need to process some input and produce some output based on that input. The purpose of the Java IO package (java.io) is to make that possible in Java.

The java.io package provides blocking input and output through data streams, serialization and the file system.

1753 questions
0
votes
2 answers

Two similar copy codes with Java, two behaviors

So I wanted to implement a function that copies a file into a new file of which I'll specify the directory (I'll create it) and then, as I found on stackoverflow, use the Files.copy function of apache.commons to do the trick. My problem is the…
Akheloes
  • 1,352
  • 3
  • 11
  • 28
0
votes
1 answer

Read and Write with File channel

I need help on the file operation using FileChannel . My requirement is, I have to read a big file from the system, then need to check the file line by line. If certain strings found then need to add new lines or delete old lines from the file. And…
Souvik
  • 1,219
  • 3
  • 16
  • 38
0
votes
2 answers

Java- export to jar- i/o problems

I work on Eclipse (Juno with JDK7), and the program runs (on Eclipse) fine. My problematic lines are: URL imageURL = new URL("http://www.idautomation.com/ocr-a-and-ocr-b-fonts/new_sizes_ocr.png"); RenderedImage img = ImageIO.read(imageURL); File…
gran33
  • 12,421
  • 9
  • 48
  • 76
0
votes
1 answer

java File mkdirs and createNewFile won't work

I'm trying to copy and existing directory structure (no need for the file contents themselves, 0 length dummy files will do). However mkdirs() won't create the necessary directories, causing file.createNewFile() to throw an IOException. The code…
András Hummer
  • 960
  • 1
  • 17
  • 35
0
votes
1 answer

ScheduledExecutorService usage and cleaning up of locked socket instream

Motivation for this question I am running a huge product that runs on very expensive hardware. Shutting it down for testing purpose is not possible, nor is putting up a bad jar on production environment. I need to be as sure as possible to almost…
Siddharth
  • 9,349
  • 16
  • 86
  • 148
0
votes
1 answer

Write float numbers to File

I have floating point numbers in two files. I want to write them in to single file. When I open the file after writing, I cannot see the floating point numbers. I can see some machine code or something. Here is my code import java.io.*; import…
user2133404
  • 1,816
  • 6
  • 34
  • 60
0
votes
1 answer

Understanding java.io library

It is since yesterday I'm reading to Java on-line documentation and I noticed that it focuses more on practice than describing the mechanism of that library. Since there are a lot of classes in IO package, how can I understand when use and how use…
Acsor
  • 1,011
  • 2
  • 13
  • 26
0
votes
0 answers

Existing File became zero size when change it's permission

I have a difficulty to change permission of existing file. What I want to do is, marshall xml and write it to a file. Because the apps is running under 'root' account, then the file is owned by root. I want to change permission of this file, so…
angel
  • 25
  • 1
  • 7
0
votes
2 answers

How to pass a string to a local sever in java

I have created a local server and a client window to make them communicate with each other locally. The server and the client both are created. My problem here is I need the client to enter words in the JTextField and I want to pass this to the…
Jack
  • 258
  • 2
  • 7
  • 15
0
votes
2 answers

Detect if the file exists

Well the file "MyStore.obj" was attached along with the sheet I downloaded. And i'm supposed to read this file's content which is given with order of the contents.how can i make sure if it exists or not? because as you can see i tried using the…
Sarah
  • 133
  • 1
  • 3
  • 13
0
votes
1 answer

Reading multiple objects from file

Is there a proper way of reading objects from file using the ObjectInputStream. The examples I've seen seems to rely on that exception is caught to end the reading. While it maybe works it does not seem to be a clean solution as in exception…
starcorn
  • 8,261
  • 23
  • 83
  • 124
0
votes
2 answers

java.io.StreamCorruptedException over sockets

I am developing a multiplayer snake game. The game seems to be running fine except it often(not every time) randomly throws the java.io.StreamCorrupted Exception type code :AC The full StackTrace of the same is given…
Sohaib
  • 4,556
  • 8
  • 40
  • 68
0
votes
1 answer

File move not working

I'm using the following method to moves files from one folder(source) to another(destination). I have added a check to see if the file exists which is returning true, but still the file is not moving to the destination. Here the source paths…
Avijit
  • 1
  • 2
0
votes
1 answer

java.io.* freezes netbeans in JSP

Whenever I am making a JSP page in netbeans, I try to import java.IO.* <%@page import="java.io.*"%> , it freezes the IDE. I am using windows 7x64 Pro. This happens in NetBeans 7.2.1 and 7.3. Is it against the rules to use that particular import? It…
chiliNUT
  • 18,989
  • 14
  • 66
  • 106
0
votes
1 answer

Java: fileoutputstream (access denied )

I am using AESCrypt open source library to encrypt file. This is my code String password="asdfgh"; String frompath=new String("C:/Users/sabertooth/Desktop/error/pnberror.png"); String topath=new String("C:/Users/sabertooth/desktop/error/"); AESCrypt…
Ritesh Sangwan
  • 43
  • 1
  • 2
  • 8
1 2 3
99
100