Upload/Download text files in Java? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm currently trying to code a fairly simple program in Java to keep a database on a small library at my university. I'd like for multiple computers to be able to use this program using a shared database stored in a text file that would be downloaded when the program is run, and uploaded once the user is finished using the program and making any edits to the database. I don't know how to go about this at all and would be very grateful for any pointers on a direction to take.

In order to connect to other computers in Java, you should use Sockets, and define your own Protocol (Basically, your protocol would consist on a handshake, and some way on asking the other part of the connection to send the text's data). Anyways, I'd recommend you using a simple SQLite database
To read and save files (txt is a raw text file without any special format), check this
If you'd like the program to display the text, you should learn a bit about Java Swing
Also, try looking a bit in google before asking here

Related

Creating different user profiles [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am creating a game app where you need the ability to be able to create profiles for other players and store them on your phone. I have been looking around for help, but I can't seem to find any tutorial or help for this. Does anyone know which aspect of java I need to research and learn about? I have seen that it might be to do with App-specific files but I'm not sure if that is the right thing.
You can store user information in files (XML / JSON format). You can use the database too - Android supports SQLite (SQLlite database is stored as single file). Android creates files in private folder, other applications cannot access them.
More informations about files:
https://developer.android.com/training/data-storage
Example of usage of SQLite:
https://developer.android.com/training/data-storage/sqlite
Remember not to store user sensitive data in plaintext.

How to save changes in java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm new to java and I'm recently working on a project which allows you to deposit, withdraw and create new accounts. I want to know if I can somehow save the changes after rerunning the code, for example, the change of users. I've tried several ways on the internet and they didn't seem to work.
There are a variety of ways to accomplish this. For a new programmer, I'd suggest learning how to read and write from files to start.
A simple database system is also an option, but probably more complicated than what you're looking for. This also can't be covered in one tutorial. If you're interested, you should probably do your own research and find something that works for you.
What you need is a database system.
In short, the database will store the data. Your program reads and displays that data. The user modifies it, and pass it to your program to "save" the data (which is replaced the old data with new ones in the database)

Storing an array so that I can access it the next time I run the program [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have this array
String[][] someArrayOfData={{"there","is"},{"alot","of data here"}};
I want to be able to save this array so I can load and access it the next time I run the program.
I dont mind having to use just a String[] as well. I have tried to write it to a notepad file but that is just a major irritation, is it possible to store variables externally to avoid the hassle of writing to multiple notepad files or using delineators?
There are multiple possibilities. In all cases this is called persistence.
Store to file
Store to file
Store to database
Java DB tutorial
Send it somewhere
Simple REST web service and client
In principle 3 is not persistence, but it is a way to get the data out of the volatile memory.

Can java be used to creating File formats, if not what Languages are suitable? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I do not know if this is the right place to ask this question, but I have been wondering, what languages can one use to create a file format, I am working on an android app which reads and writes files, I want to create a unique file format which it only can read, I know each format uses different algorithms, that is why am asking if anyone knows any references I can look at, I can not seem to find any documentation online on this topic.
Any language can be used to create any kind of files if you know the encoding and encryption type of those file formats. If you really need a unique type of file for your application, simply save serialized objects or encrypt and save the serialized stream and use any desired extension.

Building a database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am attempting to build a database that will allow a user to upload their music to be accessed by someone else/third party. How would I create it so that the music can be uploaded to a database but providing a path for it to be accessed from where it is stored?
As in A Band upload “Song” and it is then streamed by A Fan.
If it can't upload to a database I need to upload it to a server.
We are building the back end in Java and the front end in HTML.
We are also using Glassfish and Netbeans for writing the code.
You can store files in a BLOB field in a database for example. Another possibility would be to store them directly on the file system, but it has its problems (such as the lack of metadata).
Then you'll need to figure how you want to map each file, for example http://myserver.com/Artist/Album/Songname or http://myserver.com/listen?uniqueid=743.
File upload servlets are available all over the web, so that shouldn't be a problem. The rest is up to your programming skills (this might be too big of a project for you).
Then you'll just need to connect those things together, and that's the part where you start to program (or hit the Google hard).

Categories

Resources