Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within I/O and Streams
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
I/O and Streams
How do i alter this coding so that it reads the first 8 bytes of the file given?
tom bannister
,
Greenhorn
Mar 05, 2013 04:16:32
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
import java.io.*; public class FileInHexadecimal { public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("c:\\Users/Tom Bannister/My Documents/troll.gif"); for(int i=0; i<=8; i = i+1) { //i think something is missing from here that reads the bytes if (i != -1) { System.out.println(i); } } fis.close(); } }
Matthew Brown
,
Bartender
staff
Mar 05, 2013 04:21:36
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Have you looked at the documentation for
java.io.FileInputStream
to see what methods might be useful?
Post by:
autobot
Screaming fools! It's nothing more than a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 828 times.
Similar Threads
RandomAccessFile's Pointer
Java endian and bit order and signed and unsigned and python and more confusion than I can deal with
I/O Clarification
Byte vs Character streams
char = 1 byte ?? full code from jawroski quiz
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:58:02
.