java

How do I convert multiple png images to a single tiff file

I have a byte array of several images in the png format. I have to convert this to a tiff file and then into the corresponding byte array. This tiff file will hold multiple images. I have searced a lot, but I haven't been successful. The catch is. i have to do this in java only!! :) Can anyone provide some insight as regards my issue? ...

Why is String's format(Object... args) defined as a static method?

I wonder why Java 5 and above provide a printf-style formatter using a static method in class String like this: public static String format(String format, Object... args) instead of public String format(Object... args) so that we can write "%02d".format(5) to get 05 instead of String.format("%02d", 5). I imagined if I could modi...

I have a problem with display link

the link is not forwording to 1.jsp this code is not working properly <display:column property="in" sortable="true" href="1.jsp" paramid="1.jsp"/> thanx ...

Do objects encapsulate data so that not even other instances of the same class can access the data?

In Java, Do objects encapsulate data so that not even other instances of the same class can access the data? Only when the keyword "private" is used? What are "accessor methods" in Java - methods like getName()? Thanks ...

Problem in accessing a mapped network drive.

Hi all, We have a problem in accessing content on a mapped network drive. We have a web application running on weblogic 8.1 on (Windows 2000 NT). The application retreives images from a mapped network drive and displays. Now we are moving our application onto a virtual machine (Windows 2003 SP1) hosted on Weblogic 10.3. But on this ...

How to read negative byte values in Java less than -128

I'm reading data from another system using the serial port. I'm reading packets of 133 bytes. The second byte is the packet number and the third byte is the negative value of the packet number. The problem is that the type byte has a range of -128 to 127. When I attempt to read -129 (outside the range of byte) it will give the value ...

Java: fillings two vectors and sorting them

How can I fill up two vectors and combine them with eachother (either index or an object type in class). I guess if I use index to combine them, then the sorting can be handeld with Collections.sort otherwise I have to create a comparator. On plus we have to code down to the 1.4 convention. No generics pls... To make your imagination e...

Java to JSP. How to?

hi i have written a java program which currently runs as a desktop app, it is returning all results accurately as required in the console. I am now faced by a challenge to convert this application to a web application (JSP). Currently, the code for my projects is in user/workspace (as i am using eclipse) and my tomcat has been insta...

Organizing files in "buckets"

My problem is like this: I have a written a client side HTTP cache and I need to store the HTTP payload in the file system somehow. I do not want to clutter the filesystem with unnecessary files. I have written this class: /* * Copyright (c) 2008, The Codehaus. All Rights Reserved. * * Licensed under the Apache License, Version...

How to design an object which can be one of two types ?

I'm reading a HTTP POST and the body of the HTTP request can be either JSON or XML. Now I've delegated the reading to a special utility class. interface HttpUtils { BodyWrapper parseBody( HttpServletRequest req ); } interface BodyWrapper { boolean isXML(); // 1 boolean isJSON(); // 2 String body(); // 3 } I hate ...

How to convert from TimePrimitive to int?

I have some data values(of type TimePrimitive) which i need to write out to a file , but the method out.write() takes only the parameter as int so i need to find a way to convert my values to int ...

Secret Handshake Anti-Pattern

I've just come across a pattern I've seen before, and wanted to get opinions on it. The code in question involves an interface like this: public interface MyCrazyAnalyzer { public void setOptions(AnalyzerOptions options); public void setText(String text); public void initialize(); public int getOccurances(String query); ...

how to do actors (erlang) in java?

I work on financial applications in Java and getting concurrency right is pain. Erlang and the actors model is supposed to be a good fit for massively concurrent applications but I can't figure out how to do it in Java. I know there are libraries such as Jetlang, FunctionalJava, kilim, etc., but they don't usually go beyond simplistic ...

Relaxer or JAXB for XML->Object Model?

I would like generate an AST from my XML-definition, to be used for code generation later on. The XML schema is written in Relax NG, since it seemed like a neater and more modern than XSD and DTD (loose assumption). I especially fancy the compact syntax, which feels more natural to work with and is far more readable than XML. Has anyo...

Sending attachments from Axis webservice to .NET client?

Trying to provide a web service capable of sending files to a client on request, I run into the following problem: On the server side, the service is written in Java, using Axis 1 v1.4.1 (I know, it's obsolete, but it's a legacy application which I'm supposed to extend, and the effort involved in migrating to something more up-to-date, ...

Logging JPA SQL with Weblogic 10.3

By looking into the Open JPA website i've found that i can log the generated SQL by using the following: <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO"/> If i try to add the above property to my persistence.xml i get the following warning from weblogic: <Warning> <J2EE> <BEA-160202> <You have specifie...

How to improve the performance of Client-Server Architecture Application?

We have a product built on the Client-Server architecture. Some details about the technology stack used. Client - Java Swing Server - RMI Java Database - Oracle The clients are located at different parts of the world but the java server & the oracle database are located on the same machine at Sweden. Because of this there is a lo...

"Island of isolation" of Garbage Collection

Could anyone please explain the concept of Island of isolation of Garbage Collection? ...

Use external Bundle-Localization path in MANIFEST file

The MANIFEST.MF file contains an entry to define which *.properties files are loaded at runtime. These entry defined name and the corresponding properties file is used to translate the plugin strings which start with the prefix "%", like "%plugin.name" Bundle-Localization: plugin plugin.properties than contains a line like %plugin.na...

Why is it important to understand the difference between reference types and primitive types in Java?

I'm after a list of issues in Java that cannot be properly understood without first understanding the difference. For example: Passing parameters to methods Precisely what limitations are imposed by using "final" on a variable declaration. What == means Any more? EDIT: this question doesn't seem to make sense to people. The m...