FAQ Database Discussion Community


Android socket receive data

android,sockets,inputstream
I am new with android development so if any further information needed plz ask... I am trying to use sockets to send coordinates to server, receive query results and "Toast" them. Until now in my activity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_socket); new Thread(new ClientThread()).start(); } ... class...

Instance creation based on primary data

java,inputstream
A dat file contains information in the following format, which is written using writeUTF: Fruit, Colour, Taste, Yes/No , the last one being either Yes or No, however, it's a string. Now, a class is defined as follows public class Food { private String name; private String colour; private String...

Why is Android socket reading so slow periodically?

java,android,sockets,inputstream
The socket is created as following: Socket socket = new Socket(); socket.setReuseAddress(true); socket.setSoTimeout(iTimeout); socket.connect(new InetSocketAddress(InetAddress.getByName(uri.getHost()), iPort), 6000); socket.setReceiveBufferSize(iReceiveBufferSize); //iReceiveBufferSize = 1024*256 final InputStream is = socket.getInputStream(); A debug method was created and tested just for the sake of asking this question: public void SocketDebug(InputStream isSocketInput) { try { byte[] abBuffer...

C++ Reading UTF8 buffer using wide stream

c++,utf-8,inputstream,utf-16
My problem is that I have a buffer in utf8 format stored in a std::string. I want to supply it as a wistringstream to boost spirit. How can I do it without converting the whole std::string to std::wstring. I would like to have a stream that works as a readonly...

Java, save inputstream to file takes hours

java,sockets,inputstream
I'm having trouble with saving the output from a socket. I have an inputstream from a socket and I'm trying to save it to a file. Printing the output works fine i get immediately the output but if I try to save it to a file it takes hours. I...

How to convert the response from Okhttp into inputstream

android,inputstream,okhttp
CODE: public static String getRequestNoPayload(String urlString, String loginApi, String mUsername) throws Exception { Response response; try{ client.setConnectTimeout(20, TimeUnit.SECONDS); // connect timeout client.setReadTimeout(20, TimeUnit.SECONDS); // socket timeout Request request = new Request.Builder() .url(urlString) .addHeader("username",loginApi) .addHeader("password",mUsername) .build(); response = client.newCall(request).execute(); }catch(Exception e){ throw e; } return response.body().string(); } What i am trying...

iterating through a list of files to check how many lines are there inside

java,inputstream
I have been trying to write a simple code where i can go through a list of filenames, go through each file name, and calculate how many lines are there in each file. However the code below doesn't seem to work at all (keeps initiating the debug perspective in eclipse)....

Why is this function not working but not displaying errors in Eclipse?

java,eclipse,inputstream
If I comment out the two for loops, the program will run fine (given I adjust a variable or two). However, when I compile and run in Eclipse it just sits and does not have any overflow errors or anything else. The file is a text file that I am...

Error using InputStream.skip()

java,inputstream
I am looking for something similar to C++'s cin.ignore() function. I am new to JAVA and I trying something like this Scanner user_input = new Scanner(System.in) ; int num1, num2 ; System.out.print("\n Enter the two numbers : " + "\n number 1 : ") ; num1 = user_input.nextInt() ; System.out.print("\n...

Issue with BufferedReader.read while reading from InputStream

inputstream,bufferedreader
I am trying to read input stream in chunks and write to file to avoid memory issue, I am receiving data in json format and same I write to file using following code. BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); BufferedWriter writer = null; if(getOutputFormat().equals(Constants.URI_FORMAT_JSON)){ boolean enableAppend = true; CharBuffer buffer...

ObjectOutputSteam Sending Multiple Objects Before Receiving

java,oop,inputstream,outputstream
I am sending 2 objects using an ObjectOutputSteam. Can I send the second one before receiving the first one with an ObjectInputStream? Thanks!...

return type in stream operator overloading

c++,inputstream
The purpose of program is to take input, assign those values to the members of the class and display the output, with the input and output operation being done by overloading stream operators. #include <iostream> using namespace std; class MyClass { int x, y; public: MyClass(int i, int j) {...

A bash script written around the nc command. How do I prepend text before each line?

linux,bash,shell,stream,inputstream
I'm using the nc command in an unusual way. I have two bash scripts that initiate a chat session if two users run them at approximately the same time. These scripts are built around the nc command. I want the stream of text to display a value appended after each...

Parsing a .properties file with getClassLoader()

java,inputstream,properties-file
I'm writing a Java program that takes a foo.properties file and parses it into a Properties object. After a quick search, I found this code: public Properties getProperties() throws IOException{ String fileIn = "foo.properties"; Properties p = new Properties(); InputStream inStream = getClass().getClassLoader().getResourceAsStream(fileIn); if(inStream != null) { p.load(inStream); } else...

issue while extending InputStream class

java,inputstream,datainputstream,bufferedinputstream
I am trying to extend InputStream class and use customized read() methods. This is my class snapshot: class MyClass { /** Input stream */ private final MyInputStream in = new MyInputStream(); /**get the InputStream public InputStream getInputStream() { return in; } /** Inner class for MyInputStream */ class MyInputStream extends...

Reading the content from an inputstream using scanner multiple times is not behaving as expected

java,inputstream,java.util.scanner
I am using the following code to read content from an input stream. @Test public void testGetStreamContent(){ InputStream is = new ByteArrayInputStream("Hello World!!".getBytes()); System.out.println(getStreamContent(is)); System.out.println("Printed once"); System.out.println(getStreamContent(is)); } public static String getStreamContent(InputStream is) { Scanner s = null; try { s = new Scanner(is); s.useDelimiter("\\A"); return s.hasNext() ? s.next() :...

Calling a non exe (Labview VI) external program into Java

java,process,runtime,inputstream,labview
I have developed a Labview program and i want Java to trigger it open, i have seen many methods to run external exe applications in Java, is it possible to call an non-exe file with the labview file format .vi?

Comparing the value of readline() to a string [duplicate]

java,string,sockets,inputstream
This question already has an answer here: How do I compare strings in Java? 23 answers I am reading the inputstream using readline() method and then trying to compare it. The code is as follows: //socket is defined before this InputStream is = socket.getInputStream(); br = new BufferedReader(new InputStreamReader(is));...

InputStreamReader buffering

java,character-encoding,buffer,inputstream
In the InputStreamReader class documentation it is declared that: To enable the efficient conversion of bytes to characters, more bytes may be read ahead from the underlying stream than are necessary to satisfy the current read operation. what does this statement mean ? Does the implementation buffer some input data...

Issue with String Buffer in java

java,servlets,inputstream,stringbuffer
I have a servlet in which the from InputStream I am getting the my form data in XML format. I am able to get retrieve the form data in XML format and able to write the same in file. If I open the file I am able to see my...

Java 8: How to create java.util.stream.Stream based on java.io.Reader

java,mapreduce,java-8,inputstream
Reading the Java 8 docs it seems that it's intended java.util.stream.Stream could ultimately be backed by an I/O java.io.InputStream. So, I wanted to read in a character stream and feed it into a map-reduce pipeline using the new features. I couldn't find any utility methods to do this, so I...

skip method always returns 0 of Inputstream

java,inputstream,fileinputstream
I have to generate checksum by reading the file and for that, first , I have to read the 8 bytes header and then skip some of bytes(that would be variable length and it is available for each file). But after reading first 8 bytes and storing to the byte...

How to execute interactive commands and read their sparse output from Java using JSch

java,ssh,inputstream,jsch
Currently I can use the JSch library to execute remote commands in a SSH session like this: JSch jsch = new JSch(); Session session = jsch.getSession(username, host, 22); session.setPassword(password); Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); ChannelExec channel = (ChannelExec) session.openChannel("exec"); BufferedReader in = new BufferedReader(new InputStreamReader(channel.getInputStream())); channel.setCommand("ls...

Java - Input stream doesn't get values

java,inputstream
I have two methods of a project which have to read lines from a .txt file. The first method analyze only the first line, the second the whole file and if read a float number save it in an ArrayList else if it find out "#" it has to change...

In Java, is it safe to call Character.isXxx() methods with an int returned from InputStream.read()?

java,unicode,character,inputstream
When reading a text file, I would like to do something like this: InputStream input = ...; int read = input.read(); if (Character.isWhitespace(read)) { // do something with the whitespace } The alternative would be to check for a negative read() return value (aka, end of input) and explicitly cast:...

read seperate parts from textfile into vector using C++ Code::Blocks

c++,vector,inputstream
For my master Thesis I need to write a program in C++ but I am not at all a programmer. It is also my first program in C++, I used to program for school in Java. My problem is the following. I have these textfiles containing some data, looking like...

Input stream from classes made by yourself?

java,class,input,stream,inputstream
I'm currently doing an asssignment which requires me to add harnesses to a harness array. I made the class Harness so I can construct new harnesses in the main line. One thing I'm confused about is that I have to make a second class, which does the following. Design a...

InputStream to servletInputStream

java,inputstream
I have this inputStream: InputStream inputStream = new ByteArrayInputStream(myString.getBytes(StandardCharsets.UTF_8)); How can I convert this to ServletInputStream? I tried: ServletInputStream servletInputStream = (ServletInputStream) inputStream; but do not work. EDIT: My method is this: private static class LowerCaseRequest extends HttpServletRequestWrapper { public LowerCaseRequest(final HttpServletRequest request) throws IOException, ServletException { super(request); } @Override...

Why do I get java.io.IOException: Stream Closed? (java 7)

java,file-upload,inputstream
I try save uploaded file as described here using Files.copy(inputStream, path to file,replace existing) Here is method that throw exception public void handleAudioUpload(FileUploadEvent event) { UploadedFile audio = event.getFile(); try (InputStream audioInStream = audio.getInputstream();) { MP3Util util = new MP3Util(audioInStream); Map<String, String> tags = util.getAudioTags(); System.err.println(tags); System.err.println(webAppPath); Date currentDate =...

Java stream of byte. Read operation sometimes doesn't read what was written

java,stream,byte,inputstream,outputstream
I'm trying to implement a communication system with an automatic repeat request strategy. I use three classes: Transmitter, Channel, Receiver. I have a maximum number of byte for message (window). But when I receive the byte sent, sometimes I receive less bytes than window. Why? My code is this: Transmitter...

skip method in CipherInputStream

java,file-io,cryptography,inputstream
I am running into an issue where the code that works against a InputStream backed by a FileInputStream does not work if a CipherInputStream is used. Example is below: // skipCount is same as n in a FileInputStream FileInputStream fis; ... skipCount = fis.skip(n) Get a different behavior if a...

Java extract text from text file from a certain point on the text

java,filter,inputstream,bufferedreader,inputstreamreader
I have created a method with BufferedReader that opens a text file created previously by the program and extracts some characters. My problem is that it extracts the whole line and I want to extract only after a specified character, the :. Here is my try/catch block: try { InputStream...

jena read inputstream from gzipped file

java,inputstream,jena
I have the following code to read a dataset into a jena model using inputstream however I would like my program to be able to read compressed (gzipped) files as well (using filePath). Dataset dataset = TDBFactory.createDataset(tdbPath); Model model = dataset.getDefaultModel(); InputStream str = FileManager.get().open(filePath); model.read(str,null, "N-TRIPLES"); ...

copying files in android with input/output stream: the good and the bad way

java,android,inputstream,outputstream
i have made this two routines to copy files using inputstream and outpustream. they are quite the same however the second one rise ArrayIndexOutOfBoundsException while the first one works flawlessly and i don't know why: public void CopyStream(long size, InputStream is, OutputStream os) { final int buffer_size = 4096; byte[]...

Android: Display current track Info in mediaplayer using webpage

android,android-asynctask,inputstream,android-mediaplayer,runnable
I am a learner and developing an Android App to play live stream. It is working properly except 1 issue. I want to show title of currently playing Track which is available on a webpge. For this purpose I have used a textView and tried to use Asynchronous Task and...

Reading http request from socket with null check java

java,inputstream,findbugs
I'm reading http request from socket input stream StringBuilder request = new StringBuilder(); String inputLine; while (!(inputLine = in.readLine()).equals("")) { request.append(inputLine + "\r\n"); } It's working, but findbugs gives the following bug: Dereference of the result of readLine() without nullcheck. Request ends with "" not eof. So how can I...

How do I write Objects through a ObjectOutputStream, when the Objects are created in a different class?

java,encryption,inputstream,outputstream
I've tried to sum up my question, but really there's more behind it. For a task at uni we are supposed to create two constructors (English isn't my first language) 1) public SecureInputStream(InputStream base, OutputStream remote) 2) public SecureOutputStream(OutputStream base, InputStream remote) 1) is supposed to create BigIntegers g,n,k then...

Adding each new value of a String 'temp' value to ArrayList without overwriting previous 'temp'

java,string,sockets,arraylist,inputstream
My input is coming from a socket using DataInputSteam and because I can have several different String values all being assigned to same clientDayOfWeek string, I cannot figure out how to save all the string values coming in into the same ArrayList without replacing the last value. I'd also like...

Android: define image type (jpeg or jpeg2000) from inputstream

java,android,jpeg,inputstream,jpeg2000
I have an inputstream that contains image. Image can be as in jpeg, so in jpeg2000 format. I've logged that stream and see next for jpeg2000: ������jP for jpeg that it something like ������JFIF To my understanding, there should be some magic bytes in stream, that will return image type....

PDFBox: extracting images from pdf to inputstream

java,inputstream,pdfbox
I am using PDFBox to extract the images from my pdf (which contains only jpg's). Since I will save those images inside my database, I would like to directly convert each image to an inputstream object first without placing the file temporary on my file sysem. I am facing difficulties...

Make InputStream non-blocking

java,inputstream,nonblocking
Currently I have a server that listens for connections (it is a basic highscore server for a mobile game I have), loops through the connections every 1000ms and listens for any incoming data. public void readData(Connection c) throws IOException { PacketBuffer readBuffer = new PacketBuffer(Server.PACKET_CAPACITY); int packetSize = c.getIn().read(); c.getIn().mark(packetSize);...

Convert binary data to long[] using Inputstream while mainting original order

java,android,performance,inputstream
Problem description I have a file of 2mb which contains only binary data. I only need to convert this file to a long[] while maintaining the order the data has in that file. Since the file is read on Android I only have access to the file as an InputStream....

Why does StringBufferInputStream doc recommend StringReader for String to Stream conversion?

java,string,type-conversion,inputstream
As has been answered repeatedly, you can easily convert a String to an InputStream. When browsing the Java 8 documentation I came across the long-deprecated StringBufferInputStream class, which states that As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class. What...

java.io.FileNotFoundException Access is denied

java,inputstream,filenotfoundexception
Why does the following code give me a File Not Found exception when i try to create an InputStream? My inputdirectory is defined as a File and has a value of "D:\General\Images\small_images" (without quotes) that my user has full write permissions to. I'm using Windows 7 and running through the...

InputStream Exception while downloading a file

android,download,inputstream
I am trying to download a PPT file from a server. it's in Bytes. but while debugging I noticed that the input stream throws an exception of FileNotFound while running.. the file does exist on the server, here's my code, any help would be greatly appreciated. public class DownloadFileAsync extends...

Extract patterns of STDIN with Java 8 Stream API

java,regex,inputstream,java-8,stdin
I am trying to parse STDIN and extract every string that matches with a specific pattern (for example email pattern). Also the program has to count the number of occurences of each match. When it finishes the sum, it will print the list of matches sorted alphabetically. I thought that...

Reusing ObjectInputStream throws StreamCorruptedException

java,sockets,networking,inputstream,outputstream
I have a client-server application. Where the client sends an object and the server sends the same object back, a simple echo server. The code below works fine if I am making a new instance of Client for every new request. However, if I use an existing instance of the...

RSS reader vs BOM error

java,inputstream,byte-order-mark,rss-reader
I'm trying to read in an RSS Feed/XML file into my application. The problem is that there's a BOM (Byte Order Mark) that my inputStream doesn't like and it throws an error which throws another error and everything dies. Here's the method: private Document getDomFromXMLString(String xml) { Document doc =...

Scala trait, superclass and early definition syntax

scala,inheritance,buffer,inputstream,trait
I'm learning Scala by working the exercises from the book "Scala for the Impatient". One exercise asks that: In the java.io library, you add buffering to an input stream with a BufferedInputStream decorator. Reimplement buffering as a trait. For simplicity, override the read method. Even though it isn't clear (to...

InputStream in.read() behaving differently than expected

java,sockets,networking,inputstream
I am trying to transfer a text file to another server using TCP and it is behaving differently than expected. The code sending the data is: System.out.println("sending file name..."); String outputFileNameWithDelimiter = outputFileName + "\r\n"; //These 4 lines send the fileName with the delimiter byte[] fileNameData = outputFileNameWithDelimiter.getBytes("US-ASCII"); outToCompression.write(fileNameData, 0,...

Why does an InputStream initialized with a String stay open outside a try-with-resources?

java,inputstream,try-with-resources
I noticed that this throws an IOException as expected, due to the stream being auto-closed: BufferedReader bufferedReader; try (FileReader fileReader = new FileReader(new File("pom.xml"))) { bufferedReader = new BufferedReader(fileReader); } bufferedReader.readLine(); whereas when the InputStream is initialized with a String, it does not: BufferedInputStream bufferedInputStream; try (InputStream inputStream = IOUtils.toInputStream("test"))...

Android File to String

java,android,inputstream,android-file,bufferedwriter
I want to read out a file in Android and get the content as a string. Then I want to send it to a server. But for testing I just create a file on the device and put the content into it: InputStream stream = getContentResolver().openInputStream(fileUri); BufferedReader reader = new...

Chaining InputStream in Java

java,inputstream,bufferedreader
So i know that InputStream sees the data as raw data and Reader sees it as characters. Buffered them will make things more efficient. But how about chaining them like this: InputStream in = new InputStream(...); in = new BufferedInputStream(in); Reader r = new InputStreamReader(in); r = new BufferedReader(r); Is...

Why is InputStream.close() declared to throw IOException while reading the message?

java,inputstream,java-io,ioexception,close
Recently, I started doing automation, which suggests that I am not properly closing streams. I decide to see if there's anything that can be done with a finally{} block, and then I see, close() can throw IOException. public Iterable<T> convertToMessage(Class<T> messageClazz, MESSAGE_FORMAT messageFormat, File fileToConvert, String duns) throws IOException {...

InputStream read doesnt return -1

java,sockets,inputstream
Hey I'm trying to send a file with java sockets but I'm having problems with read function of InputStream class. I've got this code InputStream is = sock.getInputStream(); fos = new FileOutputStream(FILE_TO_RECEIVED); bos = new BufferedOutputStream(fos); byte [] buffer = new byte[4096]; int bytesRead; int totalLength = 0; while(-1 !=...

How to read input from a socket using threads JAVA

java,multithreading,sockets,client,inputstream
I am writing a simple socket programming application that uses a server and one client. I am trying to start a thread (from client file) that reads input from the socket input stream so that i can write messages to the server and read them back and print them to...

How to detect if network connection is down while downloading file using InputStream and FileOutputStream in android?

android,inputstream,httpresponse,fileoutputstream,httpentity
I am downloading a file and then writing it into sdcard using following code: HttpResponse response = httpClient.execute(request); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); File file = new File(Environment.getExternalStorageDirectory()+"/MyProject/data"); FileOutputStream fos = new FileOutputStream(file); int inByte; while((inByte = is.read()) != -1){ fos.write(inByte); System.out.println("in while loop inByte: "+inByte); }...

Accents aren't print after UTF encoding/decoding

java,unicode,encoding,inputstream,bufferedreader
I've read several articles on the whole topic and I still don't understand what's going on here. Please, see for yourselves in the following working example (actually, no example, this is the complete class I'm working on with some added main()). public class Console extends JFrame { private static final...

converting string path to inputstream

java,android,string,inputstream,quickblox
I am developing a chatting app using Quickblox chat API And currently have done user registration,authentication and basic peer to peer chat and group chat. now implementing video,image and file sending But have stuck up on some part. Selecting image from sd card. returns picture path in string and its...

Why getProperty method doesn't print out the working directory?

java,sockets,client-server,inputstream,outputstream
I am trying to build a simple client-server aplication. Now I want to print out the current working directory of the server. I have tried by using String workingDir= System.getProperty("user.dir"); method. But it doesn't actually print out the directory. I don't know why. I need help. package clint; import java.io.*;...

How to convert a Blob object into a PDF file in Java?

java,pdf,blob,inputstream,outputstream
I have the following situation into a Java application. From the database a retrieve this Blob object that is the representation of a PDF file on the DB: Blob blobPdf = cedolinoPdf.getAllegatoBlob(); Now I have to convert it into a PDF file. How can I do this task? Tnx...

Java InputStream to ByteBuffer

java,inputstream,bytebuffer
I am reading dds textures, but since once built the jar I can't access those textures through url and file and have to use InputStream instead. So I would need to know how I can obtain a java.​nio.ByteBuffer from an java.io.InputStream. Ps: no matter through 3rd part libraries, I just...

Java InputData read/write loop with array of filenames

java,loops,inputstream
Very, very new to java here. Currently I have code to pull data from a single text file and parse the data in a format that is usable for me (see below.) Unfortunately, this requires me to have to change the file name for each run. I would ideally like...

How can I unit test a method that uses a Scanner and an InputStream?

java,unit-testing,inputstream,fileinputstream
So here is the code: public int foo(InputStream in) { int counter = 0; Scanner scanner = new Scanner(in); while(scanner.hasNextLine()) { counter++; scanner.nextLine(); } return counter; } Normally I will be passing a FileInputStream to this method, however I want to be able to test it without accessing a physical...

BufferedImage to InputStream - Format is different

java,inputstream,bufferedimage,javax.imageio
I am trying to convert my BufferedImage to an Inputstream using the following: BufferedImage bi = ImageIO.read(file.getInputStream()); bi = Scalr.resize(bi, 300); ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(bi, file.getContentType(), os); //the content type is specified as image/jpeg The problem I am facing is that my file.getContentType() returns the value as "image/jpeg"...

Remove whitespaces from XML file read from a zip file

java,xml,inputstream,whitespace,zipinputstream
I'm reading in an XML file that's stored inside a zip file. I need to remove the whitespaces, but I nothing seems to work. Here's what I have, but trim() isn't doing anything. for (Enumeration e = zip.entries(); e.hasMoreElements(); ) { ZipEntry entry = (ZipEntry) e.nextElement(); InputStream inputStream = zip.getInputStream(entry);...

InputStream, return to beggining

c#,validation,stream,asp.net-mvc-5,inputstream
I have a controller post method, which requires an uploaded file: View: @using (Html.BeginForm("UploadCSV", "TemporaryPerson", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.AntiForgeryToken() <div class="form-horizontal"> @Html.ValidationSummary(false, "", new { @class = "text-danger" }) <br /> <input type="file" name="personFile" /><input type="submit" value="Upload" /> </div> } and controller method: [HttpPost] public...

how to convert byte array to Japanese character

java,arrays,string,bytearray,inputstream
Some tool is sending me Japanese content as byte array. So using java I have to read that byte array and display the Japanese content. I am not getting any ideas for achieving this. Till now I tried with below mentioned program just to check how this conversion works: String...

Can a process write to both Error Stream and Input Stream?

java,inputstream
I'm creating a class which abstract process builder and makes it a bit more 'user-friendly' and i wonder if there's by any chance that a process can write to both input and error stream? If so, Can you give me an example to a situation where it happens? I want...

Incorrect image added on excel file with jxl library

java,image,inputstream,jxl
I would add an image to an excel file created using the library jxl: http://jexcelapi.sourceforge.net/ I try adding 2 images with this code: InputStream stream = ClassLoader.getSystemResourceAsStream("images/logo1.png"); byte abyte0[] = new byte[stream.available()]; stream.read(abyte0); wsheet.addImage(new WritableImage(1, 1, 8, 6, abyte0)); InputStream stream2 = ClassLoader.getSystemResourceAsStream("images/logo2.png"); byte abyte2[] = new byte[stream2.available()]; stream2.read(abyte2); wsheet.addImage(new...

Receive the InputStream and get the values from json string in Jersey

java,jersey,inputstream
How can I received JSON string from the InputStream in Jersey, which was sent from HttpURlConenction in android, and how can I get the values of it to store them into database table? { "latitude":93.86898451, "longitude":30.66561387, "time":"24.04.2015 11:11:05", "route":4 } Jersey receiver class: @Path("data") public class Receiver { @POST @Consumes({MediaType.APPLICATION_JSON,...

How can I retrieve an external .properties file in Java?

java,file,java-ee,inputstream,properties-file
Hello to everybody I have the following problem trying to load a properties file from a directory that is external to my project. So my project have the following structure: PROJECT-ROOT | | |-----> confi | |------> src | | |------> mainPkg (the package name) | | |------> Main (the...