Solved

Codes of Java access binary file

Posted on 1998-07-08
1
141 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now