Questions tagged [bytearrayinputstream]

ByteArrayInputStream is a Java and Android class implementing a stream that reads data from a byte array.

107 questions
3
votes
0 answers

Is there a way to read or see the files or information stored in RAM in a computer?

I'm working on a security project and I'm wondering how hard is it to read into the RAM memory of a computer. For example, I have a Java program that reads an image into ByteArrayInputStream, how hard would it be for someone to see this file if I…
Maflores16
  • 67
  • 1
  • 8
3
votes
2 answers

Does a Java ByteArrayInputStream built off of bytes from a local String variable need to be closed?

Let's say that I am constructing a Java ByteArrayInputStream off of a local String variable. For example, let's say that I have a large String named csv representing the contents of a CSV file and I need to put it into an input stream in order to…
ecbrodie
  • 11,246
  • 21
  • 71
  • 120
3
votes
0 answers

Coding Java against serial ports: buffers and stream strategies

Please note: Although the library I'm using is called the Java Simple Serial Connector, this question is really more about Java coding against serial ports in general, and any strategies associated with doing so. I'm using a Java library (JSSC as…
3
votes
1 answer

How to convert byte array to buffered image

I have a server-side java code that gets a byte array from the client. In order to do some image processing, I need to convert the byte array into a BufferedImage. I have a code that's supposed to do that here: public void processImage(byte[] data)…
baekacaek
  • 1,527
  • 3
  • 22
  • 45
2
votes
2 answers

Efficient ByteArrayInputStream manipulation

I am working with a ByteArrayInputStream that contains an XML document consisting of one element with a large base 64 encoded string as the content of the element. I need to remove the surrounding tags so I can decode the text and output it as a…
Tim McGinnis
  • 83
  • 1
  • 7
2
votes
2 answers

ByteArrayInputStream to ObjectInputStream disappeared

I've something that I don't understand, please help. System.out.println("\n" + Arrays.toString(buffer) + "\n"); System.out.println("buffer.length = " + buffer.length + "\nnew ByteArrayInputStream(buffer).available() is: " + new…
Fisher Coder
  • 3,278
  • 12
  • 49
  • 84
2
votes
0 answers

Xuggler not reading file from ByteArrayInputStream if filesize is greater that 7 MB

I am new to Xuggler. I want to write a program which reads a video file from ByteArrayInputStream. This is the code: public static String path="/home/gurinderbeer/Downloads/IMG_1579.MOV"; public static void main(String[] args) throws…
2
votes
4 answers

Convert byte array to String - java

I am trying to read in the content of a file to any readable form. I am using a FileInputStream to read from the file to a byte array, and then am trying to convert that byte array into a String. So far, I have tried 3 different…
Kevin Donahoe
  • 31
  • 1
  • 6
2
votes
0 answers

Not Printing created iText pdf file by ByteArrayOutputStream

I coded for creating iText PDF file in the memory by ByteArrayOutputStream by click of a button and print that PDF file when click of that same button same time..Code is error free.. Below is my code for the specific button; int print =…
user5167914
2
votes
1 answer

ByteArrayOutputStream/InputStream losing newline characters on S3 Import

I have the following code (pseudo code-ish)... ByteArrayOutputStream output = new ByteArrayOutputStream(); output.write("something\n".getBytes()); output.write("something\n".getBytes()); ByteArrayOutputStream input = new…
Craig
  • 1,295
  • 3
  • 16
  • 29
1
vote
2 answers

Why BufferedInputStream(InputStream in, int bufSize) is not reading data in chunks of bufSize from the inputStream while using mark()?

Here is my code: import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.IOException; public class MarkAndResetDemo { public static void main(String[] args) { String s = "Today is Sunday!"; byte…
Shri
  • 109
  • 9
1
vote
1 answer

Create zip archive from a list of ByteArrayInputStream and return byte[] array of the archive - JAVA

I want to archive some files that I am receiving from an external source. I receive each of this files as a ByteArrayInputStream. In the end I want my method to create the zip archive and return a byte[] array so that I can download it later. I have…
Palux
  • 35
  • 3
1
vote
1 answer

ByteArrayInputStream with Resttemplate

I need to pass ByteArrayInputStream to the web layer. After the ByteArrayInputStream is formed, I pass through RestController to serviceRest and then to the web layer. I export objects to .xlsx and return ByteArrayInputStream @Override public …
1
vote
2 answers

Unable to serialize convert java POJO class into a byte array

How to convert java POJO class into a byte array as I wanted to save the object into a gz file in S3 I get this exception Caused by: java.io.NotSerializableException public byte[] compressData(User user) throws IOException { byte[]…
Harish
  • 565
  • 1
  • 12
  • 34
1
vote
1 answer

Get the absolute file path from InputStream(ByteArrayInputStream) object

I have the following piece of code: class Train{ static{ InputStream inpStr = Train.class.getClassLoader().getResourceAsStream("ABC.properties"); Properties props = new Properties(); props.load(inpStr); } } I want to…
Zeus
  • 319
  • 2
  • 13