Solved

Codes of Java access binary file

Posted on 1998-07-08
1
156 Views
Last Modified: 2012-05-04
I want use Java to display different font like chinese ttf file.
Can we retrieve font pixel map from the binary file of TTF?
How can we get the binary like C language fgetc or fread?
If you answer me,I will be happy and thank you.
0
Comment
Question by:mathematics
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
msmolyak earned 20 total points
ID: 1225605
Reading files is easy. You can use either RandomAccessFile or DataInputStream on top of FileInputStream. E.g.

public static final int BUFFER_SIZE = 4096;

File tiffFile = new File("image.tif");
DataInputStream tiffStream = new DataInputStream(new FileInputStream(tiffFile));

byte[] buffer = new byte[BUFFER_SIZE];

int bytesRead;
while ((bytesRead = tiffStream.read(buffer)) >= 0)
{
  // Process data buffer
}
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question