Solved

Codes of Java access binary file

Posted on 1998-07-08
1
144 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse package explorer vs project explorer view 2 134
VB Script to add site to Java Exception List 4 78
xampp tool 12 50
null output 3 25
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

809 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