Selecting between java.io and java.nio
Hi,
I'm a bit confused between java.io and java.nio. What sre the major differences between these two?
In areas are these best applicable?
The java.nio package improves on the basic Java I/O that was available prior to JDK 1.4.
It is designed to interoperate more natively with the underlying file handles (sockets, open files etc) to achieve better performance.
The improvements include true non-blocking I/O, better buffer management, character-set support, channels (similar to Occam's channels) and selectors, and some other ancillery stuff. Most of these classes are designed to be inherently threadsafe.
There are some examples here:
http://java.sun.com/j2se/1.4.2/docs/guide/nio/example/index.html
However, if you are still a beginner with file or network I/O, its better if you start with the simple I/O first. You'll appreciate the NIO improvements better afterwards.
Similar Messages
-
Whats is difference between Java JRE and Java SDK
Hi,
what is the difference between Java JRE and Java SDK...
i think both of them have the same set of files to be installed...
I am not able to understand where they differThe JRE (Java runtime Environment) contains just the stuff necessary to run Java and the SDK (System Development Kit) contains the extra stuff necessary (and also helpful) to develop in Java.
-
Java io and Java nio, which is faster to binary io?
Anybody can advise me about java io and java nio ?
I want to write the faster code to read and write binary files.
I'm going to read/write
- individual elements (int, double, etc)
- arraylists
- objects
Also I'm going (or I'd want) to use seek functions.
ThanksAnybody can advise me about java io and java nio ?
I want to write the faster code to read and write binary files.Which is "faster" depends on exactly how you're using them. For example, a MappedByteBuffer is usually faster for random access than a RandomAccessFile, unless your files are so large (and your accesses so random) than you're constantly loading from disk. And it's not at all faster for linear uni-directional access than a simple FileInputStream.
So, rather than expecting some random stranger telling you that one is faster than the other without knowing your project, perhaps you should tell us exactly how you plan to use IO, and why you think that one approach may be faster than the other. -
Differnet Charting behaviour between Java 7 and Java 8
Hi I've developed an application with charts in Java FX and Java 7. Everything works fine, but now I've tested it with Java 8. There I can see, that something must have changed in the way a chart wil be painted.
The following code will describe the problem. Execute it with Java 7 and Java 8 and you will see what I mean.
package linechartsample;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.AreaChart;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.stage.Stage;
public class LineChartSample extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("Line Chart Sample");
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Month");
final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(
xAxis, yAxis);
lineChart.setTitle("Stock Monitoring");
lineChart.setCreateSymbols(false);
XYChart.Series series1 = new XYChart.Series();
series1.setName("Portfolio 1");
series1.getData().add(new AreaChart.Data(1, 10));
series1.getData().add(new AreaChart.Data(2, 20));
series1.getData().add(new AreaChart.Data(3, 10));
series1.getData().add(new AreaChart.Data(2, 5));
series1.getData().add(new AreaChart.Data(1, 10));
Scene scene = new Scene(lineChart, 800, 600);
lineChart.getData().addAll(series1);
StringBuilder builder = new StringBuilder();
// builder.append("-fx-stroke: ");
// builder.append("#");
// builder.append(Integer.toHexString(115));
// builder.append(Integer.toHexString(115));
// builder.append(Integer.toHexString(115));
// builder.append(Integer.toHexString(100));
builder.append("-fx-fill: ");
builder.append("#");
builder.append(Integer.toHexString(215));
builder.append(Integer.toHexString(115));
builder.append(Integer.toHexString(115));
builder.append(Integer.toHexString(100));
series1.getNode().setStyle(builder.toString());
stage.setScene(scene);
stage.show();
public static void main(String[] args) {
launch(args);
What happens here in Java 8???
Additionally I've tried to draw a simple AreaChart with a series of negative values. In Java 7 the area between the line and the X-Axis will be filled. In java 8 the area between the line and the bottom of the chart will be filled. Are there any new properties which have to set to draw it in the correct way? I've checked it with the stackedAreaChart. Here everything is fin in Java7 and Java8.
Can somebody explain me that change in the behaviour of the charts in JavaFX 8?? Or is this a Bug??
Kind regardsYour code is really weird.
Applying a fill to the line path in a line chart is a strange thing to do. Usually a line chart is for drawing lines not filled areas. For filled areas, JavaFX has an AreaChart.
Setting multiple y values for a given x value in a series is also a very strange thing to do. Usually for a LineChart plot, the x values in the series are unique.
I haven't tried your code on Java 7 as I don't have Java 7 installed and your code doesn't really seem like a valid test case to me anyway. That your code got you a result you wanted in Java 7 would be more a fluke than anything else, I would guess.
For your area chart question, please ask that as a separate question with reproducible source code and test case.
If you really think there are bugs or regressions in JavaFX, then report them in the bug tracker after running your tests on the latest development JDK at: https://jdk8.java.net/download.html -
Passing variables between data tag and Java
Hello all,
I have a question about using variables between data tag and java.
Let me explain.
I would like to populate variable "Test" with
the information returned by jbo data tag library.
<code>
<% String Test = "%><jbo:ShowValue datasource="ds" dataitem="Cod" /><%";%>
or
<% String Test = "<jbo:ShowValue datasource="ds" dataitem="Cod" />";%>
</code>
This code did not work.
Some suggestions
Thanks
Humberto
nullHumberto,
I'm afraid I do not know the specific answer
to your question (perhaps Juan the Data Tag
Wizard will reply ;-). I vaguely recall
struggling with teh same issue when I was
playing with the tags for a demo. Here
is a hack-around lifted from my demo
that might help:
<jbo:Row id="privRow" action="CURRENT" datasource="privileges" />
<%
String privName = (String)privRow.getAttribute("Privilegename");
%>
In other words, I ended up using the Row
tag to get a local Java variable bound to the
row instance and then used its methods
to extract the value. I presume the class
of the row instance is oracle.jbo.Row
and you can lookup its supported methods
in the reference doc.
I'd be interested to hear if their is a more
elegant way - the one suggested above is
pretty tedious.
Regards,
Bill
---- -
Component that implements encryption solution between the browser and Java
I need a Component that implements encryption solution between the browser and Java tier.
I am a java programmer and have really limited knowledge about cryptography. I work on JSF . I am basically looking to build a component that will ensure that the password entered by the user in the login page of the browser is properly encrypted using Java script and then we should be able to decrypt it in the Java Tier.
Basically, I think we need a public-private key system. We send the public key to the browser and use it with JavaScript to encrypt the key and we hold the private key on the server to decrypt it.
If some one can help me with this it would be very helpful. Or if anyone can point me to some resource that does this kind of thing I shall be obliged.Can't use HTTPs as many of our existing customers
that run on intranet do not use HTTPs.Is there really a technical reason that your clients cannot use HTTPS? If so, what is it and why would your homebrew re-implementation of the same technology be acceptable instead? -
What're the differences between JSP, Java Script, and Java Applet?
I am confused by the concepts: JSP (Java Server Page), Java Script, and Java Applet? What are their main differences?
I don't know about differences, but one of their main similarities is that each of them has a page in Wikipedia.
JSP
JavaScript
[Java applet|http://en.wikipedia.org/wiki/Java_applet]
There. That should give you enough information. -
I am a IT graduate and I still need some clarification on the relationship between Java SE and Java EE API. Does EE include SE?
For application development, I know I can use only SE without the EE, but can I use EE alone without SE?
Any good articles addressing my questions?
Thank you very much
RJava EE in fact extends java SE, its primarily aim is to simplify developing multitier enterprise applications (Java SE provides all the necessary basic libraries etc.)
Because Java EE is an extension of Java SE, you cant use EE without SE - without SE there is no EE. -
Java SE5 and Java EE5 difference
What is the difference between Java SE5 and Java EE5? Also difference btwn SDK and JDK? I am confused about these basic concepts.
Thanks
GeetJava Platform, Enterprise Edition is a related specification which includes all of the classes in Java SE, plus a number which are more useful to programs which run on servers as opposed to workstations.
Java EE includes several API specifications, such as JDBC, RMI, e-mail, JMS, web services, XML, etc, and defines how to coordinate them. Java EE also features some specifications unique to Java EE for components. These include Enterprise JavaBeans, servlets, portlets (following the Java Portlet specification), JavaServer Pages and several web service technologies. -
Drop java class and java source
Hi,
When I query user_objects I get some java class and java source objects
select * from user_objects where object_type like 'JAVA %';
How do I drop these java source and java class objects from the database
I tried using the following command
drop java class /4a524d89_AutoTransliteratorPk
drop java source AutoTransliteratorPkg
But I get error ORA-29501: invalid or missing Java source, class, or resource name
Please someone help me in dropping these objects
thanks
saazwas the java source all caps or was it exactly AutoTransliteratorPkg. If its exactly AutoTransliteratorPkg then try this
drop java source "AutoTransliteratorPkg" -
Help Needed in Creating Java Class and Java Stored Procedures
Hi,
Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
I have seen the Documents. But i couldn't able to understand it correctly.
I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
Is that possible to Create a Java class in the oracle Database itself ?.
Where are the files located for the existing Java Class ?..
Help Needed Please.
Thanks,
Murali.vHi Murali,
Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
Configure deployment to a database to upload the java file instead of class
The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
Hope this helps,
Sunil.. -
About Java mapping and java proxy
Hi
Iam new to Xi and basically iam an ABAPER.When iam dooing mappinps or proxies i cant able to understand the java pari cant (javamapping and java proxies) .I need some notes on java mapping and java proxy which is easy to do.And why do we use this java mapping or java proxy particularly when we r having abap mappipng and abap proxy.
thanks in advanceHi,
refer
Java Mapping
SAP Network Blog: Java Mapping (Part I)
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
Java Mapping in XI
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
Runtime Environment (Java Mappings) (SAP Library - Partner Connectivity Kit)
http://help.sap.com/saphelp_nw04/helpdata/en/bd/c91241c738f423e10000000a155106/frameset.htm
Java Mapping (SAP Library - Partner Connectivity Kit)
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
SAP Network Blog: Testing and Debugging Java Mapping
/people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
SAP Network Blog: Implementing a Java Mapping in SAP PI
/people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
"JAVA MAPPING", an alternate way of reading a CSV file
/people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
SAP Network Blog: XI Java Mapping Helper (DOM)
/people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
Java Proxy
Java Proxy Objects (SAP Library - SAP Exchange Infrastructure)
http://help.sap.com/saphelp_nw04/helpdata/en/c5/7d5e3c754e476ee10000000a11405a/frameset.htm
Accessing Active Directory through Java Proxy on SAP Exchange Infrastructure 3.0
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10716e9f-23d7-2a10-8c8c-d2665615f8fc
Thanks
Swarup -
JAVA beans and JAVA related services require Oracle client to be installed?
Can you please advice whether an application server that make use of JAVA beans and JAVA related services require Oracle client to be installed? For an example if the solution build based on Java and JBOSS to be used as application server, do we still require oracle client to be installed and configure the tnsnames in order to communicate to database server?
SHANOJ wrote:
Can you please advice whether an application server that make use of JAVA beans and JAVA related services require Oracle client to be installed? For an example if the solution build based on Java and JBOSS to be used as application server, do we still require oracle client to be installed and configure the tnsnames in order to communicate to database server?Oracle client is not required when JDBC is used to connect to the remote DB -
I have problems to deploy the API's Java Mail and Java Activator
into Oracle 8.1.5 on a NT4 server.
When deploying the classes in the API's that has names beginning
with "com/sun/java..." everything works fine, but when trying to
deploy the classes starting with "javax..." I get error:
"ORA-01031 Unsufficient privileges."
The error occurs during the creation of the classes.
Does someone know why?
I have tried to unjar the jar-files, and rejar them again with
no compression, but this does not help.
/Lars-Eric
nullHi Mark
I wish to send email messages from stored procedure. I looked at
the "Java Stored Procedures Developer's Guide" but I am still
confused. I wrote a Java program (importing "javax.mail" package)
and then I called "loadjava": it did not work
I read this reply, but I do not understand exactly what you mean.
I am quite new to Oracle, and there are "tons" of things which I
do not understand.
Would you please explain me what I have to do to send email from
a stored procedure?
Thanks in advance, Carlo
email: [email protected]
PS: Sorry for my bad English
mark tomlinson (guest) wrote:
: In addition to loading JavaMail as sys in the database. You
also
: need to load the "invocation framework" that JavaMail depends
on
: (there is a link on the Javasoft JavaMail site to download the
: code).
: When you load java code as SYS you can pass the -s and -g
public
: options to loadjava to make sure that public synonyms are
created
: and that the loaded classes are runnable by all schemas:
null -
Java Platform 7u9 and Java Deployment Kit plug-ins are yellow and asked to be updated.
The problem is that there is no other version than I have already installed.
Even if I try to instal this latest version again I've get the message that I already have the latest version.
The same problem was with Flashplayer where I installed the latest version but three days Firefox asked to update the plugin.
The last one is now ok but Java Platform and Java Deployment Kit is hopeless.
Why it ask for an update if there is none?
What should or can I do? I always be careful and patch my pc if necesserry.
All my friends who are working with Firefox have the same problem.
Can anybody tell me whats going on here?
greetings, Mimi321Hi
There is still an issue for me. When i check to see if add-ons are up to date it identifies "Java(TM) Platform SE 7 U9" as out-of-date and gives me an orange "Update" action. When i hit this it takes me to the Java website giving me "Recommended Version 7 Update 9". This is the one i've already got so i cannot get rid of the orange Update action buttons.
Furthermore, if i try the link earlier in this thread to test to see which version of Java i should be using it says "Congratulations! You have the recommended Java installed (Version 7 Update 9)" so i'm not sure what this talk of version 7.10 is about?
Maybe you are looking for
-
hard drive 1 303 i have the recovery disc but it wont go past where it says starting windows
-
Reg:JCO_COMMUNICATION_FAILURE
Hi all, I am getting this error while trying to excecute one IDOC to Proxy interface.Can anyone please let me know the solution? <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <!-- Request Message Mapping --> - <SAP:Error xmlns:SAP="ht
-
How to install Route 66 navigation software on N95...
I am trying to install Route 66 Mobile 7 Benelux navigation software on my N95. The software manufacturer has given me the instructions below, but this still has not worked. I cannot see the Rooute 66 Icon in the phone. Can someone help? Thanks The i
-
Logic X doesn't Recognize Trilian
I just got Logic X and i'm able to see Spectrasonics Omnisphere as well as Stylus RMX under the AU Instruments tab but not Trilian. I've looked to see if the AU Unit was not verified but its actually not showing up at all. Logic is not even recognizi
-
Get Approval Group by pass item or its category
We make Approval Group based on item category for PR or PO approval. The question is , i want to get approval group based on item or its category. Just pass item id and get which approval group is going to approval this item. i got po_control_rules t