How can i Insert a blank line an output file from my code
I hav a problem in printing the charecters at th partyicular positon by getting the getFilePointer SO p-lz do help
It's not so simple as you might have in mind.
The following may serve to give some idea for your purpose..
import java.io.*;
public class RandAcc {
public static void main(String[] args) throws Exception{
try{
long filePointer=0L;
java.io.RandomAccessFile rf = new java.io.RandomAccessFile("in.txt","rw");//arbitrary input text file
System.out.println(String.valueOf(rf.getFilePointer()));
int q=0;
while((q=rf.read())!=-1){
filePointer=rf.getFilePointer();
System.out.print(String.valueOf(q));
System.out.print(": file pointer is at ");
System.out.println(String.valueOf(filePointer));
rf.seek(0L);//reset the filepointer
System.out.println(String.valueOf((char)rf.read()));//initial position
rf.close();
catch (Exception e){
throw e;
}
Similar Messages
-
How can we change the time of the media file from java code ?
Hi,
particularly, how can we start the media file from the second 55 and not from the second 0 (beginning) ?
Thanks.I tryed to use such method but an exception was raised:
javax.media.NotRealizedError: Cannot set media time on a unrealized controller
at com.sun.media.BasicPlayer.setMediaTime(BasicPlayer.java:427)
at com.sabily.mualim.main.MediaFileDemo.loadMediaFile(MediaFileDemo.java:72)
at com.sabily.mualim.main.MediaFileDemo.<init>(MediaFileDemo.java:77)
at com.sabily.mualim.main.MualimStandalone.main(MualimStandalone.java:12)
Exception in thread "main" javax.media.NotRealizedError: Cannot set media time on a unrealized controller
at com.sun.media.BasicPlayer.setMediaTime(BasicPlayer.java:427)
at com.sabily.mualim.main.MediaFileDemo.loadMediaFile(MediaFileDemo.java:72)
at com.sabily.mualim.main.MediaFileDemo.<init>(MediaFileDemo.java:77)
at com.sabily.mualim.main.MualimStandalone.main(MualimStandalone.java:12)
below is the code related to playing media file:
package com.sabily.mualim.main;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Panel;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.media.ControllerAdapter;
import javax.media.ControllerListener;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.RealizeCompleteEvent;
import javax.media.Time;
import javax.media.TimeBase;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MediaFileDemo extends JFrame{
private Player player;
Component center;
Component south;
private void loadMediaFile() {
final Container contentPane = getContentPane();
if (player != null) {
player.stop();
try {
// player = Manager.createPlayer(new URL("file:C:/Nouveau dossier/e1_intro.wav"));
player = Manager.createPlayer(new URL("file:C:/mp3/001.wav"));
//player = Manager.createPlayer(new URL("file:D:/Film/Earth_Planet/Planet.Earth.EP08.Jungles/Planet.Earth.EP08.Jungles.avi"));
} catch (NoPlayerException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
ControllerListener listener = new ControllerAdapter() {
public void realizeComplete(RealizeCompleteEvent event) {
Component vc = player.getVisualComponent();
if (vc != null) {
contentPane.add(vc, BorderLayout.CENTER);
center = vc;
} else {
if (center != null) {
contentPane.remove(center);
contentPane.validate();
Component cpc = player.getControlPanelComponent();
if (cpc != null) {
contentPane.add(cpc, BorderLayout.SOUTH);
south = cpc;
} else {
if (south != null) {
contentPane.remove(south);
contentPane.validate();
pack();
//setTitle("Lesson 1");
player.addControllerListener(listener);
player.setMediaTime(new Time(15));
player.start();
public MediaFileDemo() {
loadMediaFile();
public Player getPlayer() {
return player;
public void setPlayer(Player player) {
this.player = player;
Best Regards -
How can you insert "Page Break" in a pdf file so you will specify the pages
How can you insert "Page Break" in a pdf file so you will specify the pages
How / from what was the PDF originally created? It would be easiest to insert page breaks into the original document, then recreate the PDF.
-
How can i run Lightroom 3.6 with RAW files from Canon 650D?
How can i run Lightroom 3.6 with RAW files from Canon 650D?
Download the newest DNG converter from Adobe, convert your RAW photos to DNG, and then Import into Lightroom.
-
I am trying to construct an invoice. How can I install a vertical line between two or more underlined lines to create a break. I have tried the insert, shapes and nothing works. If I try any of the functions the whole document shifts to the right and I loose some of the lines. Is there a work around, or is I work not able to do what I want?
Thanks
ArmandIt sounds as though you may have "Object Causes Wrap" activated for the Line Shape. This will push other content away.
See the Wrap Inspector.
Jerry -
How can I insert a Pages, Doc, or PDF file into a Keynote presentation?
I need to insert a document (.pages, .doc, or .pdf anyone) into a Keynote for a portfolio that I must present. How can I do this? It doesn't give me that option under hyperlink in inspector.
the best is to insert screenshot directly in keynote. If it's for a paper version save everything as pdf and compile with "combine pdf".
-
How can I add the cc line to my emails from iphoto
I want to use the email in my iphoto program to email an invitation to a large group of people, but how do I add the cc line in my header of the email?
You can't. For a cc or bcc field you will have to use the regular Mail client. However, Mail does have some photo stationary if you like the fancy iPhoto presentation of photos in the emails:
Click to view full size
OT -
How can I insert an image into an mov file in iMovie while keeping the background music?
I have a short MOV file movie clip that has background music but one of the images (it's a static element with text) is incorrect. How can I replace the image but keep the backgroup the same? Also what size would the image need to be to properly fit?
Thank you!Hi hyue,
Thanks for visiting Apple Support Communities.
If you would like to add an image to a project in iMovie for iOS, see this article for helpful steps:
iMovie for iOS (iPad): Add photos to a project
http://support.apple.com/kb/PH3171
All the best,
Jeremy -
How can I tell iTunes to NOT convert certain files from wma format?
I just got an iPod classic, and downloaded iTunes and it automatically started adding all my music. I have almost 5000 songs that are in wma format, and it started converting them all. Then after it got almost 2000 songs finished, it just stopped. For no reason. So I tried to continue it, and apparently there is no way to just continue where it stopped. It started over at the beginning and is now re-converting all the files it already converted.
It took over 24 hours to convert those first 2000 files. It seems completely unnecessary that it should have to re-convert them all over again.
Is there any way that I can tell it NOT to convert those specific files? I figured that you should be able to right-click the file and say "DO NOT CONVERT" or something along those lines, but that is not an option.
The only other way I've been able to figure out that I could do this is to manually add only the files that it didn't convert last time. But that is over 3000 files, and they are not in the same order on my hard drive that they are on in iTunes so I would never be able to figure out what files were done and what files were not done.
There HAS to be a way to just highlight certain files and tell iTunes NOT to convert them. Hasn't there?
Someone please help me. This is really irritating, and I do not feel like waiting for another 3 days for this to finish. I have other things I need to do on my computer, and it seems that while iTunes is converting, it is making everything else very slow.
Thank you.I know they need to be converted, but the problem is, 2000 of the 5000 have already been converted. now it's trying to convert them again. but there is no reason for that. i want to know how to convert the other files that weren't converted yet, without having to re-convert the ones that were already done.
I would move the ones that were done to a separate folder, but I don't know exactly what ones were done. In iTunes, they are the first 2000 or so in the list, but on my hard drive they are not in the same order.
Does anyone else know if there's a way to do this? -
How can I use my time capsule to save files from my windows PC (Windows 8.1)?
I have been to see the iStore close to where I live but I am frustrated to say that they are no help what so ever. The technical desk there freely admits that they do not how to do it and all they say is "apparently it is easy. Just follow the instructions on screen" which helps me no end!
I have the Time Capsule set up on my mac and want to use part of the disc to save my files from my Windows PC (running Windows 8.1) that is on the same home network.
I have found the apple forums so helpful in the past that I am pinning on my hopes on anyone that can help me via the forum now!Load the airport utility for windows. Sadly the most recent one is old.
http://support.apple.com/kb/dl1547
Although it is for windows 7 it does work on 8 and 8.1 .. tell us if you have problems loading it. Some people find it won't work without using safe mode.
The utility will not help a lot to setup the latest model TC.. it is fine for Gen4 and earlier. But it does load bonjour for windows and a disk access agent.
The TC should run simple names.. Short.. keep them below 10 characters if you can. No spaces and pure alphanumeric.
That includes the base station name and wireless name.
Once all of that is correct, open windows explorer and type in the address bar.
\\TCname or \\TCipaddress where you replace TCname with the new short name or TCipaddress with obviously its actual IP.
You will then get a request for username and password. Username is whatever.. admin will do. Password type in your disk access password.. public by default.
TC is not designed to allow partitions so you cannot partition the TC disk. Create a folder and simply copy and paste your files to the folder.
NOTE:: The TC cannot back itself up. So make sure you do not move files to the TC without having another copy.
NOTE:: The TC does not happily mix TM backups and data.
See http://pondini.org/TM/Home.html For info about TM and the TC.
This area in particular.
Q3 http://pondini.org/TM/Time_Capsule.html
On mixing data and backups. -
Hi,
I have a requirement for a blank line in between the Static data and dynamic values part as shown below
Flag='Yes'
Ready='No'
Column1 Column2 Column3
a b c
d e f
g h i
Here after "Ready='No'" there is a blank line before the starting of Column1. I want to achieve that through xsd. I have tried with the nillable='true' , its not working.I am using SOA 11.1.1.7.0. Please help.
Thanks,
AbhishekHi !
Why are you using File.endSeparator '0'. ?
Are you sure your input data doesn't have those 3 blank records in the end? Check the message payload in the sxmb_moni transaction.
Regards,
Matias. -
I cannot get Elements 12 to recognise and load NEF files from my Nikon D5300. I have downloaded and installed the latest DNG coverter software 8.7.1 but Elements still refuses to load any NEF files.
regards Ian.Hi,
You shouldn't need to use the DNG converter unless you are using the MAC app version. The D5300 should be supported by Camera Raw 8.3 which should be compatible with Photoshop Elements 12.
In the editor go to Help -> About Plug-in -> Camera Raw to see which version you have loaded. The latest for Photoshop Elements 12 is 8.5. If you have an older one then go to the Help menu and select Updates.
If you are up to date, then you may have use old Nikon software to access the NEF files and that is known to corrupt them so that Photoshop Elements can't read them.
Brian -
How can I insert a link to an image file into numbers
I wish to include access to images in a numbers spreadsheet without actually inserting the images. Doing this where the image is a web page is not difficult but these images are on my local drive. I tried dropping an image file onto Safari ( the image opens as a page in Safari) and then copying the URL ( it has the form: file:///Users/JTC_49/Documents/Pictures/IMG_0248.JPG ) and using it to create a link ( Format>Add a Link>paste the URL into the 'link' field). That all seems to work but when you click on the link you get a message " Couldnt Open Link ". A web page link would open a browser and display the linked page. This does not appear to try to open a browser to pass the URL.
MacBook Pro, OS X Mavericks (10.9.3), Numbers 3.2Open the parent file. Go to Tools> Advanced Editing> Link tool. Then draw an area in the parent file with the link tool to open the new file. You will get the Create link dialog box. Under Link action, select "Open a file" and click on next. Select the file to open and click on Select button. You will get the "Specify Open Preference Window". Select "New Window" and Click on OK. Save the file and re-open it. This time the new file will open in a new window keeping the parent file.
Bobby Johnson. -
How can I get Elements 13 to read RAW files from Nikon D750?
I've upgrade my camera from the Nikon D3200 to the Nikon D750. With the D3200, I used Elements 11 to edit both JPEG and RAW files, but found out today Elements 11 isn't compatible with the D750 to read RAW files. I downloaded the trial version of Elements 13--which is compatible per the Adobe help desk, but the RAW files shot with the D750 still aren't being seen; however, I do see RAW files that I took with the D3200.
Same memory card is being used and I formatted the card when I changed it from one camera to the other.
What am I doing wrong? I almost always shoot RAW, so I need to be able to the files.
I'm wondering if Elements 13 really is compatible with the D750.
I want to add I'm using a MAC.
Thank you!
ShannonI was able to figure out the issue--the D750 files must be converted to DNG files first, then I can upload them to Elements and edit them as I would a RAW file.
If anyone else is having this issue, I found the video helpful: Learning | LR/PS - The Advantages of the DNG File Format | Photoshop.com.
You can find the free DNG converter here: Photoshop Help | Digital Negative (DNG)
This works for both MAC and Windows. -
How can I stop timeline sounds in external swf files from playing during loading?
I am having a problem with timeline sounds in external swf files playing during loading in a main swf. Can anyone help me?
Here is some of the code from the main swf. I hope I have included enough.
Thanks.
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.net.URLRequest;
import fl.events.SliderEvent;
import flash.media.SoundTransform;
preloader_mc.fill_mc.scaleX = 0;
var swfA:Array = ["part1.swf","part2.swf"];
var frameA:Array = [];
var currentLoader:Loader;
var swfTotalFrames:int;
var tl:MovieClip = this;
var st:SoundTransform = new SoundTransform()
var index:int = 0;
loadNextF();
play_slider.enabled = false;
function loadNextF():void{
tl["loader_"+index] = new Loader();
tl["loader_"+index].name = index.toString();
tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
tl["loader_"+index].load(new URLRequest(swfA[index]));
function progressF(e:ProgressEvent):void{
var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
preloader_mc.fill_mc.scaleX = fractionLoaded;
preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
function completeF(e:Event):void{
tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
SoundMixer.stopAll();
var mc:MovieClip = MovieClip(tl["loader_"+index].content);
mc.gotoAndStop(1);
frameA.push(mc.totalFrames);
index++;
if(index<swfA.length){
loadNextF();
} else {
// all loads complete. start play.
restart_mc.buttonMode = true;
restart_mc.alpha = 1;
tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
tl.removeChild(preloader_mc);
preloader_mc = null;
play_slider.enabled = true;
playpause_mc.alpha = 1;
currentLoader = tl["loader_0"];
tl.addChild(currentLoader);
MovieClip(currentLoader.content).play();
sliderParamsF();import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.net.URLRequest;
import fl.events.SliderEvent;
import flash.media.SoundTransform;
preloader_mc.fill_mc.scaleX = 0;
var swfA:Array = ["part1.swf","part2.swf"];
var frameA:Array = [];
var currentLoader:Loader;
var swfTotalFrames:int;
var tl:MovieClip = this;
var st:SoundTransform = new SoundTransform()
var index:int = 0;
loadNextF();
play_slider.enabled = false;
function loadNextF():void{
tl["loader_"+index] = new Loader();
tl["loader_"+index].name = index.toString();
tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
tl["loader_"+index].load(new URLRequest(swfA[index]));
function progressF(e:ProgressEvent):void{
var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
preloader_mc.fill_mc.scaleX = fractionLoaded;
preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
function completeF(e:Event):void{
tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
SoundMixer.stopAll();
var mc:MovieClip = MovieClip(tl["loader_"+index].content);
mc.gotoAndStop(1);
frameA.push(mc.totalFrames);
index++;
if(index<swfA.length){
loadNextF();
} else {
// all loads complete. start play.
restart_mc.buttonMode = true;
restart_mc.alpha = 1;
tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
tl.removeChild(preloader_mc);
preloader_mc = null;
play_slider.enabled = true;
playpause_mc.alpha = 1;
currentLoader = tl["loader_0"];
tl.addChild(currentLoader);
MovieClip(currentLoader.content).play();
sliderParamsF();
///////////////// start sliders /////////////////////////////////
sound_slider.addEventListener(SliderEvent.CHANGE,soundSliderF);
function soundSliderF(e:SliderEvent):void{
st.volume = e.value/100;
tl.soundTransform = st;
play_slider.addEventListener(SliderEvent.CHANGE,playSliderF);
play_slider.addEventListener(MouseEvent.MOUSE_DOWN,playSliderDownF);
//play_slider.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
function playSliderDownF(e:MouseEvent):void{
tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
stage.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
function playSliderUpF(e:MouseEvent):void{
tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
function playSliderF(e:SliderEvent):void{
SoundMixer.stopAll();
var frameNum:int = Math.ceil(swfTotalFrames*e.value/100);
var partialTotalFrames:int = 0;
for(var i:int=0;i<frameA.length;i++){
partialTotalFrames += frameA[i];
if(partialTotalFrames>=frameNum){
break;
partialTotalFrames -= frameA[i];
//trace(i,frameNum,frameNum-partialTotalFrames);
if(currentLoader!=tl["loader_"+(i)]){
tl.removeChild(currentLoader);
MovieClip(currentLoader.content).stop();
currentLoader = tl["loader_"+(i)];
tl.addChild(currentLoader);
if(playpause_mc.currentFrame==1){
MovieClip(currentLoader.content).gotoAndPlay(frameNum-partialTotalFrames);
} else {
MovieClip(currentLoader.content).gotoAndStop(frameNum-partialTotalFrames);
function sliderUpdateF(e:Event):void{
var playedFrames:int = 0;
for(var i:int=0;i<Number(currentLoader.name);i++){
playedFrames += frameA[i];
playedFrames += MovieClip(currentLoader.content).currentFrame;
play_slider.value = Math.round(100*playedFrames/swfTotalFrames);
function sliderParamsF():void{
swfTotalFrames = 0;
for(var i:int=0;i<swfA.length;i++){
swfTotalFrames += MovieClip(tl["loader_"+i].content).totalFrames;
///////////////// end sliders //////////////////////////////////
///////////////// start playpause restart ///////////////////////
playpause_mc.addEventListener(MouseEvent.CLICK,playpauseF);
playpause_mc.alpha = .2;
restart_mc.addEventListener(MouseEvent.CLICK,restartF);
restart_mc.buttonMode = false;
restart_mc.alpha = .2;
function playpauseF(e:MouseEvent):void{
if(!e.currentTarget.toggle){
MovieClip(currentLoader.content).stop();
tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
e.currentTarget.gotoAndStop(2);
} else {
MovieClip(currentLoader.content).play();
tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
e.currentTarget.gotoAndStop(1);
e.currentTarget.toggle = !e.currentTarget.toggle;
///////////////// end playpause //////////////////////////////
function playUpdateF(e:Event):void{
sliderUpdateF(e);
var playingFrame:int = MovieClip(currentLoader.content).currentFrame;
if(playingFrame==frameA[Number(currentLoader.name)]){
// next loader
MovieClip(currentLoader.content).stop();
SoundMixer.stopAll();
MovieClip(currentLoader.content).mute();
var nextIndex:int = Number(currentLoader.name)+1;
if(nextIndex<swfA.length){
tl.removeChild(currentLoader);
currentLoader = tl["loader_"+nextIndex];
tl.addChild(currentLoader);
MovieClip(currentLoader.content).gotoAndPlay(1);
} else {
tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
playpause_mc.gotoAndStop(2);
playpause_mc.toggle = !playpause_mc.toggle;
//playpause_mc.alpha = .2;
// all swfs have completed play
function restartF(e:MouseEvent):void{
MovieClip(currentLoader.content).stop();
tl.removeChild(currentLoader);
SoundMixer.stopAll();
MovieClip(currentLoader.content).mute();
currentLoader = tl["loader_"+0];
tl.addChild(currentLoader);
if(playpause_mc.currentFrame==1){
MovieClip(currentLoader.content).gotoAndPlay(1);
} else {
MovieClip(currentLoader.content).gotoAndStop(1);
Maybe you are looking for
-
Keyboard & trackpad dead on my unibody MBP
Hiya. I've got a late 2008 15" MBP that I haven't used for about 2 months, after using it extensively since 2009. I've had very little problems with it, but now that I've booted it up after the 2 month period, the integrated keyboard and trackpad are
-
My 5th generation iPod will not sync with my computer (windows7). It has before. Now it shows error -124. It wll sync with other computers. I have tried what they suugest on the computer.
-
Urgent...Firmware error?
I've had my iPod mini since march of this year. Up until this new update it has been working just fine. Now, however, it has decided not to work for me at all. So, first I downloaded new iTunes new iPod software, it said it needed to be updated. I go
-
CS4 - Additional File Formats and Effects Installation
We are operating in a networked environment and are experiencing trouble with After Effects 9 (CS4). Frequently AE wants to connect to the Web and download/install additional file formats and effects. The "student user" accounts do not allow this and
-
hello I need creat a digital signal and for this i use a counter output and then i need creat a delay after a signal measurment and for this i use again a couter. My problem is how i can make this delay betwen create and measure a signal. this delay